RoadFlow2.1 临时演示

Edit.aspx.cs 2.6KB

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.DBConnection
  8. {
  9. public partial class Edit : Common.BasePage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. string editid = Request.QueryString["id"];
  14. RoadFlow.Platform.DBConnection bdbConn = new RoadFlow.Platform.DBConnection();
  15. RoadFlow.Data.Model.DBConnection dbconn = null;
  16. if (editid.IsGuid())
  17. {
  18. dbconn = bdbConn.Get(editid.ToGuid());
  19. }
  20. bool isAdd = !editid.IsGuid();
  21. string oldXML = string.Empty;
  22. if (dbconn == null)
  23. {
  24. dbconn = new RoadFlow.Data.Model.DBConnection();
  25. dbconn.ID = Guid.NewGuid();
  26. }
  27. else
  28. {
  29. oldXML = dbconn.Serialize();
  30. }
  31. if (IsPostBack)
  32. {
  33. string Name = Request.Form["Name"];
  34. string LinkType = Request.Form["LinkType"];
  35. string ConnStr = Request.Form["ConnStr"];
  36. string Note = Request.Form["Note"];
  37. dbconn.Name = Name.Trim();
  38. dbconn.Type = LinkType;
  39. dbconn.ConnectionString = ConnStr;
  40. dbconn.Note = Note;
  41. if (isAdd)
  42. {
  43. bdbConn.Add(dbconn);
  44. RoadFlow.Platform.Log.Add("添加了应用程序库", dbconn.Serialize(), RoadFlow.Platform.Log.Types.角色应用);
  45. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
  46. }
  47. else
  48. {
  49. bdbConn.Update(dbconn);
  50. RoadFlow.Platform.Log.Add("修改了应用程序库", "", RoadFlow.Platform.Log.Types.角色应用, oldXML, dbconn.Serialize());
  51. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('修改成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
  52. }
  53. bdbConn.ClearCache();
  54. }
  55. if (dbconn != null)
  56. {
  57. this.Name.Value = dbconn.Name;
  58. this.ConnStr.Value = dbconn.ConnectionString;
  59. this.Note.Value = dbconn.Note;
  60. }
  61. this.TypeOptions.Text = bdbConn.GetAllTypeOptions(dbconn.Type);
  62. }
  63. }
  64. }