protected void Page_PreRender(object sender, EventArgs e) { this.labelname = BasePage.RequestString("name"); if (!string.IsNullOrEmpty(this.labelname)) { string path = WebConfigurationManager.AppSettings["EasyOne:LabelXsltPath"]; this.xmlfilepath = HttpContext.Current.Server.MapPath(path) + @"\" + this.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, "xml_read", StringComparison.OrdinalIgnoreCase) != 0) && string.IsNullOrEmpty(str3)) { base.Response.Write("查询语句为空!"); } else { istr = LabelManage.GetDBQuery(this.Dbtype, presstr, str3, attriblist); this.XmlProc(this.Dbtype, presstr, istr); } } else { base.Response.Write("标签名称为空!"); } }
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 + "
默认值:" + 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; }