UU跑腿标准版

systemConfigAction.ashx.cs 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.sysmanage.ajax
  9. {
  10. /// <summary>
  11. /// systemConfigAction 的摘要说明
  12. /// </summary>
  13. public class systemConfigAction : IHttpHandler
  14. {
  15. public void ProcessRequest(HttpContext context)
  16. {
  17. context.Response.ContentType = "text/plain";
  18. string action = CommonRequest.GetQueryString("action");
  19. string keyWord = CommonRequest.GetQueryString("keyWords");
  20. string taotlCount = CommonRequest.GetQueryString("taolCount");
  21. switch (action)
  22. {
  23. case "getSystemlist":
  24. context.Response.Write(GetSystemList(context, keyWord));
  25. break;
  26. case "delete":
  27. context.Response.Write(GetUserDel(context, taotlCount));
  28. break;
  29. //case "Getexpstate":
  30. // context.Response.Write(Deptexpstate(context));
  31. // break;
  32. case "clear":
  33. break;
  34. }
  35. }
  36. /// <summary>
  37. /// 删除当前的参数信息
  38. /// </summary>
  39. /// <param name="context"></param>
  40. /// <param name="taotlCount"></param>
  41. /// <returns></returns>
  42. private string GetUserDel(HttpContext context, string taotlCount)
  43. {
  44. int res = 0;
  45. string sql = "update T_Sys_SystemConfig set F_State=1 where F_ParamId in(" + taotlCount.Trim(',') + ")";
  46. if (!string.IsNullOrEmpty(taotlCount))
  47. {
  48. res = DBUtility.DbHelperSQL.ExecuteSql(sql);
  49. }
  50. if (res > 0)
  51. {
  52. return "success";
  53. }
  54. else
  55. {
  56. return "error";
  57. }
  58. }
  59. /// <summary>
  60. /// 获取当前的参数信息
  61. /// </summary>
  62. /// <param name="context"></param>
  63. /// <param name="keyWord"></param>
  64. /// <returns></returns>
  65. private string GetSystemList(HttpContext context, string keyWord)
  66. {
  67. string result = "";
  68. DataTable dt = new DataTable();
  69. string keyWordCon = "";
  70. try
  71. {
  72. if (!string.IsNullOrEmpty(keyWord))
  73. {
  74. keyWordCon += " and F_ParamCode like '%" + keyWord + "%'";
  75. }
  76. string strpageindex = context.Request.Params["page"];
  77. int pageindex = 1;
  78. string strpagesize = context.Request.Params["pagesize"];
  79. int pagesize = 10;
  80. int recordCount = 0;
  81. Model.PageData<Model.T_Sys_SystemConfig> pageModel = new Model.PageData<Model.T_Sys_SystemConfig>();
  82. dt = BLL.PagerBLL.GetListPager(
  83. "T_Sys_SystemConfig ",
  84. "F_ParamId",
  85. "*",
  86. " and F_State=0" + keyWordCon,
  87. "ORDER BY F_ParamId desc",
  88. pagesize,
  89. pageindex,
  90. true,
  91. out recordCount);
  92. System.Collections.Generic.List<Model.T_Sys_SystemConfig> modelList = new BLL.T_Sys_SystemConfig().DataTableToList(dt);
  93. pageModel.Rows = modelList;
  94. pageModel.Total = recordCount;
  95. System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(Model.PageData<Model.T_Sys_SystemConfig>));
  96. using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
  97. {
  98. //JSON序列化
  99. serializer.WriteObject(stream, pageModel);
  100. result = System.Text.Encoding.UTF8.GetString(stream.ToArray());
  101. }
  102. }
  103. catch (Exception ex)
  104. {
  105. }
  106. finally
  107. {
  108. dt.Clear();
  109. dt.Dispose();
  110. }
  111. return result;
  112. }
  113. public bool IsReusable
  114. {
  115. get
  116. {
  117. return false;
  118. }
  119. }
  120. }
  121. }