protected void Page_Load(object sender, EventArgs e)
 {
     this.action         = BasePage.RequestString("action");
     this.labelname      = BasePage.RequestString("name");
     this.m_LabelLibPath = "~/" + SiteConfig.SiteOption.LabelDir;
     if (string.IsNullOrEmpty(this.labelname))
     {
         BasePage.ResponseRedirect("Label.aspx");
     }
     else
     {
         string path = WebConfigurationManager.AppSettings["EasyOne:LabelXsltPath"];
         this.xmlfilepath = HttpContext.Current.Server.MapPath(path) + @"\" + this.labelname + ".config";
         if (!base.IsPostBack)
         {
             if (LabelManage.GetAttributeList(this.xmlfilepath).Count == 0)
             {
                 this.attlist.Text = "您尚未建立属性!<a href=\"LabelProperty.aspx?action=" + this.action + "&name=" + this.labelname + "\">建立属性</a>";
             }
             else
             {
                 foreach (LabelAttributeInfo info in LabelManage.GetAttributeList(this.xmlfilepath))
                 {
                     string text = this.attlist.Text;
                     this.attlist.Text = text + "<div onclick=\"cit()\" outype=\"2\" class=\"spanfixdiv\" alt=\"" + info.Intro + "&#10默认值:" + info.DefaultValue + "\">" + info.AttributeName + "</div>";
                 }
             }
             if (!string.IsNullOrEmpty(XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelTemplate")))
             {
                 this.TxtTemplate.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelTemplate");
             }
             ListItem item = new ListItem();
             item.Text = "全部分类";
             this.DropLabelList.DataSource     = LabelManage.GetLabelTypeList();
             this.DropLabelList.DataTextField  = "Name";
             this.DropLabelList.DataValueField = "Name";
             this.DropLabelList.DataBind();
             this.DropLabelList.Items.Insert(0, item);
             this.BuildLabelList(string.Empty);
             this.TxtTemplateTest.Text = "{PE.Label id=\"" + this.labelname + "\" /}";
         }
         this.TxtTemplate.Attributes.Add("onmouseup", "dragend(this)");
         this.TxtTemplate.Attributes.Add("onClick", "savePos(this)");
         this.TxtTemplate.Attributes.Add("onmousemove", "DragPos(this)");
     }
     this.SmpNavigator.AdditionalNode = this.labelname;
 }
Example #2
0
        protected void BtnDW_Click(object sender, EventArgs e)
        {
            string str2 = HttpContext.Current.Server.MapPath("~/" + SiteConfig.SiteOption.LabelDir);

            if (!FileSystemObject.IsExist(str2 + @"\Dreamweaver", FsoMethod.Folder))
            {
                FileSystemObject.Create(str2 + @"\Dreamweaver", FsoMethod.Folder);
                if (!FileSystemObject.IsExist(str2 + @"\Dreamweaver\_folderinfo.txt", FsoMethod.File))
                {
                    FileSystemObject.Create(str2 + @"\Dreamweaver\_folderinfo.txt", FsoMethod.File);
                    FileSystemObject.WriteFile(str2 + @"\Dreamweaver\_folderinfo.txt", "PE2007标签");
                }
            }
            foreach (LabelManageInfo info in LabelManage.GetLabelList(string.Empty))
            {
                StringBuilder builder = new StringBuilder();
                IList <LabelAttributeInfo> attributeList = LabelManage.GetAttributeList(str2 + @"\" + info.Name + ".config");
                if (!FileSystemObject.IsExist(str2 + @"\Dreamweaver\" + info.Name + ".csn", FsoMethod.File))
                {
                    FileSystemObject.Create(str2 + @"\Dreamweaver\" + info.Name + ".csn", FsoMethod.File);
                }
                builder.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
                builder.Append("<snippet name = \"" + info.Name + "\" description = \"" + info.Intro + "\" preview=\"code\" type=\"block\">\n");
                builder.Append("<insertText location=\"beforeSelection\">\n");
                builder.Append("<![CDATA[{PE.Label ");
                builder.Append("id=\"" + info.Name + "\"");
                foreach (LabelAttributeInfo info2 in attributeList)
                {
                    builder.Append(" " + info2.AttributeName + "=\"" + info2.DefaultValue + "\"");
                }
                builder.Append(" /}]]>\n");
                builder.Append("</insertText>\n");
                builder.Append("<insertText location=\"afterSelection\"><![CDATA[]]>\n");
                builder.Append("</insertText>\n");
                builder.Append("</snippet>\n");
                FileSystemObject.WriteFile(str2 + @"\Dreamweaver\" + info.Name + ".csn", builder.ToString());
            }
            PackFiles(str2 + @"\Dreamweaver.zip", str2 + @"\Dreamweaver");
            if (!ResponseFile(this.Page.Request, this.Page.Response, "PE2007_DwPlus.zip", str2 + @"\Dreamweaver.zip", 0xfa000L))
            {
                base.Response.Write("下载文件出错!");
            }
        }
Example #3
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");
     }
     else
     {
         string path = WebConfigurationManager.AppSettings["EasyOne:LabelXsltPath"];
         this.xmlfilepath = HttpContext.Current.Server.MapPath(path) + @"\" + this.m_LabelName + ".config";
         this.Dbtype      = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataType");
         string      presstr  = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource");
         string      str3     = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelSqlString");
         string      istr     = string.Empty;
         XmlDocument document = new XmlDocument();
         document.Load(this.xmlfilepath);
         XmlNodeList attriblist = document.SelectNodes("root/attributes");
         presstr = this.ParaProc(attriblist, presstr);
         str3    = this.ParaProc(attriblist, str3).Replace("@pagesize", "10").Replace("@startrow", "0");
         if (((string.Compare(this.Dbtype, "static", StringComparison.Ordinal) == 0) && (string.Compare(this.Dbtype, "xml_read", StringComparison.Ordinal) == 0)) && string.IsNullOrEmpty(str3))
         {
             this.ShowXml.Text = "查询语句为空!";
             return;
         }
         if (((string.Compare(this.Dbtype, "static", StringComparison.Ordinal) != 0) && (string.Compare(this.Dbtype, "sql_sysquery", StringComparison.Ordinal) != 0)) && ((string.Compare(this.Dbtype, "sql_sysstoredquery", StringComparison.Ordinal) != 0) && string.IsNullOrEmpty(presstr)))
         {
             this.ShowXml.Text = "数据源地址为空!";
             return;
         }
         istr = LabelManage.GetDBQuery(this.Dbtype, presstr, str3, attriblist);
         XmlDocument document2 = (XmlDocument)this.XmlProc(this.Dbtype, presstr, istr);
         if (!string.IsNullOrEmpty(document2.OuterXml))
         {
             this.rootnode     = document2.DocumentElement;
             this.ShowXml.Text = this.GetXmlScheam(2).ToString();
         }
         else
         {
             document2.LoadXml("<root></root>");
             this.rootnode     = document2.DocumentElement;
             this.ShowXml.Text = this.GetXmlScheam(2).ToString();
         }
         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))
             {
                 string text = this.attlist.Text;
                 this.attlist.Text = text + "<div onclick=\"cit()\" outype=\"3\" class=\"spanfixdiv\" alt=\"" + info.Intro + "&#10默认值:" + info.DefaultValue + "\">" + info.AttributeName + "</div>";
             }
         }
         this.TxtTemplate.Attributes.Add("onmouseup", "dragend(this)");
         this.TxtTemplate.Attributes.Add("onClick", "savePos(this)");
         this.TxtTemplate.Attributes.Add("onmousemove", "DragPos(this)");
         if (!base.IsPostBack)
         {
             string filename = HttpContext.Current.Server.MapPath("~/") + @"\Temp\DefaultLabelTemplate.xsl";
             if (string.Compare(this.action, "modify", StringComparison.OrdinalIgnoreCase) == 0)
             {
                 this.TxtTemplate.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelTemplate").Replace("><", ">\n<");
             }
             else
             {
                 XmlDocument document3 = new XmlDocument();
                 document3.Load(filename);
                 this.TxtTemplate.Text = document3.OuterXml.Replace("><", ">\n<");
             }
             this.TxtTemplateTest.Text = "{PE.Label id=\"" + this.m_LabelName + "\" /}";
         }
     }
     this.SmpNavigator.AdditionalNode = this.m_LabelName;
 }
Example #4
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;
        }