GetData.ashx.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Web;
  4. using System.Data;
  5. namespace Com.Jpsoft.Hospital.Web.Module.EmployeeGroup
  6. {
  7. /// <summary>
  8. /// GetData 的摘要说明
  9. /// </summary>
  10. public class GetData : IHttpHandler
  11. {
  12. public void ProcessRequest(HttpContext context)
  13. {
  14. string act;
  15. if (!string.IsNullOrEmpty(context.Request.QueryString["act"]))
  16. {
  17. act = context.Request.QueryString["act"];
  18. switch (act)
  19. {
  20. case "getBMList":
  21. GetBMList(context);
  22. break;
  23. case "getEmployeeList":
  24. GetEmployeeList(context);
  25. break;
  26. case "postData":
  27. PostData(context);
  28. break;
  29. case "delData":
  30. DelData(context);
  31. break;
  32. }
  33. }
  34. }
  35. private void GetBMList(HttpContext context)
  36. {
  37. System.Text.StringBuilder html = new System.Text.StringBuilder();
  38. Com.Jpsoft.Hospital.BLL.rs_ksdm ksdm = new BLL.rs_ksdm();
  39. DataTable dt = ksdm.GetAllList().Tables[0];
  40. foreach (DataRow row in dt.Rows)
  41. {
  42. html.AppendFormat("<table class='dd' style='width:95%' border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#006699\"><tr bgcolor=\"#006699\"><td width=\"95%\"><a href='#' onclick=\"hve_display('table_{0}')\" style=\"cursor: hand\"><font color='black'><b>{1}</b></font></a></td></tr></table>", row["ksdm"].ToString(), row["ksmc"].ToString());
  43. html.AppendFormat("<table ID='table_{0}' style='width:95%' border='0' cellspacing='1' cellpadding='0' bgcolor='#006699' style='display:none'></table>", row["ksdm"].ToString());
  44. }
  45. context.Response.ContentType = "text/plain";
  46. context.Response.Write(html.ToString());
  47. }
  48. private void GetEmployeeList(HttpContext context)
  49. {
  50. System.Text.StringBuilder html = new System.Text.StringBuilder();
  51. //Com.Jpsoft.Hospital.BLL.rs_ygxx ygxx = new BLL.rs_ygxx();
  52. Com.Jpsoft.Hospital.BLL.jp_employee_group_detailEx detailEx = new BLL.jp_employee_group_detailEx();
  53. string id = context.Request.QueryString["id"].Split('_')[1];
  54. string gid = context.Request.QueryString["gid"];
  55. DataTable dt = detailEx.GetNotExistEmployee(gid, id).Tables[0];//ygxx.GetList(" ksdm=" + id).Tables[0];
  56. int rowCount = 0;
  57. foreach (DataRow row in dt.Rows)
  58. {
  59. if (rowCount == 0)
  60. {
  61. html.Append("<tr bgcolor='#FFFFFF'>");
  62. }
  63. html.AppendFormat("<td bgcolor='#7AACFE'><input type='checkbox' did='{0}'>{1}</td>", row["ygdm"].ToString(), row["ygxm"].ToString());
  64. rowCount++;
  65. if (rowCount == 5)
  66. {
  67. rowCount = 0;
  68. html.Append("</tr>");
  69. }
  70. }
  71. context.Response.ContentType = "text/plain";
  72. context.Response.Write(html.ToString());
  73. }
  74. private void PostData(HttpContext context)
  75. {
  76. string result;
  77. string id = context.Request.QueryString["ids"];
  78. string gid = context.Request.QueryString["gid"];
  79. Com.Jpsoft.Hospital.BLL.jp_employee_group_detailEx detailEx = new BLL.jp_employee_group_detailEx();
  80. if (detailEx.Add2(id,gid))
  81. result = "1";
  82. else
  83. result = "0";
  84. context.Response.ContentType = "text/plain";
  85. context.Response.Write(result);
  86. }
  87. private void DelData(HttpContext context)
  88. {
  89. string result = "0";
  90. string id = context.Request.QueryString["id"];
  91. Com.Jpsoft.Hospital.BLL.jp_employee_group_detailEx detailEx = new BLL.jp_employee_group_detailEx();
  92. if (detailEx.Delete(int.Parse(id)))
  93. result = "1";
  94. context.Response.ContentType = "text/plain";
  95. context.Response.Write(result);
  96. }
  97. public bool IsReusable
  98. {
  99. get
  100. {
  101. return false;
  102. }
  103. }
  104. }
  105. }