GlobalConfigureSetting.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Collections.Generic;
  2. using System.Configuration;
  3. namespace HNWD.Pregrant.Common
  4. {
  5. /// <summary>
  6. /// 全局配置设置
  7. /// </summary>
  8. public static class GlobalConfigureSetting
  9. {
  10. private static Dictionary<string, string> dic = new Dictionary<string, string>();
  11. static GlobalConfigureSetting()
  12. {
  13. if (ConfigurationManager.ConnectionStrings["WD_IPCALL_PREGNANT"] != null)
  14. {
  15. dic.Add("WD_IPCALL_PREGNANT", ConfigurationManager.ConnectionStrings["WD_IPCALL_PREGNANT"].ToString());
  16. }
  17. }
  18. public static void AddConnectionSetting(string dataSource)
  19. {
  20. if (dic.ContainsKey("WD_IPCALL_PREGNANT"))
  21. {
  22. dic["WD_IPCALL_PREGNANT"] = dataSource;
  23. }
  24. else
  25. {
  26. dic.Add("WD_IPCALL_PREGNANT", dataSource);
  27. }
  28. }
  29. public static void AddCallingStayingTime(string StayingTime)
  30. {
  31. if (dic.ContainsKey("STAYINGTIME"))
  32. {
  33. dic["STAYINGTIME"] = StayingTime;
  34. }
  35. else
  36. {
  37. dic.Add("STAYINGTIME", StayingTime);
  38. }
  39. }
  40. public static void AddWebServerHostIP(string HostIP)
  41. {
  42. if (dic.ContainsKey("HostIP"))
  43. {
  44. dic["HostIP"] = HostIP;
  45. }
  46. else
  47. {
  48. dic.Add("HostIP", HostIP);
  49. }
  50. }
  51. public static string GetConfigureSetting(string keyValue)
  52. {
  53. return dic[keyValue];
  54. }
  55. }
  56. }