public string RendHtml()
        {
            StringBuilder stringBuilder = new StringBuilder();
            XmlNode       xmlNode       = TagsHelper.FindCommentNode(this.CommentId, "attribute");

            if (xmlNode != null)
            {
                stringBuilder.AppendFormat("<div class=\"attribute_bd cssEdite\" type=\"attribute\" id=\"comments_{0}\" >", this.CommentId).AppendLine();
                int categoryId = 0;
                int num        = 0;
                int.TryParse(xmlNode.Attributes["CategoryId"].Value, out categoryId);
                int.TryParse(xmlNode.Attributes["MaxNum"].Value, out num);
                string       rewriteName = null;
                CategoryInfo category    = CategoryBrowser.GetCategory(categoryId);
                if (category != null)
                {
                    rewriteName = category.RewriteName;
                }
                IList <AttributeInfo> attributeInfoByCategoryId = CategoryBrowser.GetAttributeInfoByCategoryId(categoryId, 1000);
                if (attributeInfoByCategoryId != null && attributeInfoByCategoryId.Count > 0)
                {
                    foreach (AttributeInfo current in attributeInfoByCategoryId)
                    {
                        stringBuilder.AppendLine("<dl class=\"attribute_dl\">");
                        stringBuilder.AppendFormat("<dt class=\"attribute_name\">{0}:</dt>", current.AttributeName).AppendLine();
                        stringBuilder.AppendLine("<dd class=\"attribute_val\">");
                        stringBuilder.AppendLine("<div class=\"h_chooselist\">");
                        foreach (AttributeValueInfo current2 in current.AttributeValues)
                        {
                            stringBuilder.AppendFormat("<a href=\"{0}\" >{1}</a>", string.Concat(new object[]
                            {
                                Globals.GetSiteUrls().SubCategory(categoryId, rewriteName),
                                "?valueStr=",
                                current2.AttributeId,
                                "_",
                                current2.ValueId
                            }), current2.ValueStr).AppendLine();
                        }
                        stringBuilder.AppendLine("</div>");
                        stringBuilder.AppendLine("</dd>");
                        stringBuilder.AppendLine("</dl>");
                    }
                }
                stringBuilder.AppendLine("</div>");
            }
            return(stringBuilder.ToString());
        }
Пример #2
0
        private void RendeAttribute(StringBuilder sb)
        {
            IList <AttributeInfo> attributeInfoByCategoryId = CategoryBrowser.GetAttributeInfoByCategoryId(this.categoryId, 1000);

            if (attributeInfoByCategoryId != null && attributeInfoByCategoryId.Count > 0)
            {
                foreach (AttributeInfo current in attributeInfoByCategoryId)
                {
                    sb.AppendLine("<dl class=\"attribute_dl\">");
                    if (current.AttributeValues.Count > 0)
                    {
                        sb.AppendFormat("<dt class=\"attribute_name\">{0}:</dt>", current.AttributeName).AppendLine();
                        sb.AppendLine("<dd class=\"attribute_val\">");
                        sb.AppendLine("<div class=\"h_chooselist\">");
                        string paraValue = this.RemoveAttribute(this.valueStr, current.AttributeId, 0);
                        string arg       = "all select";
                        if (!string.IsNullOrEmpty(this.valueStr) && new Regex(string.Format("{0}_[1-9]+", current.AttributeId)).IsMatch(this.valueStr))
                        {
                            arg = "all";
                        }
                        sb.AppendFormat("<a class=\"{0}\" href=\"{1}\" >全部</a>", arg, this.CreateUrl("valuestr", paraValue)).AppendLine();
                        foreach (AttributeValueInfo current2 in current.AttributeValues)
                        {
                            string arg2 = string.Empty;
                            paraValue = this.RemoveAttribute(this.valueStr, current.AttributeId, current2.ValueId);
                            if (!string.IsNullOrEmpty(this.valueStr))
                            {
                                string[] source = this.valueStr.Split(new char[]
                                {
                                    '-'
                                });
                                if (source.Contains(current.AttributeId + "_" + current2.ValueId))
                                {
                                    arg2 = "select";
                                }
                            }
                            sb.AppendFormat("<a class=\"{0}\" href=\"{1}\" >{2}</a>", arg2, this.CreateUrl("valuestr", paraValue), current2.ValueStr).AppendLine();
                        }
                        sb.AppendLine("</div>");
                        sb.AppendLine("</dd>");
                    }
                    sb.AppendLine("</dl>");
                }
            }
        }
Пример #3
0
        public string RendHtml()
        {
            StringBuilder builder = new StringBuilder();
            XmlNode       node    = TagsHelper.FindCommentNode(this.CommentId, "attribute");

            if (node != null)
            {
                builder.AppendFormat("<div class=\"attribute_bd cssEdite\" type=\"attribute\" id=\"comments_{0}\" >", this.CommentId).AppendLine();
                int result = 0;
                int num2   = 0;
                int.TryParse(node.Attributes["CategoryId"].Value, out result);
                int.TryParse(node.Attributes["MaxNum"].Value, out num2);
                string       rewriteName = null;
                CategoryInfo category    = CategoryBrowser.GetCategory(result);
                if (category != null)
                {
                    rewriteName = category.RewriteName;
                }
                IList <AttributeInfo> attributeInfoByCategoryId = CategoryBrowser.GetAttributeInfoByCategoryId(result, 0x3e8);
                if ((attributeInfoByCategoryId != null) && (attributeInfoByCategoryId.Count > 0))
                {
                    foreach (AttributeInfo info2 in attributeInfoByCategoryId)
                    {
                        builder.AppendLine("<dl class=\"attribute_dl\">");
                        builder.AppendFormat("<dt class=\"attribute_name\">{0}:</dt>", info2.AttributeName).AppendLine();
                        builder.AppendLine("<dd class=\"attribute_val\">");
                        builder.AppendLine("<div class=\"h_chooselist\">");
                        foreach (AttributeValueInfo info3 in info2.AttributeValues)
                        {
                            builder.AppendFormat("<a href=\"{0}\" >{1}</a>", string.Concat(new object[] { Globals.GetSiteUrls().SubCategory(result, rewriteName), "?valueStr=", info3.AttributeId, "_", info3.ValueId }), info3.ValueStr).AppendLine();
                        }
                        builder.AppendLine("</div>");
                        builder.AppendLine("</dd>");
                        builder.AppendLine("</dl>");
                    }
                }
                builder.AppendLine("</div>");
            }
            return(builder.ToString());
        }
        private void RendeAttribute(StringBuilder sb)
        {
            IList <AttributeInfo> attributeInfoByCategoryId = CategoryBrowser.GetAttributeInfoByCategoryId(this.categoryId, 0x3e8);

            if ((attributeInfoByCategoryId != null) && (attributeInfoByCategoryId.Count > 0))
            {
                foreach (AttributeInfo info in attributeInfoByCategoryId)
                {
                    sb.AppendLine("<dl class=\"attribute_dl\">");
                    if (info.AttributeValues.Count > 0)
                    {
                        sb.AppendFormat("<dt class=\"attribute_name\">{0}:</dt>", info.AttributeName).AppendLine();
                        sb.AppendLine("<dd class=\"attribute_val\">");
                        sb.AppendLine("<div class=\"h_chooselist\">");
                        string str       = "all";
                        string paraValue = this.RemoveAttribute(this.valueStr, info.AttributeId, 0);
                        string str3      = "all select";
                        if (!string.IsNullOrEmpty(this.valueStr) && new Regex(string.Format("{0}_[1-9]+", info.AttributeId)).IsMatch(this.valueStr))
                        {
                            str3 = "all";
                        }
                        sb.AppendFormat("<a class=\"{0}\" href=\"{1}\" >全部</a>", str3, this.CreateUrl("valuestr", paraValue)).AppendLine();
                        foreach (AttributeValueInfo info2 in info.AttributeValues)
                        {
                            str       = string.Empty;
                            paraValue = this.RemoveAttribute(this.valueStr, info.AttributeId, info2.ValueId);
                            if (!string.IsNullOrEmpty(this.valueStr) && this.valueStr.Split(new char[] { '-' }).Contains <string>((info.AttributeId + "_" + info2.ValueId)))
                            {
                                str = "select";
                            }
                            sb.AppendFormat("<a class=\"{0}\" href=\"{1}\" >{2}</a>", str, this.CreateUrl("valuestr", paraValue), info2.ValueStr).AppendLine();
                        }
                        sb.AppendLine("</div>");
                        sb.AppendLine("</dd>");
                    }
                    sb.AppendLine("</dl>");
                }
            }
        }