getSecurityCode.ashx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <%@ WebHandler Language="C#" Class="getSecurityCode" %>
  2. using System;
  3. using System.Web;
  4. using Curtain.DataAccess;
  5. using System.Data;
  6. using DK.XuWei.WebMes;
  7. using Newtonsoft.Json.Linq;
  8. public class getSecurityCode : IHttpHandler
  9. {
  10. public void ProcessRequest(HttpContext context)
  11. {
  12. context.Response.ContentType = "text/plain";
  13. if (context.Request["barcode"] is object)
  14. {
  15. //读取参数
  16. string barCode = context.Request["barcode"].ToString();
  17. using (IDataAccess conn = DataAccess.Create())
  18. {
  19. //读取防伪码
  20. DataTable dt = conn.ExecuteDatatable(@"
  21. SELECT
  22. '11111111111' AS 条码,
  23. '22222222222' AS 防伪码,
  24. '2021-08-02 09:00' AS 绑定时间,
  25. 'DONGKEXW' AS 绑定工号
  26. FROM
  27. DUAL
  28. ",
  29. new CDAParameter("BARCODE", "")
  30. );
  31. context.Response.Write(new JsonResult(dt.Rows[0]).ToJson());
  32. }
  33. }
  34. else
  35. {
  36. context.Response.Write(new JsonResult(JsonStatus.error) { message = "条码不能为空值!" }.ToJson());
  37. }
  38. }
  39. public bool IsReusable
  40. {
  41. get
  42. {
  43. return false;
  44. }
  45. }
  46. }