RoadFlow2.1 临时演示

Body.aspx.cs 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 Body : Common.BasePage
  10. {
  11. RoadFlow.Platform.Dictionary bdict = new RoadFlow.Platform.Dictionary();
  12. RoadFlow.Data.Model.Dictionary dict = null;
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. string id = Request.QueryString["id"];
  16. this.Code.Attributes.Add("validate_url", "CheckCode.ashx?id=" + id);
  17. if (id.IsGuid())
  18. {
  19. dict = bdict.Get(id.ToGuid());
  20. }
  21. if (dict == null)
  22. {
  23. dict = bdict.GetRoot();
  24. }
  25. if (IsPostBack && dict != null)
  26. {
  27. string refreshID = dict.ParentID == Guid.Empty ? dict.ID.ToString() : dict.ParentID.ToString();
  28. //删除
  29. if (!Request.Form["Delete"].IsNullOrEmpty())
  30. {
  31. int i = bdict.DeleteAndAllChilds(dict.ID);
  32. bdict.RefreshCache();
  33. RoadFlow.Platform.Log.Add("删除了数据字典及其下级共" + i.ToString() + "项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典);
  34. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('删除成功!');parent.frames[0].reLoad('" + refreshID + "');window.location='Body.aspx?id=" + dict.ParentID.ToString() + "&appid=" + Request.QueryString["appid"] + "';", true);
  35. }
  36. //保存
  37. if (!Request.Form["Save"].IsNullOrEmpty())
  38. {
  39. string title = Request.Form["Title1"];
  40. string code = Request.Form["Code"];
  41. string values = Request.Form["Values"];
  42. string note = Request.Form["Note"];
  43. string other = Request.Form["Other"];
  44. string oldXML = dict.Serialize();
  45. dict.Code = code.IsNullOrEmpty() ? null : code.Trim();
  46. dict.Note = note.IsNullOrEmpty() ? null : note.Trim();
  47. dict.Other = other.IsNullOrEmpty() ? null : other.Trim();
  48. dict.Title = title.Trim();
  49. dict.Value = values.IsNullOrEmpty() ? null : values.Trim();
  50. bdict.Update(dict);
  51. bdict.RefreshCache();
  52. RoadFlow.Platform.Log.Add("修改了数据字典项", "", RoadFlow.Platform.Log.Types.数据字典, oldXML, dict.Serialize());
  53. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');parent.frames[0].reLoad('" + refreshID + "');", true);
  54. }
  55. }
  56. if (dict != null)
  57. {
  58. this.Title1.Value = dict.Title;
  59. this.Code.Value = dict.Code;
  60. this.Values.Value = dict.Value;
  61. this.Note.Value = dict.Note;
  62. this.Other.Value = dict.Other;
  63. }
  64. }
  65. }
  66. }