RoadFlow2.1 临时演示

UnInstall.ashx.cs 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.WorkFlowDesigner
  7. {
  8. /// <summary>
  9. /// UnInstall 的摘要说明
  10. /// </summary>
  11. public class UnInstall : IHttpHandler, IReadOnlySessionState
  12. {
  13. public void ProcessRequest(HttpContext context)
  14. {
  15. context.Response.ContentType = "text/plain";
  16. string id = context.Request.Form["id"];
  17. string type = context.Request.Form["type"];
  18. RoadFlow.Platform.WorkFlow bworkFlow = new RoadFlow.Platform.WorkFlow();
  19. var flow = bworkFlow.Get(id.ToGuid());
  20. if (flow == null)
  21. {
  22. context.Response.Write("该流程还未保存!");
  23. context.Response.End();
  24. }
  25. else
  26. {
  27. if ("0" == type)
  28. {
  29. flow.Status = 3;
  30. bworkFlow.Update(flow);
  31. bworkFlow.RefreshWrokFlowCache(flow.ID);
  32. RoadFlow.Platform.Log.Add("卸载了流程", flow.Serialize(), RoadFlow.Platform.Log.Types.流程相关);
  33. context.Response.Write("1");
  34. context.Response.End();
  35. }
  36. else if ("1" == type)
  37. {
  38. flow.Status = 4;
  39. bworkFlow.Update(flow);
  40. //bworkFlow.ClearWorkFlowCache(flow.ID);
  41. RoadFlow.Platform.AppLibrary APP = new RoadFlow.Platform.AppLibrary();
  42. var app = APP.GetByCode(flow.ID.ToString());
  43. if (app != null)
  44. {
  45. APP.Delete(app.ID);
  46. new RoadFlow.Platform.RoleApp().DeleteByAppID(app.ID);
  47. }
  48. RoadFlow.Platform.Log.Add("删除了流程", flow.Serialize(), RoadFlow.Platform.Log.Types.流程相关);
  49. context.Response.Write("1");
  50. context.Response.End();
  51. }
  52. }
  53. }
  54. public bool IsReusable
  55. {
  56. get
  57. {
  58. return false;
  59. }
  60. }
  61. }
  62. }