//
        // GET: /DBConnection/

        public ActionResult Index()
        {
            string query1 = string.Format("&appid={0}&tabid={1}", Request.QueryString["appid"], Request.QueryString["tabid"]);

            RoadFlow.Platform.DBConnection bdbconn = new RoadFlow.Platform.DBConnection();

            if (!Request.Form["DeleteBut"].IsNullOrEmpty())
            {
                string deleteID = Request.Form["checkbox_app"];
                System.Text.StringBuilder delxml = new System.Text.StringBuilder();
                foreach (string id in deleteID.Split(','))
                {
                    Guid gid;
                    if (id.IsGuid(out gid))
                    {
                        delxml.Append(bdbconn.Get(gid).Serialize());
                        bdbconn.Delete(gid);
                    }
                }
                bdbconn.ClearCache();
                RoadFlow.Platform.Log.Add("删除了数据连接", delxml.ToString(), RoadFlow.Platform.Log.Types.流程相关);
            }


            var connList = bdbconn.GetAll();

            ViewBag.Query1 = query1;
            return(View(connList));
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string query1 = string.Format("&appid={0}&tabid={1}", Request.QueryString["appid"], Request.QueryString["tabid"]);

            RoadFlow.Platform.DBConnection bdbconn = new RoadFlow.Platform.DBConnection();

            if (IsPostBack)
            {
                if (!Request.Form["DeleteBut"].IsNullOrEmpty())
                {
                    string deleteID = Request.Form["checkbox_app"];
                    System.Text.StringBuilder delxml = new System.Text.StringBuilder();
                    foreach (string id in deleteID.Split(','))
                    {
                        Guid gid;
                        if (id.IsGuid(out gid))
                        {
                            delxml.Append(bdbconn.Get(gid).Serialize());
                            bdbconn.Delete(gid);
                        }
                    }
                    bdbconn.ClearCache();
                    RoadFlow.Platform.Log.Add("删除了数据连接", delxml.ToString(), RoadFlow.Platform.Log.Types.流程相关);
                }
            }

            ConnList = bdbconn.GetAll();
            Query1   = query1;
        }
Exemple #3
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));
        }
        public string Delete()
        {
            RoadFlow.Platform.DBConnection dBConnection = new RoadFlow.Platform.DBConnection();
            string        text          = base.Request.Form["ids"];
            StringBuilder stringBuilder = new StringBuilder();

            string[] array = text.Split(',');
            for (int i = 0; i < array.Length; i++)
            {
                Guid id = default(Guid);
                if (MyExtensions.IsGuid(array[i], out id))
                {
                    stringBuilder.Append(MyExtensions.Serialize((object)dBConnection.Get(id)));
                    dBConnection.Delete(id);
                }
            }
            dBConnection.ClearCache();
            RoadFlow.Platform.Log.Add("删除了数据连接", stringBuilder.ToString(), RoadFlow.Platform.Log.Types.流程相关);
            return("删除成功!");
        }