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

📄 labeltemplate.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
                    {
                        str = "2";
                    }
                    else
                    {
                        str = "1";
                    }
                    builder.Append("<span path=\"" + scheme.Path + "\" tn=\"" + scheme.Name + "\" onclick=\"cit()\" outype=\"" + str + "\"");
                }
                else
                {
                    builder.Append("<span");
                }
                string str2 = scheme.Type;
                if (str2 == null)
                {
                    goto Label_017D;
                }
                if (!(str2 == "havechile"))
                {
                    if (str2 == "attributes")
                    {
                        goto Label_0158;
                    }
                    goto Label_017D;
                }
                builder.Append(" class=\"havechilediv\">");
                builder.Append(scheme.Name);
                goto Label_0196;
            Label_0158:
                builder.Append(" class=\"attribdiv\">");
                builder.Append("@" + scheme.Name);
                goto Label_0196;
            Label_017D:
                builder.Append(" class=\"nodediv\">");
                builder.Append(scheme.Name);
            Label_0196:
                builder.Append("</span>");
                if (scheme.Repnum > 1)
                {
                    builder.Append("[repet:" + scheme.Repnum.ToString() + "]");
                }
                builder.Append("</div>");
            }
            return builder;
        }

        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 = ConfigurationManager.AppSettings["PowerEasy: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") == 0) && (string.Compare(this.Dbtype, "xml_read") == 0)) && string.IsNullOrEmpty(str3))
                {
                    this.ShowXml.Text = "查询语句为空!";
                }
                else if (((string.Compare(this.Dbtype, "static") != 0) && (string.Compare(this.Dbtype, "sql_sysquery") != 0)) && ((string.Compare(this.Dbtype, "sql_sysstoredquery") != 0) && string.IsNullOrEmpty(presstr)))
                {
                    this.ShowXml.Text = "数据源地址为空!";
                }
                else
                {
                    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
                    {
                        this.BtnShowSchema.Visible = false;
                        this.BtnShowDetal.Visible = false;
                    }
                    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", true) == 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 + "\" /}";
                    }
                }
            }
        }

        protected string ParaProc(XmlNodeList attriblist, string presstr)
        {
            foreach (XmlNode node in attriblist)
            {
                string[] strArray = node.SelectSingleNode("default").InnerText.Split(new string[] { "|||" }, StringSplitOptions.None);
                if (strArray.Length > 1)
                {
                    presstr = presstr.Replace("@" + node.SelectSingleNode("name").InnerText, strArray[0]);
                    continue;
                }
                presstr = presstr.Replace("@" + node.SelectSingleNode("name").InnerText, node.SelectSingleNode("default").InnerText);
            }
            return presstr;
        }

        protected IXPathNavigable XmlProc(string itype, string isource, string istr)
        {
            XmlDocument document = new XmlDocument();
            if ((string.Compare(itype, "static") != 0) && (string.Compare(itype, "xml_read") != 0))
            {
                if (string.IsNullOrEmpty(istr))
                {
                    this.ShowXml.Text = "查询结果为空,请检查数据库中是否有数据,或查询条件是否正确!";
                    return document;
                }
                if (string.Compare(istr, "queryerr") == 0)
                {
                    this.ShowXml.Text = "查询错,请检查您的查询语句是否符合规则!";
                    return document;
                }
                try
                {
                    document.LoadXml(istr);
                }
                catch (XmlException exception)
                {
                    this.ShowXml.Text = exception.ToString();
                }
                return document;
            }
            if (string.Compare(itype, "xml_read") == 0)
            {
                string str;
                HttpContext current = HttpContext.Current;
                if (current != null)
                {
                    str = current.Server.MapPath("~/" + isource);
                }
                else
                {
                    str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, isource);
                }
                document.Load(str);
            }
            return document;
        }
    }
}

⌨️ 快捷键说明

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