public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string dbconn = context.Request.QueryString["dbconn"];
            string sql    = context.Request.QueryString["sql"];

            FoWoSoft.Platform.DBConnection conn = new FoWoSoft.Platform.DBConnection();
            var       conn1 = conn.Get(dbconn.ToGuid());
            DataTable dt    = conn.GetDataTable(conn1, sql.UrlDecode().ReplaceSelectSql());

            string values = context.Request.QueryString["values"] ?? "";

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                string value1 = string.Empty;
                string title1 = string.Empty;
                foreach (DataRow dr in dt.Rows)
                {
                    value1 = dr[0].ToString();
                    if (value == value1)
                    {
                        title1 = dt.Columns.Count > 1 ? dr[1].ToString() : value1;
                        break;
                    }
                }
                sb.Append(title1);
                sb.Append(',');
            }
            context.Response.Write(sb.ToString().TrimEnd(','));
        }
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"]);

            FoWoSoft.Platform.DBConnection bdbconn = new FoWoSoft.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();
                    FoWoSoft.Platform.Log.Add("删除了数据连接", delxml.ToString(), FoWoSoft.Platform.Log.Types.流程相关);
                }
            }

            ConnList = bdbconn.GetAll();
            Query1   = query1;
        }
Exemple #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string dbconn      = context.Request.QueryString["dbconn"];
            string dbtable     = context.Request.QueryString["dbtable"];
            string valuefield  = context.Request.QueryString["valuefield"];
            string titlefield  = context.Request.QueryString["titlefield"];
            string parentfield = context.Request.QueryString["parentfield"];

            string where = context.Request.QueryString["where"];
            string id = context.Request.QueryString["refreshid"];

            FoWoSoft.Platform.DBConnection bdbconn = new FoWoSoft.Platform.DBConnection();
            var       conn = bdbconn.Get(dbconn.ToGuid());
            string    sql  = "select " + valuefield + "," + titlefield + " from " + dbtable + " where " + parentfield + "='" + id + "'";
            DataTable dt   = bdbconn.GetDataTable(conn, sql.ReplaceSelectSql());

            System.Text.StringBuilder json = new System.Text.StringBuilder(1000);
            foreach (System.Data.DataRow dr in dt.Rows)
            {
                string value     = dr[0].ToString();
                string title     = dt.Columns.Count > 1 ? dr[1].ToString() : value;
                string sql1      = "select * from " + dbtable + " where " + parentfield + "='" + value + "'";
                bool   hasChilds = bdbconn.GetDataTable(conn, sql1.ReplaceSelectSql()).Rows.Count > 0;
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", value);
                json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty.ToString());
                json.AppendFormat("\"title\":\"{0}\",", title);
                json.AppendFormat("\"type\":\"{0}\",", hasChilds ? "1" : "2"); //类型:0根 1父 2子
                json.AppendFormat("\"ico\":\"{0}\",", "");
                json.AppendFormat("\"hasChilds\":\"{0}\",", hasChilds ? "1" : "0");
                json.Append("\"childs\":[]},");
            }
            context.Response.Write("[" + json.ToString().TrimEnd(',') + "]");
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string dbconn      = context.Request.QueryString["dbconn"];
            string dbtable     = context.Request.QueryString["dbtable"];
            string valuefield  = context.Request.QueryString["valuefield"];
            string titlefield  = context.Request.QueryString["titlefield"];
            string parentfield = context.Request.QueryString["parentfield"];

            string where = context.Request.QueryString["where"];
            string values = context.Request.QueryString["values"] ?? "";

            FoWoSoft.Platform.DBConnection bdbconn = new FoWoSoft.Platform.DBConnection();
            var conn = bdbconn.Get(dbconn.ToGuid());

            System.Text.StringBuilder names = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                if (value.IsNullOrEmpty())
                {
                    continue;
                }
                string    sql = "select " + titlefield + " from " + dbtable + " where " + valuefield + "='" + value + "'";
                DataTable dt  = bdbconn.GetDataTable(conn, sql.ReplaceSelectSql());
                if (dt.Rows.Count > 0)
                {
                    names.Append(dt.Rows[0][0].ToString());
                    names.Append(",");
                }
            }
            context.Response.Write(names.ToString().TrimEnd(','));
        }
Exemple #5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (!Common.Tools.CheckLogin(false))
            {
                context.Response.Write("{}");
                context.Response.End();
                return;
            }
            string dbconn = context.Request.QueryString["dbconn"];
            string sql    = context.Request.QueryString["sql"];

            FoWoSoft.Platform.DBConnection conn = new FoWoSoft.Platform.DBConnection();
            var conn1 = conn.Get(dbconn.ToGuid());

            System.Data.DataTable     dt   = conn.GetDataTable(conn1, sql.UrlDecode().ReplaceSelectSql());
            System.Text.StringBuilder json = new System.Text.StringBuilder(1000);
            foreach (System.Data.DataRow dr in dt.Rows)
            {
                string value = dr[0].ToString();
                string title = dt.Columns.Count > 1 ? dr[1].ToString() : value;
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", value);
                json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty.ToString());
                json.AppendFormat("\"title\":\"{0}\",", title);
                json.AppendFormat("\"type\":\"{0}\",", "2"); //类型:0根 1父 2子
                json.AppendFormat("\"ico\":\"{0}\",", "");
                json.AppendFormat("\"hasChilds\":\"{0}\",", "0");
                json.Append("\"childs\":[]},");
            }
            context.Response.Write("[" + json.ToString().TrimEnd(',') + "]");
        }
Exemple #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string editid = Request.QueryString["id"];

            FoWoSoft.Platform.DBConnection   bdbConn = new FoWoSoft.Platform.DBConnection();
            FoWoSoft.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 FoWoSoft.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);
                    FoWoSoft.Platform.Log.Add("添加了应用程序库", dbconn.Serialize(), FoWoSoft.Platform.Log.Types.角色应用);
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
                }
                else
                {
                    bdbConn.Update(dbconn);
                    FoWoSoft.Platform.Log.Add("修改了应用程序库", "", FoWoSoft.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);
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string secondtableconnid     = Request.QueryString["secondtableconnid"];
            string secondtable           = Request.QueryString["secondtable"];
            string secondtableprimarykey = Request.QueryString["secondtableprimarykey"];
            string secondtablepkvalue    = Request.QueryString["secondtablepkvalue"];

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

            int i = bdbconn.DeleteData(secondtableconnid.ToGuid(), secondtable, secondtableprimarykey, secondtablepkvalue);

            if (i > 0)
            {
                Response.Write("删除成功!");
            }
            else
            {
                Response.Write("删除失败!");
            }
        }
Exemple #8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Charset     = "utf-8";
            string connID = context.Request.QueryString["connid"];

            if (!connID.IsGuid())
            {
                context.Response.Write("[]");
            }
            List <string> tables = new FoWoSoft.Platform.DBConnection().GetTables(connID.ToGuid());

            System.Text.StringBuilder sb = new System.Text.StringBuilder("[", 1000);
            foreach (string table in tables)
            {
                sb.Append("{\"name\":");
                sb.AppendFormat("\"{0}\"", table);
                sb.Append("},");
            }
            context.Response.Write(sb.ToString().TrimEnd(',') + "]");
        }
Exemple #9
0
        /// <summary>
        /// 根据一个连接字符串得到一个字段值
        /// </summary>
        /// <param name="linkString">连接ID.表.主键</param>
        /// <param name="field">字段</param>
        /// <param name="instanceID">实例ID</param>
        /// <returns></returns>
        public string GetLinkFieldValue(string linkString, Guid instanceID)
        {
            string value = "";

            string[] array = linkString.Split('.');
            if (array.Length == 3)
            {
                var pkvalues = GetAll(instanceID);
                Dictionary <string, string> key = new Dictionary <string, string>();
                foreach (var pkvalue in pkvalues)
                {
                    if (array[0].ToGuid() == pkvalue.LinkID && array[1] == pkvalue.TableName)
                    {
                        key.Add(pkvalue.FieldName, pkvalue.Value);
                    }
                }

                value = new FoWoSoft.Platform.DBConnection().GetFieldValue(array[2], key);
            }
            return(value);
        }
Exemple #10
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string table  = context.Request.QueryString["table"];
            string connid = context.Request.QueryString["connid"];

            if (table.IsNullOrEmpty() || !connid.IsGuid())
            {
                context.Response.Write("[]");
            }
            Dictionary <string, string> fields = new FoWoSoft.Platform.DBConnection().GetFields(connid.ToGuid(), table);

            System.Text.StringBuilder sb = new System.Text.StringBuilder("[", 1000);

            foreach (var field in fields)
            {
                sb.Append("{");
                sb.AppendFormat("\"name\":\"{0}\",\"note\":\"{1}\"", field.Key, field.Value);
                sb.Append("},");
            }
            context.Response.Write(sb.ToString().TrimEnd(',') + "]");
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string connid  = context.Request["connid"];
            string table   = context.Request["table"];
            string tablepk = context.Request["tablepk"];

            string where = context.Request["where"];

            FoWoSoft.Platform.DBConnection dbconn = new FoWoSoft.Platform.DBConnection();

            if (!connid.IsGuid())
            {
                context.Response.Write("流程未设置数据连接!");
                return;
            }
            var conn = dbconn.Get(connid.ToGuid());

            if (conn == null)
            {
                context.Response.Write("未找到连接!");
                return;
            }
            string sql = "SELECT * FROM " + table + " WHERE 1=1 AND " + where;

            if (dbconn.TestSql(conn, sql))
            {
                context.Response.Write("SQL条件正确!");
                return;
            }
            else
            {
                context.Response.Write("SQL条件错误!");
                return;
            }
        }
Exemple #12
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string sql    = context.Request["sql"];
            string dbconn = context.Request["dbconn"];

            if (sql.IsNullOrEmpty() || !dbconn.IsGuid())
            {
                context.Response.Write("SQL语句为空或未设置数据连接");
                return;
            }

            FoWoSoft.Platform.DBConnection bdbconn = new FoWoSoft.Platform.DBConnection();
            var dbconn1 = bdbconn.Get(dbconn.ToGuid());

            if (bdbconn.TestSql(dbconn1, sql))
            {
                context.Response.Write("SQL语句测试正确");
            }
            else
            {
                context.Response.Write("SQL语句测试错误");
            }
        }
Exemple #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            FoWoSoft.Platform.Dictionary Dict = new FoWoSoft.Platform.Dictionary();

            string values     = Request.QueryString["values"];
            string rootid     = Request.QueryString["rootid"];
            string datasource = Request.QueryString["datasource"];
            string sql        = Request.QueryString["sql"];

            DataTable SqlDataTable = new DataTable();

            if ("1" == datasource)
            {
                string dbconn = Request.QueryString["dbconn"];
                FoWoSoft.Platform.DBConnection conn = new FoWoSoft.Platform.DBConnection();
                var conn1 = conn.Get(dbconn.ToGuid());
                SqlDataTable = conn.GetDataTable(conn1, sql.UrlDecode().ReplaceSelectSql());
            }

            System.Text.StringBuilder defautlSB = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                switch (datasource)
                {
                case "0":
                default:
                    Guid id;
                    if (!value.IsGuid(out id))
                    {
                        continue;
                    }
                    defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value);
                    defautlSB.Append(Dict.GetTitle(id));
                    defautlSB.Append("</div>");
                    break;

                case "1":    //SQL
                    string title1 = string.Empty;
                    foreach (DataRow dr in SqlDataTable.Rows)
                    {
                        if (value == dr[0].ToString())
                        {
                            title1 = SqlDataTable.Columns.Count > 1 ? dr[1].ToString() : value;
                            break;
                        }
                    }
                    defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value);
                    defautlSB.Append(title1);
                    defautlSB.Append("</div>");
                    break;

                case "2":    //url
                    string url2 = Request.QueryString["url2"];
                    if (!url2.IsNullOrEmpty())
                    {
                        url2 = url2.IndexOf('?') >= 0 ? url2 + "&values=" + value : url2 + "?values=" + value;
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        try
                        {
                            System.IO.TextWriter tw = new System.IO.StringWriter(sb);
                            Server.Execute(url2, tw);
                        }
                        catch (Exception err) { }
                        defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value);
                        defautlSB.Append(sb.ToString());
                        defautlSB.Append("</div>");
                    }
                    break;

                case "3":    //table
                    string dbconn      = Request.QueryString["dbconn"];
                    string dbtable     = Request.QueryString["dbtable"];
                    string valuefield  = Request.QueryString["valuefield"];
                    string titlefield  = Request.QueryString["titlefield"];
                    string parentfield = Request.QueryString["parentfield"];
                    string where = Request.QueryString["where"];
                    FoWoSoft.Platform.DBConnection bdbconn = new FoWoSoft.Platform.DBConnection();
                    var       conn   = bdbconn.Get(dbconn.ToGuid());
                    string    sql2   = "select " + titlefield + " from " + dbtable + " where " + valuefield + "='" + value + "'";
                    DataTable dt     = bdbconn.GetDataTable(conn, sql2.ReplaceSelectSql());
                    string    title3 = string.Empty;
                    if (dt.Rows.Count > 0)
                    {
                        title3 = dt.Rows[0][0].ToString();
                    }
                    defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value);
                    defautlSB.Append(title3);
                    defautlSB.Append("</div>");
                    break;
                }
            }
            defaultValuesString = defautlSB.ToString();
        }