RoadFlow2.1 临时演示

Edit.aspx.cs 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.WorkFlowComments
  8. {
  9. public partial class Edit : Common.BasePage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. RoadFlow.Platform.WorkFlowComment bworkFlowComment = new RoadFlow.Platform.WorkFlowComment();
  14. RoadFlow.Data.Model.WorkFlowComment workFlowComment = null;
  15. string id = Request.QueryString["id"];
  16. string member = string.Empty;
  17. string comment = string.Empty;
  18. string sort = string.Empty;
  19. bool isOneSelf = "1" == Request.QueryString["isoneself"];
  20. if (isOneSelf)
  21. {
  22. this.usermemberid.Visible = false;
  23. }
  24. Guid commentID;
  25. if (id.IsGuid(out commentID))
  26. {
  27. workFlowComment = bworkFlowComment.Get(commentID);
  28. member = workFlowComment.MemberID;
  29. comment = workFlowComment.Comment;
  30. sort = workFlowComment.Sort.ToString();
  31. }
  32. string oldXML = workFlowComment.Serialize();
  33. if (IsPostBack)
  34. {
  35. member = isOneSelf ? RoadFlow.Platform.Users.PREFIX + RoadFlow.Platform.Users.CurrentUserID.ToString() : Request.Form["Member"];
  36. comment = Request.Form["Comment"];
  37. sort = Request.Form["Sort"];
  38. bool isAdd = !id.IsGuid();
  39. if (workFlowComment == null)
  40. {
  41. workFlowComment = new RoadFlow.Data.Model.WorkFlowComment();
  42. workFlowComment.ID = Guid.NewGuid();
  43. workFlowComment.Type = isOneSelf ? 1 : 0;
  44. }
  45. workFlowComment.MemberID = member.IsNullOrEmpty() ? "" : member.Trim();
  46. workFlowComment.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
  47. workFlowComment.Sort = sort.IsInt() ? sort.ToInt() : bworkFlowComment.GetManagerMaxSort();
  48. if (isAdd)
  49. {
  50. bworkFlowComment.Add(workFlowComment);
  51. RoadFlow.Platform.Log.Add("添加了流程意见", workFlowComment.Serialize(), RoadFlow.Platform.Log.Types.流程相关);
  52. }
  53. else
  54. {
  55. bworkFlowComment.Update(workFlowComment);
  56. RoadFlow.Platform.Log.Add("修改了流程意见", "", RoadFlow.Platform.Log.Types.流程相关, oldXML, workFlowComment.Serialize());
  57. }
  58. bworkFlowComment.RefreshCache();
  59. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "new RoadUI.Window().reloadOpener();alert('保存成功!'); new RoadUI.Window().close();", true);
  60. }
  61. if (workFlowComment != null)
  62. {
  63. this.Comment.Value = workFlowComment.Comment;
  64. this.Member.Value = workFlowComment.MemberID;
  65. this.Sort.Value = workFlowComment.Sort.ToString();
  66. }
  67. }
  68. }
  69. }