Example #1
0
        protected void ShowLabelAdd()
        {
            string str = BasePage.RequestString("n");

            if (!string.IsNullOrEmpty(str))
            {
                this.LabelName.Text = str;
                LabelManageInfo labelByName = LabelManage.GetLabelByName(str);
                if (!labelByName.IsNull)
                {
                    StringBuilder builder = new StringBuilder();
                    builder.Append("<table width='100%'>");
                    XmlDocument document = new XmlDocument();
                    document.LoadXml(labelByName.Define.ToString());
                    foreach (XmlNode node in document.SelectNodes("root/attributes"))
                    {
                        string   innerText = node.SelectSingleNode("default").InnerText;
                        string[] sArray    = innerText.Split(new string[] { "|||" }, StringSplitOptions.None);
                        builder.Append(this.CtrlProc(node.SelectSingleNode("name").InnerText, innerText, innerText, node.SelectSingleNode("intro").InnerText, sArray));
                    }
                    string input = (document.SelectSingleNode("root/UsePage") == null) ? "" : document.SelectSingleNode("root/UsePage").InnerText.Trim();
                    if (DataConverter.CBoolean(input))
                    {
                        builder.Append("<tr><td align=\"right\">是否分页:</td><td align=\"left\"><input id=\"page\" type=\"checkbox\"/></td></tr>");
                        builder.Append("<tr><td align=\"right\">分页显示数:</td><td align=\"left\"><input type=\"text\" id=\"pagesize\" value=\"10\"/></td></tr>");
                        builder.Append("<tr><td align=\"right\">是否主分页:</td><td align=\"left\"><input id=\"urlpage\" type=\"checkbox\" value=\"true\"/></td></tr>");
                    }
                    builder.Append("<tr><td align=\"right\">缓存时间:</td><td align=\"left\"><input type=\"text\" id=\"cachetime\" value=\"0\" /></td></tr>");
                    builder.Append("<tr><td align=\"right\">不解析内部标签:</td><td align=\"left\"><input id=\"nolabelproc\" type=\"checkbox\"/></td></tr>");
                    builder.Append("<tr><td align=\"right\">容器类型:</td><td align=\"left\"><input type=\"text\" id=\"spantype\" /></td></tr>");
                    builder.Append("<tr><td align=\"right\">容器风格:</td><td align=\"left\"><input type=\"text\" id=\"cssname\" /></td></tr>");
                    builder.Append("</table>");
                    this.labelbody.Text = builder.ToString();
                    input = (document.SelectSingleNode("root/LabelIntro") == null) ? "" : document.SelectSingleNode("root/LabelIntro").InnerText.Trim();
                    if (!string.IsNullOrEmpty(input))
                    {
                        this.labelintro.Text = input;
                    }
                }
            }
        }
Example #2
0
        protected void ShowLabelModify()
        {
            string labelName = string.Empty;
            string str2      = BasePage.RequestString("n");

            if (!string.IsNullOrEmpty(str2))
            {
                str2 = str2.Replace("{", "<").Replace("}", ">");
                XmlDocument document = new XmlDocument();
                document.LoadXml(str2);
                XmlElement documentElement = document.DocumentElement;
                if (documentElement.HasAttribute("id"))
                {
                    labelName           = documentElement.GetAttribute("id");
                    this.LabelName.Text = labelName;
                    LabelManageInfo labelByName = LabelManage.GetLabelByName(labelName);
                    if (!labelByName.IsNull)
                    {
                        StringBuilder builder = new StringBuilder();
                        builder.Append("<table width='100%'>");
                        XmlDocument document2 = new XmlDocument();
                        document2.LoadXml(labelByName.Define.ToString());
                        foreach (XmlNode node in document2.SelectNodes("root/attributes"))
                        {
                            string innerText = node.SelectSingleNode("name").InnerText;
                            string avalue    = string.Empty;
                            if (documentElement.HasAttribute(innerText))
                            {
                                avalue = documentElement.GetAttribute(innerText);
                            }
                            else
                            {
                                avalue = node.SelectSingleNode("default").InnerText;
                            }
                            string[] sArray = node.SelectSingleNode("default").InnerText.Split(new string[] { "|||" }, StringSplitOptions.None);
                            builder.Append(this.CtrlProc(node.SelectSingleNode("name").InnerText, avalue, node.SelectSingleNode("default").InnerText, node.SelectSingleNode("intro").InnerText, sArray));
                        }
                        string input     = (document2.SelectSingleNode("root/UsePage") == null) ? "" : document2.SelectSingleNode("root/UsePage").InnerText.Trim();
                        string attribute = string.Empty;
                        if (DataConverter.CBoolean(input))
                        {
                            if (documentElement.HasAttribute("page") && DataConverter.CBoolean(documentElement.GetAttribute("page")))
                            {
                                attribute = " checked";
                            }
                            builder.Append("<tr><td align=\"right\">是否分页:</td><td align=\"left\"><input id=\"page\" type=\"checkbox\"" + attribute + "/></td></tr>");
                            attribute = "10";
                            if (documentElement.HasAttribute("pagesize") && !string.IsNullOrEmpty(documentElement.GetAttribute("pagesize")))
                            {
                                attribute = documentElement.GetAttribute("pagesize");
                            }
                            builder.Append("<tr><td align=\"right\">分页显示数:</td><td align=\"left\"><input type=\"text\" id=\"pagesize\" value=\"" + attribute + "\"/></td></tr>");
                            attribute = string.Empty;
                            if (documentElement.HasAttribute("urlpage") && DataConverter.CBoolean(documentElement.GetAttribute("urlpage")))
                            {
                                attribute = " checked";
                            }
                            builder.Append("<tr><td align=\"right\">是否主分页:</td><td align=\"left\"><input id=\"urlpage\" type=\"checkbox\"" + attribute + "/></td></tr>");
                        }
                        builder.Append("<tr><td align=\"right\">缓存时间:</td><td align=\"left\"><input type=\"text\" id=\"cachetime\"");
                        if (documentElement.HasAttribute("cachetime"))
                        {
                            builder.Append("value=\"" + documentElement.GetAttribute("cachetime") + "\"");
                        }
                        builder.Append("/></td></tr>");
                        if (documentElement.HasAttribute("noprocinlabel") && DataConverter.CBoolean(documentElement.GetAttribute("noprocinlabel")))
                        {
                            attribute = " checked";
                        }
                        builder.Append("<tr><td align=\"right\">不解析内部标签:</td><td align=\"left\"><input id=\"nolabelproc\" type=\"checkbox\"" + attribute + "/></td></tr>");
                        builder.Append("<tr><td align=\"right\">容器类型:</td><td align=\"left\"><input type=\"text\" id=\"spantype\"");
                        if (documentElement.HasAttribute("span"))
                        {
                            builder.Append("value=\"" + documentElement.GetAttribute("span") + "\"");
                        }
                        builder.Append("/></td></tr>");
                        builder.Append("<tr><td align=\"right\">容器风格:</td><td align=\"left\"><input type=\"text\" id=\"cssname\"");
                        if (documentElement.HasAttribute("class"))
                        {
                            builder.Append("value=\"" + documentElement.GetAttribute("class") + "\"");
                        }
                        builder.Append("/></td></tr>");
                        builder.Append("</table>");
                        this.labelbody.Text = builder.ToString();
                        input = (document2.SelectSingleNode("root/LabelIntro") == null) ? "" : document2.SelectSingleNode("root/LabelIntro").InnerText.Trim();
                        if (!string.IsNullOrEmpty(input))
                        {
                            this.labelintro.Text = input;
                        }
                    }
                }
            }
        }
        protected bool ReplaceProc(string labelName)
        {
            LabelManageInfo ainfo = new LabelManageInfo();

            ainfo = LabelManage.GetLabelByName(labelName);
            if (string.Compare(this.RadioButtonList2.SelectedValue, "labelname", StringComparison.OrdinalIgnoreCase) == 0)
            {
                string str = ainfo.Name.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
                if (this.ChkAdd.Checked)
                {
                    ainfo.Name = str;
                    return(LabelManage.Add(ainfo));
                }
                return(LabelManage.Update(ainfo, str));
            }
            if (string.Compare(this.RadioButtonList2.SelectedValue, "labeltype", StringComparison.OrdinalIgnoreCase) == 0)
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(ainfo.Define.ToString());
                if (document.SelectSingleNode("root/LabelType") != null)
                {
                    document.SelectSingleNode("root/LabelType").InnerText = document.SelectSingleNode("root/LabelType").InnerText.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
                }
                ainfo.Define = new StringBuilder(document.InnerXml);
                if (this.ChkAdd.Checked)
                {
                    return(LabelManage.Add(ainfo));
                }
                return(LabelManage.Update(ainfo));
            }
            if (string.Compare(this.RadioButtonList2.SelectedValue, "labelintro", StringComparison.OrdinalIgnoreCase) == 0)
            {
                XmlDocument document2 = new XmlDocument();
                document2.LoadXml(ainfo.Define.ToString());
                if (document2.SelectSingleNode("root/LabelIntro") != null)
                {
                    document2.SelectSingleNode("root/LabelIntro").InnerText = document2.SelectSingleNode("root/LabelIntro").InnerText.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
                }
                ainfo.Define = new StringBuilder(document2.InnerXml);
                if (this.ChkAdd.Checked)
                {
                    return(LabelManage.Add(ainfo));
                }
                return(LabelManage.Update(ainfo));
            }
            if (string.Compare(this.RadioButtonList2.SelectedValue, "sql", StringComparison.OrdinalIgnoreCase) == 0)
            {
                XmlDocument document3 = new XmlDocument();
                document3.LoadXml(ainfo.Define.ToString());
                if (document3.SelectSingleNode("root/LabelSqlString") != null)
                {
                    document3.SelectSingleNode("root/LabelSqlString").InnerText = document3.SelectSingleNode("root/LabelSqlString").InnerText.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
                }
                ainfo.Define = new StringBuilder(document3.InnerXml);
                if (this.ChkAdd.Checked)
                {
                    return(LabelManage.Add(ainfo));
                }
                return(LabelManage.Update(ainfo));
            }
            if (string.Compare(this.RadioButtonList2.SelectedValue, "template", StringComparison.OrdinalIgnoreCase) == 0)
            {
                XmlDocument document4 = new XmlDocument();
                document4.LoadXml(ainfo.Define.ToString());
                if (document4.SelectSingleNode("root/LabelTemplate") != null)
                {
                    document4.SelectSingleNode("root/LabelTemplate").InnerText = document4.SelectSingleNode("root/LabelTemplate").InnerText.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
                }
                ainfo.Define = new StringBuilder(document4.InnerXml);
                if (this.ChkAdd.Checked)
                {
                    return(LabelManage.Add(ainfo));
                }
                return(LabelManage.Update(ainfo));
            }
            string      newLableName = ainfo.Name.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
            XmlDocument document5    = new XmlDocument();

            document5.LoadXml(ainfo.Define.ToString());
            if (document5.SelectSingleNode("root/LabelType") != null)
            {
                document5.SelectSingleNode("root/LabelType").InnerText = document5.SelectSingleNode("root/LabelType").InnerText.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
            }
            if (document5.SelectSingleNode("root/LabelIntro") != null)
            {
                document5.SelectSingleNode("root/LabelIntro").InnerText = document5.SelectSingleNode("root/LabelIntro").InnerText.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
            }
            if (document5.SelectSingleNode("root/LabelSqlString") != null)
            {
                document5.SelectSingleNode("root/LabelSqlString").InnerText = document5.SelectSingleNode("root/LabelSqlString").InnerText.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
            }
            if (document5.SelectSingleNode("root/LabelTemplate") != null)
            {
                document5.SelectSingleNode("root/LabelTemplate").InnerText = document5.SelectSingleNode("root/LabelTemplate").InnerText.Replace(this.ReplaceSource.Text, this.ReplaceTarget.Text);
            }
            ainfo.Define = new StringBuilder(document5.InnerXml);
            if (this.ChkAdd.Checked)
            {
                ainfo.Name = newLableName;
                return(LabelManage.Add(ainfo));
            }
            return(LabelManage.Update(ainfo, newLableName));
        }