string RenderBrandHTML() { string ck = prefixBra + _FirstLetter; if (_Cache.ContainsKey(ck)) { return(_Cache[ck]); } List <ProductBrand> brands = ProductBrands.GetBrandsByPY(_FirstLetter); string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-brand"; if (brands == null || brands.Count == 0) { return("<div><span>没有可显示的品牌信息!</span></div>"); } StringBuilder sb = new StringBuilder(); ProductBrand pb = null; int curCount = brands.Count; string catId = string.Empty; sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">"); for (int i = 0; i < curCount; i++) { pb = brands[i]; sb.Append("<tr><td>"); catId = GlobalSettings.Encrypt(pb.BrandID.ToString()); sb.AppendLine("<div><a href=\"" + nav + "&ID=" + catId + "\" target=\"_blank\">" + pb.BrandName + "</a></div>"); sb.AppendLine("</td></tr>"); } sb.AppendLine("</table>"); if (!_Cache.ContainsKey(ck)) { lock (_lock) if (!_Cache.ContainsKey(ck)) { _Cache.Add(ck, sb.ToString()); } } return(sb.ToString()); }
public override void OnPageLoaded() { string letter = this.llCategory.FirstLetter, title = string.Empty; StringBuilder sbKeywords = new StringBuilder(); switch (this.llCategory.LetterType) { case LettersType.Category: List <ProductCategory> listCategory = ProductCategories.GetCategoreisByPY(letter); if (null == listCategory || 0 == listCategory.Count) { } else { foreach (ProductCategory item in listCategory) { sbKeywords.AppendFormat("{0},", item.CategoryName); } } title = "分类"; break; case LettersType.Brand: List <ProductBrand> listBrand = ProductBrands.GetBrandsByPY(letter); if (null == listBrand || 0 == listBrand.Count) { } else { foreach (ProductBrand item in listBrand) { sbKeywords.AppendFormat("{0},", item.BrandName); } } title = "品牌"; break; case LettersType.Industry: List <ProductIndustry> listIndustry = ProductIndustries.GetIndustriesByPY(letter); if (null == listIndustry || 0 == listIndustry.Count) { } else { foreach (ProductIndustry item in listIndustry) { sbKeywords.AppendFormat("{0},", item.IndustryName); } } title = "行业"; break; } string keywords = sbKeywords.ToString().TrimEnd(','); if (string.IsNullOrEmpty(keywords)) { //this.AddKeywords(keywords); this.AddDescription(string.Format("按照首字母进行{0}检索,首字母是{1}", title, letter.ToUpper())); this.ShortTitle = string.Format("首字母{0}检索{1}", title, letter.ToUpper()); } else { this.AddKeywords(keywords); this.AddDescription(string.Format("按照首字母进行{0}检索,首字母是{1},符合条件的{0}列表如下: {2}", title, letter.ToUpper(), keywords)); this.ShortTitle = string.Format("首字母{0}检索{1} - {2}", title, letter.ToUpper(), keywords); } this.SetTitle(); }