|
|
@@ -1,4 +1,5 @@
|
|
1
|
|
-using System.Configuration;
|
|
|
1
|
+using System.Collections.Generic;
|
|
|
2
|
+using System.Configuration;
|
|
2
|
3
|
using System.Web;
|
|
3
|
4
|
namespace CallCenter.Utility
|
|
4
|
5
|
{
|
|
|
@@ -37,7 +38,7 @@ namespace CallCenter.Utility
|
|
37
|
38
|
/// </summary>
|
|
38
|
39
|
/// <param name="key">要修改的Key</param>
|
|
39
|
40
|
/// <param name="value">要修改为的值</param>
|
|
40
|
|
- public static void SetValue(string key, string value)
|
|
|
41
|
+ public static bool SetValue(string key, string value)
|
|
41
|
42
|
{
|
|
42
|
43
|
try
|
|
43
|
44
|
{
|
|
|
@@ -57,9 +58,41 @@ namespace CallCenter.Utility
|
|
57
|
58
|
xNode.AppendChild(xElem2);
|
|
58
|
59
|
}
|
|
59
|
60
|
xDoc.Save(HttpContext.Current.Server.MapPath("~/Configs/system.config"));
|
|
|
61
|
+
|
|
|
62
|
+ return true;
|
|
|
63
|
+ }
|
|
|
64
|
+ catch
|
|
|
65
|
+ {
|
|
|
66
|
+ return false;
|
|
|
67
|
+ }
|
|
|
68
|
+ }
|
|
|
69
|
+
|
|
|
70
|
+ /// <summary>
|
|
|
71
|
+ /// 获取配置列表
|
|
|
72
|
+ /// </summary>
|
|
|
73
|
+ /// <returns></returns>
|
|
|
74
|
+ public static Dictionary<string, string> GetList()
|
|
|
75
|
+ {
|
|
|
76
|
+ Dictionary<string, string> paras = new Dictionary<string, string>();
|
|
|
77
|
+
|
|
|
78
|
+ try
|
|
|
79
|
+ {
|
|
|
80
|
+ System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
|
|
|
81
|
+ xDoc.Load(HttpContext.Current.Server.MapPath("~/Configs/system.config"));
|
|
|
82
|
+ System.Xml.XmlNode xNode = xDoc.SelectSingleNode("//appSettings");
|
|
|
83
|
+
|
|
|
84
|
+ var enumer = xNode.SelectNodes("//add").GetEnumerator();
|
|
|
85
|
+ while (enumer.MoveNext())
|
|
|
86
|
+ {
|
|
|
87
|
+ System.Xml.XmlElement xe = (System.Xml.XmlElement)enumer.Current;
|
|
|
88
|
+ paras.Add(xe.GetAttribute("key"), xe.GetAttribute("value"));
|
|
|
89
|
+ }
|
|
60
|
90
|
}
|
|
61
|
91
|
catch
|
|
62
|
|
- { }
|
|
|
92
|
+ {
|
|
|
93
|
+ }
|
|
|
94
|
+
|
|
|
95
|
+ return paras;
|
|
63
|
96
|
}
|
|
64
|
97
|
}
|
|
65
|
98
|
}
|