예제 #1
0
        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 = WebConfigurationManager.AppSettings["EasyOne:LabelXsltPath"];

            this.xmlfilepath = HttpContext.Current.Server.MapPath(path) + @"\" + this.m_LabelName + ".config";
            if (string.Compare(this.action, "modify", StringComparison.OrdinalIgnoreCase) == 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, StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare("sql_outquery", this.Dbtype, StringComparison.OrdinalIgnoreCase) == 0))
                {
                    if (DataConverter.CBoolean(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, StringComparison.OrdinalIgnoreCase) == 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", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (DataConverter.CBoolean(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", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (DataConverter.CBoolean(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", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (DataConverter.CBoolean(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();;");
            this.SmpNavigator.AdditionalNode = this.m_LabelName;
        }