Пример #1
0
 protected void BtnShowTemplate_Click(object sender, EventArgs e)
 {
     if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelTemplate", this.TxtTemplate.Text))
     {
         File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.m_LabelName + ".config", true);
     }
     SiteCache.Remove("pe_labdefing_" + this.m_LabelName);
     if (!string.IsNullOrEmpty(this.TxtTemplateTest.Text))
     {
         TemplateInfo        templateInfo = new TemplateInfo();
         NameValueCollection values       = new NameValueCollection();
         values.Add("id", "1");
         templateInfo.QueryList       = values;
         templateInfo.TemplateContent = this.TxtTemplateTest.Text;
         templateInfo.CurrentPage     = DataConverter.CLng(this.TxtTempPage.Text);
         templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
         templateInfo.PageName        = this.TxtTempPageName.Text;
         templateInfo      = TemplateTransform.GetHtml(templateInfo);
         this.LabShow.Text = templateInfo.TemplateContent;
         if (templateInfo.TotalPub > 0)
         {
             this.LabShow.Text = this.LabShow.Text + "<br/>本页取得的总数据输出量为:" + templateInfo.TotalPub.ToString();
         }
         if (templateInfo.PageNum > 0)
         {
             this.LabShow.Text = this.LabShow.Text + "<br/>本页分页数为:" + templateInfo.PageNum.ToString();
         }
     }
 }
 protected void BtnShowTemplate_Click(object sender, EventArgs e)
 {
     if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelTemplate", this.TxtTemplate.Text))
     {
         File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.labelname + ".config", true);
     }
     SiteCache.Remove("pe_labdefing_" + this.labelname);
     if (!string.IsNullOrEmpty(this.TxtTemplateTest.Text))
     {
         TemplateInfo        templateInfo = new TemplateInfo();
         NameValueCollection values       = new NameValueCollection();
         values.Add("id", "1");
         templateInfo.QueryList       = values;
         templateInfo.TemplateContent = this.TxtTemplateTest.Text;
         templateInfo.CurrentPage     = 1;
         templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
         templateInfo.PageName        = string.Empty;
         templateInfo      = TemplateTransform.GetHtml(templateInfo);
         this.LabShow.Text = templateInfo.TemplateContent;
     }
     else
     {
         this.LabShow.Text = "请输入测试标签";
     }
 }
Пример #3
0
 protected void BtnFinal_Click(object sender, EventArgs e)
 {
     try
     {
         try
         {
             new XmlDocument().LoadXml(this.TxtTemplate.Text);
         }
         catch (XmlException)
         {
             ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, base.GetType(), "click", "alert('标签模板中存在错误,请检查后再保存!')", true);
             return;
         }
         if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelTemplate", this.TxtTemplate.Text))
         {
             File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.m_LabelName + ".config", true);
             BasePage.ResponseRedirect("LabelManage.aspx");
         }
         else
         {
             AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
         }
     }
     catch (IOException)
     {
         AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
     }
     catch (UnauthorizedAccessException)
     {
         AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
     }
 }
Пример #4
0
 protected void BtnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(this.TxtSqlstr.Text) && (this.TxtSqlstr.Text != "请先建立SQL语句"))
         {
             bool flag = XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelSqlString", this.TxtSqlstr.Text);
             if (this.ChkPage.Checked)
             {
                 if (!string.IsNullOrEmpty(this.TxtSqlCount.Text) && (this.TxtSqlCount.Text != "请先建立SQL统计语句"))
                 {
                     flag = XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelSqlCount", this.TxtSqlCount.Text);
                 }
                 else
                 {
                     flag = false;
                     this.TxtSqlCount.Text = "请先建立SQL统计语句";
                 }
                 if ((string.Compare(this.Dbtype.Split(new char[] { '_' })[0], "sql", StringComparison.Ordinal) != 0) && flag)
                 {
                     if (!string.IsNullOrEmpty(this.TxtSqlPage.Text) && (this.TxtSqlPage.Text != "请先建立SQL分页语句"))
                     {
                         flag = XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelSqlPage", this.TxtSqlPage.Text);
                     }
                     else
                     {
                         flag = false;
                         this.TxtSqlPage.Text = "请先建立SQL分页语句";
                     }
                     flag = XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelSqlPage", this.TxtSqlPage.Text);
                 }
             }
             if (flag)
             {
                 File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.m_LabelName + ".config", true);
                 BasePage.ResponseRedirect("LabelManage.aspx");
             }
         }
         else
         {
             this.TxtSqlstr.Text = "请先建立SQL语句";
         }
     }
     catch (IOException)
     {
         AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
     }
     catch (UnauthorizedAccessException)
     {
         AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
     }
 }
 protected void BtnFinal_Click(object sender, EventArgs e)
 {
     try
     {
         if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelTemplate", this.TxtTemplate.Text))
         {
             File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.labelname + ".config", true);
             BasePage.ResponseRedirect("LabelManage.aspx");
         }
     }
     catch (IOException)
     {
         AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
     }
     catch (UnauthorizedAccessException)
     {
         AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
     }
 }
Пример #6
0
 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", StringComparison.OrdinalIgnoreCase) != 0) && (string.Compare(this.Dbtype, "orc_read", StringComparison.OrdinalIgnoreCase) != 0))
             {
                 this.PageShow.Visible = true;
             }
         }
     }
     else if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "UsePage", ""))
     {
         this.CountShow.Visible = false;
         this.PageShow.Visible  = false;
     }
 }
Пример #7
0
 protected void BtnNext_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.TxtSqlstr.Text) && (this.TxtSqlstr.Text != "请先建立SQL语句"))
     {
         bool flag = XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelSqlString", this.TxtSqlstr.Text);
         if (this.ChkPage.Checked)
         {
             if (!string.IsNullOrEmpty(this.TxtSqlCount.Text) && (this.TxtSqlCount.Text != "请先建立SQL统计语句"))
             {
                 flag = XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelSqlCount", this.TxtSqlCount.Text);
             }
             else
             {
                 flag = false;
                 this.TxtSqlCount.Text = "请先建立SQL统计语句";
             }
             if ((string.Compare(this.Dbtype.Split(new char[] { '_' })[0], "sql", StringComparison.Ordinal) != 0) && flag)
             {
                 if (!string.IsNullOrEmpty(this.TxtSqlPage.Text) && (this.TxtSqlPage.Text != "请先建立SQL分页语句"))
                 {
                     flag = XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelSqlPage", this.TxtSqlPage.Text);
                 }
                 else
                 {
                     flag = false;
                     this.TxtSqlPage.Text = "请先建立SQL分页语句";
                 }
             }
         }
         if (flag)
         {
             BasePage.ResponseRedirect("LabelTemplate.aspx?action=" + this.action + "&name=" + base.Server.UrlEncode(this.m_LabelName));
         }
     }
     else
     {
         this.TxtSqlstr.Text = "请先建立SQL语句";
     }
 }
Пример #8
0
        protected bool SaveToXmlFile(string xmlfilepath)
        {
            string path = HttpContext.Current.Server.MapPath(this.m_LabelLibPath);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            if (!File.Exists(xmlfilepath))
            {
                XmlDocument document = new XmlDocument();
                XmlNode     newChild = document.CreateNode(XmlNodeType.XmlDeclaration, "", "");
                document.AppendChild(newChild);
                XmlElement element = document.CreateElement("", "root", "");
                document.AppendChild(element);
                document.Save(xmlfilepath);
            }
            string text = this.TxtLabelType.Text;

            if (text == "全部分类")
            {
                text = string.Empty;
            }
            if (!XmlManage.SaveFileNode(xmlfilepath, "root", "LabelType", text))
            {
                return(false);
            }
            if (!XmlManage.SaveFileNode(xmlfilepath, "root", "LabelIntro", this.TxtLabelIntro.Text))
            {
                return(false);
            }
            if (!XmlManage.SaveFileNode(xmlfilepath, "root", "OutType", this.RBLOutType.SelectedValue))
            {
                return(false);
            }
            if ((string.Compare(this.RbtDataType.SelectedValue, "sql_sysstoredquery", StringComparison.Ordinal) == 0) && !XmlManage.SaveFileNode(xmlfilepath, "root", "LabelSqlString", this.TxtDataSource.Text))
            {
                return(false);
            }
            if (this.RbtDataType.SelectedIndex > 2)
            {
                string nodevalue     = this.TxtDataSource.Text;
                string selectedValue = this.RbtDataType.SelectedValue;
                if (string.Compare(this.RbtDataType.SelectedValue, "mdb_read", StringComparison.Ordinal) == 0)
                {
                    nodevalue     = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + GetDbPath(this.TxtDataSource.Text);
                    selectedValue = "ole_read";
                    if (!XmlManage.SaveFileNode(xmlfilepath, "root", "LabelDbPath", this.TxtDataSource.Text))
                    {
                        return(false);
                    }
                }
                if (string.Compare(this.RbtDataType.SelectedValue, "xsl_read", StringComparison.Ordinal) == 0)
                {
                    nodevalue     = "Provider=Microsoft.JET.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=" + GetDbPath(this.TxtDataSource.Text);
                    selectedValue = "ole_read";
                    if (!XmlManage.SaveFileNode(xmlfilepath, "root", "LabelDbPath", this.TxtDataSource.Text))
                    {
                        return(false);
                    }
                }
                if (!XmlManage.SaveFileNode(xmlfilepath, "root", "LabelDataSource", nodevalue))
                {
                    return(false);
                }
                if (!XmlManage.SaveFileNode(xmlfilepath, "root", "LabelDataType", selectedValue))
                {
                    return(false);
                }
            }
            else if (!XmlManage.SaveFileNode(xmlfilepath, "root", "LabelDataType", this.RbtDataType.SelectedValue))
            {
                return(false);
            }
            return(true);
        }