Get_Report_Defect.ashx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 
  2. <%@ WebHandler Language="C#" Class="Get_Report_Defect" %>
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Web;
  6. using System.Web.SessionState;
  7. using System.Configuration;
  8. using System.Data;
  9. using Newtonsoft.Json;
  10. using Curtain.DataAccess;
  11. using Curtain.Log;
  12. using DK.XuWei.WebMes;
  13. public class Get_Report_Defect : IHttpHandler,IRequiresSessionState
  14. {
  15. public void ProcessRequest(HttpContext context)
  16. {
  17. if (HttpContext.Current.Session["userCode"] is object)
  18. {
  19. using (IDataAccess conn = DataAccess.Create())
  20. {
  21. //统计语句
  22. string sqlStr = @"
  23. SELECT
  24. DEFECTTYPEID, --缺陷类别编号
  25. DEFECTID, --缺陷编号
  26. DEFECTCODE, --缺陷编码
  27. DEFECTNAME --缺陷名称
  28. FROM
  29. TP_MST_DEFECT
  30. WHERE
  31. VALUEFLAG = '1' --有效标识
  32. ORDER BY
  33. DEFECTTYPEID, --缺陷类别编号
  34. DISPLAYNO --显示顺序
  35. ";
  36. DataTable dt = conn.ExecuteDatatable(sqlStr);
  37. //输出结果
  38. context.Response.Write(new JsonResult(dt).ToJson());
  39. }
  40. }
  41. else
  42. {
  43. context.Response.Write(new JsonResult(JsonStatus.otherError).ToJson());
  44. }
  45. }
  46. public bool IsReusable
  47. {
  48. get
  49. {
  50. return false;
  51. }
  52. }
  53. }