⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 labelsqlbuild.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
            return null;
        }

        protected void GreatWhere(string fieldtype, string fieldtext, string ifieldname, string tjenu, int dw1int)
        {
            Comparison @operator = (Comparison) 0;
            switch (tjenu)
            {
                case "2":
                    @operator = Comparison.GreaterThan;
                    break;

                case "3":
                    @operator = Comparison.LessThan;
                    break;

                case "4":
                    @operator = Comparison.GreaterOrEquals;
                    break;

                case "5":
                    @operator = Comparison.LessOrEquals;
                    break;

                case "6":
                    @operator = Comparison.NotEquals;
                    break;

                case "7":
                    @operator = Comparison.In;
                    break;

                case "8":
                    @operator = Comparison.Like;
                    break;

                case "9":
                    @operator = Comparison.NotIn;
                    break;

                case "10":
                    @operator = Comparison.NotLike;
                    break;

                default:
                    @operator = Comparison.Equals;
                    break;
            }
            try
            {
                if (((string.Compare(fieldtype, "System.Int", true) == 0) || (string.Compare(fieldtype, "System.Int32", true) == 0)) || (string.Compare(fieldtype, "System.Int16", true) == 0))
                {
                    if (fieldtext.IndexOf("@", 0, 1) < 0)
                    {
                        this.query.AddWhere(ifieldname, @operator, DataConverter.CLng(fieldtext), dw1int);
                        this.querycount.AddWhere(ifieldname, @operator, DataConverter.CLng(fieldtext), dw1int);
                    }
                    else
                    {
                        this.query.AddWhere(ifieldname, @operator, new SqlLiteral(fieldtext), dw1int);
                        this.querycount.AddWhere(ifieldname, @operator, new SqlLiteral(fieldtext), dw1int);
                    }
                }
                else
                {
                    this.query.AddWhere(ifieldname, @operator, fieldtext, dw1int);
                    this.querycount.AddWhere(ifieldname, @operator, fieldtext, dw1int);
                }
            }
            catch (Exception)
            {
                this.TxtSqlstr.Text = "条件关系设置错误";
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.action = BasePage.RequestString("action");
            this.m_LabelName = BasePage.RequestString("name");
            this.m_LabelLibPath = "~/" + SiteConfig.SiteOption.LabelDir;
            if (string.IsNullOrEmpty(this.m_LabelName))
            {
                BasePage.ResponseRedirect("Label.aspx");
            }
            string path = ConfigurationManager.AppSettings["PowerEasy:LabelXsltPath"];
            this.xmlfilepath = HttpContext.Current.Server.MapPath(path) + @"\" + this.m_LabelName + ".config";
            if (string.Compare(this.action, "modify") == 0)
            {
                this.BtnSave.Visible = true;
            }
            this.Dbtype = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataType");
            if (!base.IsPostBack)
            {
                string str2;
                DataRow[] rowArray;
                this.TxtSqlstr.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelSqlString");
                DataTable table = new DataTable();
                if ((string.Compare("sql_sysquery", this.Dbtype, true) == 0) || (string.Compare("sql_outquery", this.Dbtype, true) == 0))
                {
                    if (DataConverter.CBool(XmlManage.ReadFileNode(this.xmlfilepath, "root/UsePage")))
                    {
                        this.ChkPage.Checked = true;
                        this.CountShow.Visible = true;
                        this.TxtSqlCount.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelSqlCount");
                    }
                    if (string.Compare("sql_sysquery", this.Dbtype, true) == 0)
                    {
                        rowArray = LabelManage.GetSystemSchemaDataBases().Select("", " TABLE_NAME ");
                        table = LabelManage.GetSystemSchemaDataBases().Clone();
                        table.Rows.Clear();
                        foreach (DataRow row in rowArray)
                        {
                            table.ImportRow(row);
                        }
                    }
                    else
                    {
                        str2 = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource");
                        rowArray = LabelManage.GetSchemaDataBase(str2, DataSourceType.Sql).Select("", " TABLE_NAME ");
                        table = LabelManage.GetSchemaDataBase(str2, DataSourceType.Sql).Clone();
                        table.Rows.Clear();
                        foreach (DataRow row2 in rowArray)
                        {
                            table.ImportRow(row2);
                        }
                    }
                }
                else if (string.Compare(this.Dbtype, "ole_read") == 0)
                {
                    if (DataConverter.CBool(XmlManage.ReadFileNode(this.xmlfilepath, "root/UsePage")))
                    {
                        this.ChkPage.Checked = true;
                        this.CountShow.Visible = true;
                        this.PageShow.Visible = true;
                        this.TxtSqlCount.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelSqlCount");
                        this.TxtSqlPage.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelSqlPage");
                    }
                    str2 = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource");
                    rowArray = LabelManage.GetSchemaDataBase(str2, DataSourceType.Ole).Select("", " TABLE_NAME ");
                    table = LabelManage.GetSchemaDataBase(str2, DataSourceType.Ole).Clone();
                    table.Rows.Clear();
                    foreach (DataRow row3 in rowArray)
                    {
                        table.ImportRow(row3);
                    }
                }
                else if (string.Compare(this.Dbtype, "odbc_read") == 0)
                {
                    if (DataConverter.CBool(XmlManage.ReadFileNode(this.xmlfilepath, "root/UsePage")))
                    {
                        this.ChkPage.Checked = true;
                        this.CountShow.Visible = true;
                        this.PageShow.Visible = true;
                        this.TxtSqlCount.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelSqlCount");
                        this.TxtSqlPage.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelSqlPage");
                    }
                    str2 = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource");
                    rowArray = LabelManage.GetSchemaDataBase(str2, DataSourceType.Odbc).Select("", " TABLE_NAME ");
                    table = LabelManage.GetSchemaDataBase(str2, DataSourceType.Odbc).Clone();
                    table.Rows.Clear();
                    foreach (DataRow row4 in rowArray)
                    {
                        table.ImportRow(row4);
                    }
                }
                else if (string.Compare(this.Dbtype, "orc_read") == 0)
                {
                    if (DataConverter.CBool(XmlManage.ReadFileNode(this.xmlfilepath, "root/UsePage")))
                    {
                        this.ChkPage.Checked = true;
                        this.CountShow.Visible = true;
                        this.TxtSqlCount.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelSqlCount");
                    }
                    str2 = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource");
                    rowArray = LabelManage.GetSchemaDataBase(str2, DataSourceType.Oracle).Select("", " TABLE_NAME ");
                    table = LabelManage.GetSchemaDataBase(str2, DataSourceType.Oracle).Clone();
                    table.Rows.Clear();
                    foreach (DataRow row5 in rowArray)
                    {
                        table.ImportRow(row5);
                    }
                }
                this.DbTableDownList.DataSource = table;
                this.DbTableDownList.DataTextField = "TABLE_NAME";
                this.DbTableDownList.DataValueField = "TABLE_NAME";
                this.DbTableDownList.DataBind();
                ListItem item = new ListItem();
                item.Text = "请选择一个表";
                this.DbTableDownList.Items.Insert(0, item);
                this.DbTableDownList2.DataSource = table;
                this.DbTableDownList2.DataTextField = "TABLE_NAME";
                this.DbTableDownList2.DataValueField = "TABLE_NAME";
                this.DbTableDownList2.DataBind();
                item.Text = "请选择一个表";
                this.DbTableDownList2.Items.Insert(0, item);
                if (LabelManage.GetAttributeList(this.xmlfilepath).Count == 0)
                {
                    this.attlist.Text = "您尚未添加参数!<a href=\"LabelProperty.aspx?action=" + this.action + "&name=" + this.m_LabelName + "\">添加参数</a>";
                }
                else
                {
                    foreach (LabelAttributeInfo info in LabelManage.GetAttributeList(this.xmlfilepath))
                    {
                        this.attlist.Text = this.attlist.Text + "<div onmousedown=\"dragstart();\" class=\"spanfixdiv\">" + info.AttributeName + "</div>";
                    }
                }
            }
            base.Form.Attributes.Add("onmouseup", "dragclear()");
            base.Form.Attributes.Add("onmousemove", "dragmove()");
            this.TxtSqlstr.Attributes.Add("onmouseup", "dragend(1);");
            this.TxtSqlstr.Attributes.Add("onmousemove", "movePoint();;");
            this.TxtSqlPage.Attributes.Add("onmouseup", "dragend(1);");
            this.TxtSqlPage.Attributes.Add("onmousemove", "movePoint();;");
            this.TxtSqlCount.Attributes.Add("onmouseup", "dragend(1);");
            this.TxtSqlCount.Attributes.Add("onmousemove", "movePoint();;");
        }

        protected void QueryProc(int irlist)
        {
            for (int i = 0; i < this.GridView_Clause.Rows.Count; i++)
            {
                DropDownList list = (DropDownList) this.GridView_Clause.Rows[i].FindControl("dropdowntj1");
                DropDownList list2 = (DropDownList) this.GridView_Clause.Rows[i].FindControl("dropdowntj2");
                DropDownList list3 = (DropDownList) this.GridView_Clause.Rows[i].FindControl("dropdownorder");
                TextBox box = (TextBox) this.GridView_Clause.Rows[i].FindControl("txtbox1");
                if (!string.IsNullOrEmpty(list2.SelectedValue) || !string.IsNullOrEmpty(list3.SelectedValue))
                {
                    string text = box.Text;
                    string ifieldname = string.Empty;
                    if (irlist == -1)
                    {
                        ifieldname = this.GridView_Clause.Rows[i].Cells[0].Text;
                    }
                    else if (i > irlist)
                    {
                        ifieldname = this.DbTableDownList2.SelectedValue + "." + this.GridView_Clause.Rows[i].Cells[0].Text;
                    }
                    else
                    {
                        ifieldname = this.DbTableDownList.SelectedValue + "." + this.GridView_Clause.Rows[i].Cells[0].Text;
                    }
                    if (!string.IsNullOrEmpty(text))
                    {
                        this.GreatWhere(this.GridView_Clause.Rows[i].Cells[1].Text, text, ifieldname, list2.SelectedValue, DataConverter.CLng(list.SelectedValue));
                    }
                    if (string.Compare(list3.SelectedValue, "up", false) == 0)
                    {
                        this.query.AddOrderBy(ifieldname, Sorting.Ascending);
                    }
                    else if (string.Compare(list3.SelectedValue, "down", false) == 0)
                    {
                        this.query.AddOrderBy(ifieldname, Sorting.Descending);
                    }
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -