RoadFlow2.1 临时演示

BodyAdd.aspx.cs 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 BodyAdd : Common.BasePage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize();
  14. RoadFlow.Data.Model.Organize org = null;
  15. string id = Request.QueryString["id"];
  16. string name = string.Empty;
  17. string type = string.Empty;
  18. string status = string.Empty;
  19. string note = string.Empty;
  20. Guid orgID;
  21. if (id.IsGuid(out orgID))
  22. {
  23. org = borganize.Get(orgID);
  24. }
  25. if (IsPostBack && org != null)
  26. {
  27. name = Request.Form["Name"];
  28. type = Request.Form["Type"];
  29. status = Request.Form["Status"];
  30. note = Request.Form["note"];
  31. RoadFlow.Data.Model.Organize org1 = new RoadFlow.Data.Model.Organize();
  32. Guid org1ID = Guid.NewGuid();
  33. org1.ID = org1ID;
  34. org1.Name = name.Trim();
  35. org1.Note = note.IsNullOrEmpty() ? null : note.Trim();
  36. org1.Number = org.Number + "," + org1ID.ToString().ToLower();
  37. org1.ParentID = org.ID;
  38. org1.Sort = borganize.GetMaxSort(org.ID);
  39. org1.Status = status.IsInt() ? status.ToInt() : 0;
  40. org1.Type = type.ToInt();
  41. org1.Depth = org.Depth + 1;
  42. using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
  43. {
  44. borganize.Add(org1);
  45. //更新父级[ChildsLength]字段
  46. borganize.UpdateChildsLength(org.ID);
  47. scope.Complete();
  48. }
  49. RoadFlow.Platform.Log.Add("添加了组织机构", org1.Serialize(), RoadFlow.Platform.Log.Types.组织机构);
  50. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');parent.frames[0].reLoad('" + id + "');window.location=window.location;", true);
  51. }
  52. this.TypeRadios.Text = borganize.GetTypeRadio("Type", type, "validate=\"radio\"");
  53. this.StatusRadios.Text = borganize.GetStatusRadio("Status", "0", "validate=\"radio\"");
  54. }
  55. }
  56. }