RoadFlow2.1 临时演示

GetFields.ashx.cs 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. namespace WebForm.Platform.WorkFlowDesigner
  6. {
  7. /// <summary>
  8. /// GetFields 的摘要说明
  9. /// </summary>
  10. public class GetFields : IHttpHandler
  11. {
  12. public void ProcessRequest(HttpContext context)
  13. {
  14. context.Response.ContentType = "text/plain";
  15. string table = context.Request.QueryString["table"];
  16. string connid = context.Request.QueryString["connid"];
  17. if (table.IsNullOrEmpty() || !connid.IsGuid())
  18. {
  19. context.Response.Write("[]");
  20. }
  21. Dictionary<string, string> fields = new RoadFlow.Platform.DBConnection().GetFields(connid.ToGuid(), table);
  22. System.Text.StringBuilder sb = new System.Text.StringBuilder("[", 1000);
  23. foreach (var field in fields)
  24. {
  25. sb.Append("{");
  26. sb.AppendFormat("\"name\":\"{0}\",\"note\":\"{1}\"", field.Key, field.Value);
  27. sb.Append("},");
  28. }
  29. context.Response.Write(sb.ToString().TrimEnd(',') + "]");
  30. }
  31. public bool IsReusable
  32. {
  33. get
  34. {
  35. return false;
  36. }
  37. }
  38. }
  39. }