string RenderIndustryHTML() { string ck = prefixInd + _FirstLetter; if (_Cache.ContainsKey(ck)) { return(_Cache[ck]); } List <ProductIndustry> inds = ProductIndustries.GetIndustriesByPY(_FirstLetter); string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry"; if (inds == null || inds.Count == 0) { return("<div><span>没有可显示的行业信息!</span></div>"); } StringBuilder sb = new StringBuilder(); ProductIndustry pb = null; int curCount = inds.Count; string catId = string.Empty; sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">"); for (int i = 0; i < curCount; i++) { pb = inds[i]; sb.Append("<tr><td>"); catId = GlobalSettings.Encrypt(pb.IndustryID.ToString()); sb.AppendLine("<div><a href=\"" + nav + "&ID=" + catId + "\" target=\"_blank\">" + pb.IndustryName + "</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(); }