RoadFlow2.1 临时演示

Save.ashx.cs 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.SessionState;
  6. namespace WebForm.Platform.WorkFlowFormDesigner
  7. {
  8. /// <summary>
  9. /// Save 的摘要说明
  10. /// </summary>
  11. public class Save : IHttpHandler, IReadOnlySessionState
  12. {
  13. public void ProcessRequest(HttpContext context)
  14. {
  15. context.Response.ContentType = "text/plain";
  16. string html = context.Request["html"];
  17. string name = context.Request["name"];
  18. string att = context.Request["att"];
  19. string id = context.Request["id"];
  20. string type = context.Request["type"];
  21. string subtable = context.Request["subtable"];
  22. string formEvents = context.Request["formEvents"];
  23. if (name.IsNullOrEmpty())
  24. {
  25. context.Response.Write("表单名称不能为空!");
  26. return;
  27. }
  28. Guid formID;
  29. if (!id.IsGuid(out formID))
  30. {
  31. context.Response.Write("表单ID无效!");
  32. return;
  33. }
  34. RoadFlow.Platform.WorkFlowForm WFF = new RoadFlow.Platform.WorkFlowForm();
  35. RoadFlow.Data.Model.WorkFlowForm wff = WFF.Get(formID);
  36. bool isAdd = false;
  37. string oldXML = string.Empty;
  38. if (wff == null)
  39. {
  40. wff = new RoadFlow.Data.Model.WorkFlowForm();
  41. wff.ID = formID;
  42. wff.CreateUserID = RoadFlow.Platform.Users.CurrentUserID;
  43. wff.CreateUserName = RoadFlow.Platform.Users.CurrentUserName;
  44. wff.CreateTime = RoadFlow.Utility.DateTimeNew.Now;
  45. wff.Status = 0;
  46. isAdd = true;
  47. }
  48. else
  49. {
  50. oldXML = wff.Serialize();
  51. }
  52. wff.Type = type.ToGuid();
  53. wff.Attribute = att;
  54. wff.Html = html;
  55. wff.LastModifyTime = RoadFlow.Utility.DateTimeNew.Now;
  56. wff.Name = name;
  57. wff.SubTableJson = subtable;
  58. wff.EventsJson = formEvents;
  59. if (isAdd)
  60. {
  61. WFF.Add(wff);
  62. RoadFlow.Platform.Log.Add("添加了流程表单", wff.Serialize(), RoadFlow.Platform.Log.Types.流程相关);
  63. }
  64. else
  65. {
  66. WFF.Update(wff);
  67. RoadFlow.Platform.Log.Add("修改了流程表单", "", RoadFlow.Platform.Log.Types.流程相关, oldXML, wff.Serialize());
  68. }
  69. context.Response.Write("保存成功!");
  70. }
  71. public bool IsReusable
  72. {
  73. get
  74. {
  75. return false;
  76. }
  77. }
  78. }
  79. }