RoadFlow2.1 临时演示

Edit.aspx.cs 3.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. namespace WebForm.Platform.WorkFlowDelegation
  8. {
  9. public partial class Edit : Common.BasePage
  10. {
  11. protected bool isOneSelf = false;
  12. protected string FlowOptions = string.Empty;
  13. protected RoadFlow.Platform.WorkFlowDelegation bworkFlowDelegation = new RoadFlow.Platform.WorkFlowDelegation();
  14. protected RoadFlow.Data.Model.WorkFlowDelegation workFlowDelegation = null;
  15. protected void Page_Load(object sender, EventArgs e)
  16. {
  17. string id = Request.QueryString["id"];
  18. string UserID = string.Empty;
  19. string ToUserID = string.Empty;
  20. string StartTime = string.Empty;
  21. string EndTime = string.Empty;
  22. string FlowID = string.Empty;
  23. string Note = string.Empty;
  24. isOneSelf = "1" == Request.QueryString["isoneself"];
  25. Guid delegationID;
  26. if (id.IsGuid(out delegationID))
  27. {
  28. workFlowDelegation = bworkFlowDelegation.Get(delegationID);
  29. if (workFlowDelegation != null)
  30. {
  31. FlowID = workFlowDelegation.FlowID.ToString();
  32. }
  33. }
  34. string oldXML = workFlowDelegation.Serialize();
  35. if (IsPostBack)
  36. {
  37. UserID = Request.Form["UserID"];
  38. ToUserID = Request.Form["ToUserID"];
  39. StartTime = Request.Form["StartTime"];
  40. EndTime = Request.Form["EndTime"];
  41. FlowID = Request.Form["FlowID"];
  42. Note = Request.Form["Note"];
  43. bool isAdd = !id.IsGuid();
  44. if (workFlowDelegation == null)
  45. {
  46. workFlowDelegation = new RoadFlow.Data.Model.WorkFlowDelegation();
  47. workFlowDelegation.ID = Guid.NewGuid();
  48. }
  49. workFlowDelegation.UserID = isOneSelf ? RoadFlow.Platform.Users.CurrentUserID : RoadFlow.Platform.Users.RemovePrefix(UserID).ToGuid();
  50. workFlowDelegation.EndTime = EndTime.ToDateTime();
  51. if (FlowID.IsGuid())
  52. {
  53. workFlowDelegation.FlowID = FlowID.ToGuid();
  54. }
  55. workFlowDelegation.Note = Note.IsNullOrEmpty() ? null : Note;
  56. workFlowDelegation.StartTime = StartTime.ToDateTime();
  57. workFlowDelegation.ToUserID = RoadFlow.Platform.Users.RemovePrefix(ToUserID).ToGuid();
  58. workFlowDelegation.WriteTime = RoadFlow.Utility.DateTimeNew.Now;
  59. if (isAdd)
  60. {
  61. bworkFlowDelegation.Add(workFlowDelegation);
  62. RoadFlow.Platform.Log.Add("添加了工作委托", workFlowDelegation.Serialize(), RoadFlow.Platform.Log.Types.流程相关);
  63. }
  64. else
  65. {
  66. bworkFlowDelegation.Update(workFlowDelegation);
  67. RoadFlow.Platform.Log.Add("修改了工作委托", "", RoadFlow.Platform.Log.Types.流程相关, oldXML, workFlowDelegation.Serialize());
  68. }
  69. bworkFlowDelegation.RefreshCache();
  70. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
  71. }
  72. FlowOptions = new RoadFlow.Platform.WorkFlow().GetOptions(FlowID);
  73. if (workFlowDelegation == null) workFlowDelegation = new RoadFlow.Data.Model.WorkFlowDelegation();
  74. }
  75. }
  76. }