Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string editid = Request.QueryString["id"];

            RoadFlow.Platform.DBConnection   bdbConn = new RoadFlow.Platform.DBConnection();
            RoadFlow.Data.Model.DBConnection dbconn  = null;
            if (editid.IsGuid())
            {
                dbconn = bdbConn.Get(editid.ToGuid());
            }
            bool   isAdd  = !editid.IsGuid();
            string oldXML = string.Empty;

            if (dbconn == null)
            {
                dbconn    = new RoadFlow.Data.Model.DBConnection();
                dbconn.ID = Guid.NewGuid();
            }
            else
            {
                oldXML = dbconn.Serialize();
            }

            if (IsPostBack)
            {
                string Name     = Request.Form["Name"];
                string LinkType = Request.Form["LinkType"];
                string ConnStr  = Request.Form["ConnStr"];
                string Note     = Request.Form["Note"];
                dbconn.Name             = Name.Trim();
                dbconn.Type             = LinkType;
                dbconn.ConnectionString = ConnStr;
                dbconn.Note             = Note;

                if (isAdd)
                {
                    bdbConn.Add(dbconn);
                    RoadFlow.Platform.Log.Add("添加了应用程序库", dbconn.Serialize(), RoadFlow.Platform.Log.Types.角色应用);
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
                }
                else
                {
                    bdbConn.Update(dbconn);
                    RoadFlow.Platform.Log.Add("修改了应用程序库", "", RoadFlow.Platform.Log.Types.角色应用, oldXML, dbconn.Serialize());
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('修改成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
                }
                bdbConn.ClearCache();
            }
            if (dbconn != null)
            {
                this.Name.Value    = dbconn.Name;
                this.ConnStr.Value = dbconn.ConnectionString;
                this.Note.Value    = dbconn.Note;
            }
            this.TypeOptions.Text = bdbConn.GetAllTypeOptions(dbconn.Type);
        }
        public ActionResult Edit(FormCollection collection)
        {
            string editid = Request.QueryString["id"];

            RoadFlow.Platform.DBConnection   bdbConn = new RoadFlow.Platform.DBConnection();
            RoadFlow.Data.Model.DBConnection dbconn  = null;
            if (editid.IsGuid())
            {
                dbconn = bdbConn.Get(editid.Convert <Guid>());
            }
            bool   isAdd  = !editid.IsGuid();
            string oldXML = string.Empty;

            if (dbconn == null)
            {
                dbconn    = new RoadFlow.Data.Model.DBConnection();
                dbconn.ID = Guid.NewGuid();
            }
            else
            {
                oldXML = dbconn.Serialize();
            }

            if (collection != null)
            {
                string Name     = Request.Form["Name"];
                string LinkType = Request.Form["LinkType"];
                string ConnStr  = Request.Form["ConnStr"];
                string Note     = Request.Form["Note"];
                dbconn.Name             = Name.Trim();
                dbconn.Type             = LinkType;
                dbconn.ConnectionString = ConnStr;
                dbconn.Note             = Note;

                if (isAdd)
                {
                    bdbConn.Add(dbconn);
                    RoadFlow.Platform.Log.Add("添加了应用程序库", dbconn.Serialize(), RoadFlow.Platform.Log.Types.角色应用);
                    ViewBag.Script = "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
                }
                else
                {
                    bdbConn.Update(dbconn);
                    RoadFlow.Platform.Log.Add("修改了应用程序库", "", RoadFlow.Platform.Log.Types.角色应用, oldXML, dbconn.Serialize());
                    ViewBag.Script = "alert('修改成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
                }
                bdbConn.ClearCache();
            }

            ViewBag.TypeOptions = bdbConn.GetAllTypeOptions(dbconn.Type);

            return(View(dbconn));
        }
        public ActionResult Edit(FormCollection collection)
        {
            string text = base.Request.QueryString["id"];

            RoadFlow.Platform.DBConnection   dBConnection  = new RoadFlow.Platform.DBConnection();
            RoadFlow.Data.Model.DBConnection dBConnection2 = null;
            if (MyExtensions.IsGuid(text))
            {
                dBConnection2 = dBConnection.Get(MyExtensions.ToGuid(text));
            }
            bool   flag   = !MyExtensions.IsGuid(text);
            string oldXML = string.Empty;

            if (dBConnection2 == null)
            {
                dBConnection2    = new RoadFlow.Data.Model.DBConnection();
                dBConnection2.ID = Guid.NewGuid();
            }
            else
            {
                oldXML = MyExtensions.Serialize((object)dBConnection2);
            }
            if (collection != null)
            {
                string text2            = base.Request.Form["Name"];
                string type             = base.Request.Form["LinkType"];
                string connectionString = base.Request.Form["ConnStr"];
                string note             = base.Request.Form["Note"];
                dBConnection2.Name             = text2.Trim();
                dBConnection2.Type             = type;
                dBConnection2.ConnectionString = connectionString;
                dBConnection2.Note             = note;
                if (flag)
                {
                    dBConnection.Add(dBConnection2);
                    RoadFlow.Platform.Log.Add("添加了数据库连接", MyExtensions.Serialize((object)dBConnection2), RoadFlow.Platform.Log.Types.数据连接);
                    base.ViewBag.Script = "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
                }
                else
                {
                    dBConnection.Update(dBConnection2);
                    RoadFlow.Platform.Log.Add("修改了数据库连接", "", RoadFlow.Platform.Log.Types.数据连接, oldXML, MyExtensions.Serialize((object)dBConnection2));
                    base.ViewBag.Script = "alert('修改成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
                }
                dBConnection.ClearCache();
            }
            base.ViewBag.TypeOptions = dBConnection.GetAllTypeOptions(dBConnection2.Type);
            return(View(dBConnection2));
        }