市长热线演示版

ligerComboBox.ashx.cs 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using HySoft.Common;
  6. using System.Data;
  7. using System.Text;
  8. namespace HySoft.BaseCallCenter.Web.workordermanage.ajax
  9. {
  10. /// <summary>
  11. /// ligerComboBox1 的摘要说明
  12. /// </summary>
  13. public class ligerComboBox1 : IHttpHandler
  14. {
  15. public void ProcessRequest(HttpContext context)
  16. {
  17. context.Response.ContentType = "text/plain";
  18. string action = CommonRequest.GetQueryString("action");
  19. switch (action)
  20. {
  21. case "getF_Namelist":
  22. context.Response.Write(getF_Namelist(context));
  23. break;
  24. case "getF_TypeNamelist":
  25. context.Response.Write(getF_TypeNamelist(context));
  26. break;
  27. case "gettreelist":
  28. context.Response.Write(gettreelist(context));
  29. break;
  30. case "getSERVICEMETHODtree":
  31. context.Response.Write(getSERVICEMETHODtree(context));
  32. break;
  33. case "getSERVICETYPElist":
  34. context.Response.Write(getSERVICETYPElist(context));
  35. break;
  36. case "getVISITOPINIONlist":
  37. context.Response.Write(getVISITOPINIONlist(context));
  38. break;
  39. case "getCUSTOMEROPINIONlist":
  40. context.Response.Write(getCUSTOMEROPINIONlist(context));
  41. break;
  42. case "getSOLVElist":
  43. context.Response.Write(getSOLVElist(context));
  44. break;
  45. case "getSTANDARDADDRESSlist":
  46. context.Response.Write(getSTANDARDADDRESSlist(context));
  47. break;
  48. case "getORDERTYPElist":
  49. context.Response.Write(getORDERTYPElist(context));
  50. break;
  51. case "getF_RoleName":
  52. context.Response.Write(getF_RoleNamelist(context));
  53. break;
  54. }
  55. }
  56. #region 获取数据
  57. private string getF_Namelist(HttpContext context)
  58. {
  59. string res = "";
  60. DataTable dt = new DataTable();
  61. string sql = " ";
  62. try
  63. {
  64. dt = new BLL.T_Wo_WorkOrderState().GetList(" ").Tables[0];
  65. System.Collections.Generic.List<Model.TreeModel> modelList = BindZXZTree(dt, "0");
  66. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  67. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  68. {
  69. //JSON序列化
  70. serializer.WriteObject(stream, modelList);
  71. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  72. }
  73. }
  74. catch (Exception err)
  75. {
  76. //res = err.ToString();
  77. }
  78. finally
  79. {
  80. dt.Clear();
  81. dt.Dispose();
  82. }
  83. return res;
  84. }
  85. private string getSERVICEMETHODtree(HttpContext context)
  86. {
  87. string res = "";
  88. DataTable dt = new DataTable();
  89. string sql = " ";
  90. try
  91. {
  92. dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='fwfs' ").Tables[0];
  93. System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
  94. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  95. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  96. {
  97. //JSON序列化
  98. serializer.WriteObject(stream, modelList);
  99. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  100. }
  101. }
  102. catch (Exception err)
  103. {
  104. //res = err.ToString();
  105. }
  106. finally
  107. {
  108. dt.Clear();
  109. dt.Dispose();
  110. }
  111. return res;
  112. }
  113. private string getSERVICETYPElist(HttpContext context)
  114. {
  115. string res = "";
  116. DataTable dt = new DataTable();
  117. string sql = " ";
  118. try
  119. {
  120. dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='fwllx' ").Tables[0];
  121. System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
  122. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  123. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  124. {
  125. //JSON序列化
  126. serializer.WriteObject(stream, modelList);
  127. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  128. }
  129. }
  130. catch (Exception err)
  131. {
  132. //res = err.ToString();
  133. }
  134. finally
  135. {
  136. dt.Clear();
  137. dt.Dispose();
  138. }
  139. return res;
  140. }
  141. private string getVISITOPINIONlist(HttpContext context)
  142. {
  143. string res = "";
  144. DataTable dt = new DataTable();
  145. string sql = " ";
  146. try
  147. {
  148. dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='hfjy' ").Tables[0];
  149. System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
  150. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  151. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  152. {
  153. //JSON序列化
  154. serializer.WriteObject(stream, modelList);
  155. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  156. }
  157. }
  158. catch (Exception err)
  159. {
  160. //res = err.ToString();
  161. }
  162. finally
  163. {
  164. dt.Clear();
  165. dt.Dispose();
  166. }
  167. return res;
  168. }
  169. private string getCUSTOMEROPINIONlist(HttpContext context)
  170. {
  171. string res = "";
  172. DataTable dt = new DataTable();
  173. string sql = " ";
  174. try
  175. {
  176. dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='khyjfl' ").Tables[0];
  177. System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
  178. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  179. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  180. {
  181. //JSON序列化
  182. serializer.WriteObject(stream, modelList);
  183. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  184. }
  185. }
  186. catch (Exception err)
  187. {
  188. //res = err.ToString();
  189. }
  190. finally
  191. {
  192. dt.Clear();
  193. dt.Dispose();
  194. }
  195. return res;
  196. }
  197. private string getSOLVElist(HttpContext context)
  198. {
  199. string res = "";
  200. DataTable dt = new DataTable();
  201. string sql = " ";
  202. try
  203. {
  204. dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='jjqk' ").Tables[0];
  205. System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
  206. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  207. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  208. {
  209. //JSON序列化
  210. serializer.WriteObject(stream, modelList);
  211. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  212. }
  213. }
  214. catch (Exception err)
  215. {
  216. //res = err.ToString();
  217. }
  218. finally
  219. {
  220. dt.Clear();
  221. dt.Dispose();
  222. }
  223. return res;
  224. }
  225. private string getSTANDARDADDRESSlist(HttpContext context)
  226. {
  227. string res = "";
  228. DataTable dt = new DataTable();
  229. string sql = " ";
  230. try
  231. {
  232. dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='bxrxz' ").Tables[0];
  233. System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
  234. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  235. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  236. {
  237. //JSON序列化
  238. serializer.WriteObject(stream, modelList);
  239. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  240. }
  241. }
  242. catch (Exception err)
  243. {
  244. //res = err.ToString();
  245. }
  246. finally
  247. {
  248. dt.Clear();
  249. dt.Dispose();
  250. }
  251. return res;
  252. }
  253. private string getORDERTYPElist(HttpContext context)
  254. {
  255. string res = "";
  256. DataTable dt = new DataTable();
  257. string sql = " ";
  258. try
  259. {
  260. dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='wtlb' ").Tables[0];
  261. System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
  262. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  263. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  264. {
  265. //JSON序列化
  266. serializer.WriteObject(stream, modelList);
  267. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  268. }
  269. }
  270. catch (Exception err)
  271. {
  272. //res = err.ToString();
  273. }
  274. finally
  275. {
  276. dt.Clear();
  277. dt.Dispose();
  278. }
  279. return res;
  280. }
  281. private string gettreelist(HttpContext context)
  282. {
  283. string res = "";
  284. DataTable dt = new DataTable();
  285. string sql = " ";
  286. try
  287. {
  288. dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='fwlx' ").Tables[0];
  289. System.Collections.Generic.List<Model.TreeModel> modelList = Tree(dt, "0");
  290. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  291. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  292. {
  293. //JSON序列化
  294. serializer.WriteObject(stream, modelList);
  295. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  296. }
  297. }
  298. catch (Exception err)
  299. {
  300. //res = err.ToString();
  301. }
  302. finally
  303. {
  304. dt.Clear();
  305. dt.Dispose();
  306. }
  307. return res;
  308. }
  309. private string getF_TypeNamelist(HttpContext context)
  310. {
  311. string res = "";
  312. DataTable dt = new DataTable();
  313. string sql = " ";
  314. try
  315. {
  316. dt = new BLL.T_Wo_WorkOrderType().GetList(" F_ParentId=1").Tables[0];
  317. System.Collections.Generic.List<Model.TreeModel> modelList = BindTree(dt, "0");
  318. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  319. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  320. {
  321. //JSON序列化
  322. serializer.WriteObject(stream, modelList);
  323. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  324. }
  325. }
  326. catch (Exception err)
  327. {
  328. //res = err.ToString();
  329. }
  330. finally
  331. {
  332. dt.Clear();
  333. dt.Dispose();
  334. }
  335. return res;
  336. }
  337. private string getF_RoleNamelist(HttpContext context)
  338. {
  339. string res = "";
  340. DataTable dt = new DataTable();
  341. string sql = " ";
  342. try
  343. {
  344. dt = new BLL.T_Sys_RoleInfo().GetList(" F_RoleId in (30,31)").Tables[0];
  345. System.Collections.Generic.List<Model.TreeModel> modelList = RoleNameBindTree(dt, "0");
  346. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<Model.TreeModel>));
  347. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  348. {
  349. //JSON序列化
  350. serializer.WriteObject(stream, modelList);
  351. res = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  352. }
  353. }
  354. catch (Exception err)
  355. {
  356. //res = err.ToString();
  357. }
  358. finally
  359. {
  360. dt.Clear();
  361. dt.Dispose();
  362. }
  363. return res;
  364. }
  365. public List<Model.TreeModel> BindZXZTree(DataTable tab, string parentid)
  366. {
  367. if (tab != null && tab.Rows.Count > 0)
  368. {
  369. System.Collections.Generic.List<Model.T_Wo_WorkOrderState> categorylist = new BLL.T_Wo_WorkOrderState().DataTableToList(tab);
  370. System.Collections.Generic.List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
  371. for (int i = 0; i < categorylist.Count; i++)
  372. {
  373. Model.TreeModel model = new Model.TreeModel();
  374. string currentID = categorylist[i].F_WorkOrderStateId.ToString();//当前功能ID
  375. model.id = currentID;
  376. model.IconCls = categorylist[i].F_Des;
  377. model.text = categorylist[i].F_Name;
  378. modelList.Add(model);
  379. }
  380. return modelList;
  381. }
  382. else
  383. {
  384. return null;
  385. }
  386. }
  387. public List<Model.TreeModel> Tree(DataTable tab, string parentid)
  388. {
  389. if (tab != null && tab.Rows.Count > 0)
  390. {
  391. System.Collections.Generic.List<Model.T_Sys_DictionaryValue> categorylist = new BLL.T_Sys_DictionaryValue().DataTableToList(tab);
  392. System.Collections.Generic.List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
  393. for (int i = 0; i < categorylist.Count; i++)
  394. {
  395. Model.TreeModel model = new Model.TreeModel();
  396. string currentID = categorylist[i].F_DictionaryValueId.ToString();//当前功能ID
  397. model.id = currentID;
  398. model.IconCls = categorylist[i].F_DictionaryFlag;
  399. model.text = categorylist[i].F_Name;
  400. modelList.Add(model);
  401. }
  402. return modelList;
  403. }
  404. else
  405. {
  406. return null;
  407. }
  408. }
  409. public List<Model.TreeModel> RoleNameBindTree(DataTable tab, string parentid)
  410. {
  411. if (tab != null && tab.Rows.Count > 0)
  412. {
  413. System.Collections.Generic.List<Model.T_Sys_RoleInfo> categorylist = new BLL.T_Sys_RoleInfo().DataTableToList(tab);
  414. System.Collections.Generic.List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
  415. for (int i = 0; i < categorylist.Count; i++)
  416. {
  417. Model.TreeModel model = new Model.TreeModel();
  418. string currentID = categorylist[i].F_RoleId.ToString();//当前功能ID
  419. model.id = currentID;
  420. model.text = categorylist[i].F_RoleName;
  421. modelList.Add(model);
  422. }
  423. return modelList;
  424. }
  425. else
  426. {
  427. return null;
  428. }
  429. }
  430. public List<Model.TreeModel> BindTree(DataTable tab, string parentid)
  431. {
  432. if (tab != null && tab.Rows.Count > 0)
  433. {
  434. System.Collections.Generic.List<Model.T_Wo_WorkOrderType> categorylist = new BLL.T_Wo_WorkOrderType().DataTableToList(tab);
  435. System.Collections.Generic.List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
  436. for (int i = 0; i < categorylist.Count; i++)
  437. {
  438. Model.TreeModel model = new Model.TreeModel();
  439. string currentID = categorylist[i].F_WorkOrderTypeId.ToString();//当前功能ID
  440. model.id = currentID;
  441. model.IconCls = categorylist[i].F_Ename;
  442. model.text = categorylist[i].F_Name;
  443. modelList.Add(model);
  444. }
  445. return modelList;
  446. }
  447. else
  448. {
  449. return null;
  450. }
  451. }
  452. #endregion
  453. public bool IsReusable
  454. {
  455. get
  456. {
  457. return false;
  458. }
  459. }
  460. }
  461. }