RoadFlow2.1 临时演示

Add.aspx.cs 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.Dictionary
  8. {
  9. public partial class Add : Common.BasePage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. if (IsPostBack)
  14. {
  15. RoadFlow.Data.Model.Dictionary dict = new RoadFlow.Data.Model.Dictionary();
  16. RoadFlow.Platform.Dictionary bdict = new RoadFlow.Platform.Dictionary();
  17. string id = Request.QueryString["id"];
  18. if (!id.IsGuid())
  19. {
  20. var dictRoot = bdict.GetRoot();
  21. id = dictRoot != null ? dictRoot.ID.ToString() : "";
  22. }
  23. if (!id.IsGuid())
  24. {
  25. throw new Exception("未找到父级");
  26. }
  27. string title = Request.Form["Title1"];
  28. string code = Request.Form["Code"];
  29. string values = Request.Form["Values"];
  30. string note = Request.Form["Note"];
  31. string other = Request.Form["Other"];
  32. dict.ID = Guid.NewGuid();
  33. dict.Code = code.IsNullOrEmpty() ? null : code.Trim();
  34. dict.Note = note.IsNullOrEmpty() ? null : note.Trim();
  35. dict.Other = other.IsNullOrEmpty() ? null : other.Trim();
  36. dict.ParentID = id.ToGuid();
  37. dict.Sort = bdict.GetMaxSort(id.ToGuid());
  38. dict.Title = title.Trim();
  39. dict.Value = values.IsNullOrEmpty() ? null : values.Trim();
  40. bdict.Add(dict);
  41. bdict.RefreshCache();
  42. RoadFlow.Platform.Log.Add("添加了数据字典项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典);
  43. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');parent.frames[0].reLoad('" + id + "');", true);
  44. }
  45. }
  46. }
  47. }