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

📄 labelsqlbuild.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
                            flag = false;
                        }
                    }
                    if (flag)
                    {
                        this.query.SelectAllColumns();
                    }
                    else
                    {
                        this.query.SelectColumns(builder.ToString().Split(new char[] { ',' }));
                    }
                    this.querycount.SelectColumn("count(*)");
                    this.QueryProc(-1);
                }
                else
                {
                    string selectedValue = this.Dbtj.SelectedValue;
                    if (selectedValue != null)
                    {
                        if (!(selectedValue == "InnerJoin"))
                        {
                            if (selectedValue == "LeftJoin")
                            {
                                if (this.Dbys.SelectedValue == "=")
                                {
                                    this.query.AddJoin(JoinType.LeftJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Equals, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                    this.querycount.AddJoin(JoinType.LeftJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Equals, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                }
                                else
                                {
                                    this.query.AddJoin(JoinType.LeftJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Like, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                    this.querycount.AddJoin(JoinType.LeftJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Like, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                }
                            }
                            else if (selectedValue == "OuterJoin")
                            {
                                if (this.Dbys.SelectedValue == "=")
                                {
                                    this.query.AddJoin(JoinType.OuterJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Equals, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                    this.querycount.AddJoin(JoinType.OuterJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Equals, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                }
                                else
                                {
                                    this.query.AddJoin(JoinType.OuterJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Like, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                    this.querycount.AddJoin(JoinType.OuterJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Like, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                }
                            }
                            else if (selectedValue == "RightJoin")
                            {
                                if (this.Dbys.SelectedValue == "=")
                                {
                                    this.query.AddJoin(JoinType.RightJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Equals, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                    this.querycount.AddJoin(JoinType.RightJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Equals, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                }
                                else
                                {
                                    this.query.AddJoin(JoinType.RightJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Like, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                    this.querycount.AddJoin(JoinType.RightJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Like, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                                }
                            }
                        }
                        else if (this.Dbys.SelectedValue == "=")
                        {
                            this.query.AddJoin(JoinType.InnerJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Equals, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                            this.querycount.AddJoin(JoinType.InnerJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Equals, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                        }
                        else
                        {
                            this.query.AddJoin(JoinType.InnerJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Like, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                            this.querycount.AddJoin(JoinType.InnerJoin, this.DbTableDownList2.SelectedValue, this.DbFieldList2.SelectedValue, Comparison.Like, this.DbTableDownList.SelectedValue, this.DbFieldList.SelectedValue);
                        }
                    }
                    int irlist = 0;
                    for (int j = 0; j < this.DbFieldDownList.Items.Count; j++)
                    {
                        if (this.DbFieldDownList.Items[j].Selected)
                        {
                            builder.Append(this.DbTableDownList.SelectedValue + "." + this.DbFieldDownList.Items[j].Value + ",");
                            flag = false;
                            irlist++;
                        }
                    }
                    if (flag)
                    {
                        irlist = this.DbFieldDownList.Items.Count;
                        builder.Append(this.DbTableDownList.SelectedValue + ".*,");
                    }
                    for (int k = 0; k < this.DbFieldDownList2.Items.Count; k++)
                    {
                        if (this.DbFieldDownList2.Items[k].Selected)
                        {
                            builder.Append(this.DbTableDownList2.SelectedValue + "." + this.DbFieldDownList2.Items[k].Value + ",");
                            flag2 = false;
                        }
                    }
                    if (flag2)
                    {
                        builder.Append(this.DbTableDownList2.SelectedValue + ".*");
                    }
                    this.query.SelectColumns(builder.ToString().Split(new char[] { ',' }));
                    this.querycount.SelectColumn("count(*)");
                    this.QueryProc(irlist);
                }
                if (flag3)
                {
                    this.query.AddWhere("rownum", Comparison.LessOrEquals, DataConverter.CLng(this.TxtOutNum.Text), 0);
                }
                else if (!flag4)
                {
                    this.query.TopRecords = DataConverter.CLng(this.TxtOutNum.Text);
                }
                if (flag4)
                {
                    this.TxtSqlstr.Text = this.query.BuildQuery();
                    if (DataConverter.CLng(this.TxtOutNum.Text) > 0)
                    {
                        this.TxtSqlstr.Text = this.TxtSqlstr.Text + " limit " + this.TxtOutNum.Text;
                    }
                }
                else
                {
                    this.TxtSqlstr.Text = this.query.BuildQuery();
                }
                if ((string.Compare(this.Dbtype.Split(new char[] { '_' })[0], "sql") != 0) && !flag3)
                {
                    this.TxtSqlPage.Text = this.query.BuildQuery();
                }
            }
        }

        protected void ChkPage_CheckedChanged(object sender, EventArgs e)
        {
            if (this.ChkPage.Checked)
            {
                if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "UsePage", "True"))
                {
                    this.CountShow.Visible = true;
                    if ((string.Compare(this.Dbtype.Split(new char[] { '_' })[0], "sql", true) != 0) && (string.Compare(this.Dbtype, "orc_read", true) != 0))
                    {
                        this.PageShow.Visible = true;
                    }
                }
            }
            else if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "UsePage", ""))
            {
                this.CountShow.Visible = false;
                this.PageShow.Visible = false;
            }
        }

        protected void DBTableDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.DbTableDownList.SelectedIndex > 0)
            {
                DataTable table = new DataTable();
                string dbtype = this.Dbtype;
                if (dbtype != null)
                {
                    if (!(dbtype == "sql_sysquery"))
                    {
                        if (dbtype == "sql_outquery")
                        {
                            table = LabelManage.GetSchemaTable(this.DbTableDownList.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Sql);
                        }
                        else if (dbtype == "ole_read")
                        {
                            table = LabelManage.GetSchemaTable(this.DbTableDownList.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Ole);
                        }
                        else if (dbtype == "odbc_read")
                        {
                            table = LabelManage.GetSchemaTable(this.DbTableDownList.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Odbc);
                        }
                        else if (dbtype == "orc_read")
                        {
                            table = LabelManage.GetSchemaTable(this.DbTableDownList.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Oracle);
                        }
                    }
                    else
                    {
                        table = LabelManage.GetSchemaTable(this.DbTableDownList.SelectedValue, string.Empty, DataSourceType.None);
                    }
                }
                this.DbFieldDownList.DataSource = table;
                this.DbFieldList.DataSource = table;
                this.DbFieldDownList.DataTextField = "ColumnName";
                this.DbFieldDownList.DataValueField = "ColumnName";
                this.DbFieldDownList.DataBind();
                this.DbFieldList.DataTextField = "ColumnName";
                this.DbFieldList.DataValueField = "ColumnName";
                this.DbFieldList.DataBind();
            }
        }

        protected void DBTableDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.DbTableDownList2.SelectedIndex <= 0)
            {
                this.Span1.Visible = false;
            }
            else
            {
                DataTable table = new DataTable();
                string dbtype = this.Dbtype;
                if (dbtype != null)
                {
                    if (!(dbtype == "sql_sysquery"))
                    {
                        if (dbtype == "sql_outquery")
                        {
                            table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Sql);
                        }
                        else if (dbtype == "ole_read")
                        {
                            table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Ole);
                        }
                        else if (dbtype == "odbc_read")
                        {
                            table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Odbc);
                        }
                        else if (dbtype == "orc_read")
                        {
                            table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Oracle);
                        }
                    }
                    else
                    {
                        table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, string.Empty, DataSourceType.None);
                    }
                }
                this.DbFieldDownList2.DataSource = table;
                this.DbFieldList2.DataSource = table;
                this.DbFieldDownList2.DataTextField = "ColumnName";
                this.DbFieldDownList2.DataValueField = "ColumnName";
                this.DbFieldDownList2.DataBind();
                this.DbFieldList2.DataTextField = "ColumnName";
                this.DbFieldList2.DataValueField = "ColumnName";
                this.DbFieldList2.DataBind();
                this.Span1.Visible = true;
            }
        }

        protected static DataTable GetDataBaseSchema(string dtype, string xpath, string tablename)
        {
            switch (dtype)
            {
                case "sql_sysquery":
                    return LabelManage.GetSchemaTable(tablename, string.Empty, DataSourceType.None);

                case "sql_outquery":
                    return LabelManage.GetSchemaTable(tablename, XmlManage.ReadFileNode(xpath, "root/LabelDataSource"), DataSourceType.Sql);

                case "ole_read":
                    return LabelManage.GetSchemaTable(tablename, XmlManage.ReadFileNode(xpath, "root/LabelDataSource"), DataSourceType.Ole);

                case "odbc_read":
                    return LabelManage.GetSchemaTable(tablename, XmlManage.ReadFileNode(xpath, "root/LabelDataSource"), DataSourceType.Odbc);

                case "orc_read":
                    return LabelManage.GetSchemaTable(tablename, XmlManage.ReadFileNode(xpath, "root/LabelDataSource"), DataSourceType.Oracle);
            }

⌨️ 快捷键说明

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