RoadFlow2.1 临时演示

Body.aspx.cs 4.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.Members
  8. {
  9. public partial class Body : Common.BasePage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. RoadFlow.Data.Model.Organize org = null;
  14. RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize();
  15. string id = Request.QueryString["id"];
  16. if (id.IsGuid())
  17. {
  18. org = borganize.Get(id.ToGuid());
  19. }
  20. if (IsPostBack)
  21. {
  22. //保存
  23. if (!Request.Form["Save"].IsNullOrEmpty() && org != null)
  24. {
  25. string name = Request.Form["Name"];
  26. string type = Request.Form["Type"];
  27. string status = Request.Form["Status"];
  28. string chargeLeader = Request.Form["ChargeLeader"];
  29. string leader = Request.Form["Leader"];
  30. string note = Request.Form["note"];
  31. string oldXML = org.Serialize();
  32. org.Name = name.Trim();
  33. org.Type = type.ToInt(1);
  34. org.Status = status.ToInt(0);
  35. org.ChargeLeader = chargeLeader;
  36. org.Leader = leader;
  37. org.Note = note.IsNullOrEmpty() ? null : note.Trim();
  38. borganize.Update(org);
  39. RoadFlow.Platform.Log.Add("修改了组织机构", "", RoadFlow.Platform.Log.Types.组织机构, oldXML, org.Serialize());
  40. string rid = org.ParentID == Guid.Empty ? org.ID.ToString() : org.ParentID.ToString();
  41. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');parent.frames[0].reLoad('" + rid + "');", true);
  42. }
  43. //移动
  44. if (!Request.Form["Move1"].IsNullOrEmpty() && org != null)
  45. {
  46. string toOrgID = Request.Form["deptmove"];
  47. Guid toID;
  48. if (toOrgID.IsGuid(out toID) && borganize.Move(org.ID, toID))
  49. {
  50. RoadFlow.Platform.Log.Add("移动了组织机构", "将机构:" + org.ID + "移动到了:" + toID, RoadFlow.Platform.Log.Types.组织机构);
  51. string refreshID = org.ParentID == Guid.Empty ? org.ID.ToString() : org.ParentID.ToString();
  52. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('移动成功!');parent.frames[0].reLoad('" + refreshID + "');parent.frames[0].reLoad('" + toOrgID + "')", true);
  53. }
  54. else
  55. {
  56. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('移动失败!');", true);
  57. }
  58. }
  59. //删除
  60. if (!Request.Form["Delete"].IsNullOrEmpty())
  61. {
  62. int i = borganize.DeleteAndAllChilds(org.ID);
  63. RoadFlow.Platform.Log.Add("删除了组织机构及其所有下级共" + i.ToString() + "项", org.Serialize(), RoadFlow.Platform.Log.Types.组织机构);
  64. string refreshID = org.ParentID == Guid.Empty ? org.ID.ToString() : org.ParentID.ToString();
  65. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('共删除了" + i.ToString() + "项!');parent.frames[0].reLoad('" + refreshID + "');", true);
  66. }
  67. }
  68. if (org != null)
  69. {
  70. this.Name.Value = org.Name;
  71. this.TypeRadios.Text = borganize.GetTypeRadio("Type", org.Type.ToString(), "validate=\"radio\"");
  72. this.StatusRadios.Text = borganize.GetStatusRadio("Status", org.Status.ToString(), "validate=\"radio\"");
  73. this.ChargeLeader.Value = org.ChargeLeader;
  74. this.Leader.Value = org.Leader;
  75. this.Note.Value = org.Note;
  76. }
  77. else
  78. {
  79. this.TypeRadios.Text = borganize.GetTypeRadio("Type", "", "validate=\"radio\"");
  80. this.StatusRadios.Text = borganize.GetStatusRadio("Status", "", "validate=\"radio\"");
  81. }
  82. }
  83. }
  84. }