string RenderHTML() { if (_Cache.ContainsKey(_IndustryID)) { return(_Cache[_IndustryID]); } List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0); StringBuilder sb = new StringBuilder(); if (_IndustryID == 0) { return("<div class=\"" + _CssClass + "\"><span>暂无相关行业信息!</span></div>"); } else { ProductIndustry pi = ProductIndustries.GetProductIndustry(_IndustryID); if (pi.ParentID == 0) { return("<div class=\"" + _CssClass + "\"><span>此行业为顶级行业分类!</span></div>"); } List <ProductIndustry> pis = ProductIndustries.GetChildIndustries(pi.ParentID); if (pis == null || pis.Count == 0 || (pis.Count == 1 && pis[0].IndustryID == _IndustryID)) { return("<div class=\"" + _CssClass + "\"><span>暂无相关行业信息!</span></div>"); } sb.Append("<div class=\"" + _CssClass + "\">"); ProductQuery query; int count = 0; PagingDataSet <Product> __ps = null; foreach (ProductIndustry p in pis) { if (p.IndustryID != _IndustryID) { count = 0; query = new ProductQuery(); query.IndustryID = p.IndustryID; __ps = Products.GetProducts(query); if (__ps != null && __ps.Records != null) { count = Products.GetProducts(query).Records.Count; } sb.AppendFormat(_href, GlobalSettings.Encrypt(p.IndustryID.ToString()), p.IndustryName + "(" + count + ")"); } } sb.Append("</div>"); if (!_Cache.ContainsKey(_IndustryID)) { lock (_lock) if (!_Cache.ContainsKey(_IndustryID)) { _Cache.Add(_IndustryID, sb.ToString()); } } return(sb.ToString()); } }
string RenderHTML() { List <ProductBrand> brands = ProductBrands.GetProductBrands(); string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-brand"; if (brands == null || brands.Count == 0) { return("<div><span>没有显示的品牌信息!</span></div>"); } List <string> brandGroup = ProductBrands.GetBrandGroup(); int curCount = brandGroup.Count; brandGroup = brandGroup.GetRange(0, Math.Min(_Max, curCount)); List <ProductBrand> pb = null; StringBuilder sb = new StringBuilder(); sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">"); string bId = string.Empty; for (int i = 0; i < brandGroup.Count; i++) { if (i % _Columns == 0) { sb.AppendLine("<tr>"); } sb.AppendLine("<td>"); sb.AppendLine("<div><div><a href=\"javascript:void(0)\">" + brandGroup[i] + "</a></div></div>"); pb = GetSubBrand(brandGroup[i], brands); ProductBrand _pb = null; for (int j = 0; j < pb.Count; j++) { _pb = pb[j]; bId = GlobalSettings.Encrypt(_pb.BrandID.ToString()); sb.AppendLine("<a href=\"" + nav + "&ID=" + bId + "\" target=\"_blank\">" + _pb.BrandName + "</a>"); if (j != pb.Count - 1) { sb.Append(" | "); } } sb.AppendLine("</td>"); if (i % _Columns == _Columns - 1) { sb.AppendLine("</tr>"); } } sb.AppendLine("</table>"); if (curCount > _Max) { sb.Append("<div class=\"list-more\"><a href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-brand\" title=\"查看全部。。。\"></a></div>"); } return(sb.ToString()); }
string RenderHTML() { if (_Cache.ContainsKey(_CategoryID)) { return(_Cache[_CategoryID]); } List <ProductCategory> pcs = ProductCategories.GetCategories(); StringBuilder sb = new StringBuilder(); if (_CategoryID == 0) { return("<div class=\"" + _CssClass + "\"><span>暂无子分类信息!</span></div>"); } else { string _catId = string.Empty; ProductCategory curCat = null; List <ProductCategory> subCats = ProductCategories.GetChidCategories(_CategoryID); if (subCats == null || subCats.Count == 0) { return("<div class=\"" + _CssClass + "\"><span>暂无子分类信息!</span></div>"); } sb.Append("<div class=\"" + _CssClass + "\">"); ProductQuery query; int count = 0; PagingDataSet <Product> __ps = null; for (int i = 0; i < subCats.Count; i++) { curCat = subCats[i]; count = 0; query = new ProductQuery(); query.CategoryID = curCat.CategoryID; __ps = Products.GetProducts(query); if (__ps != null && __ps.Records != null) { count = Products.GetProducts(query).Records.Count; } sb.AppendFormat(_href, GlobalSettings.Encrypt(curCat.CategoryID.ToString()), curCat.CategoryName + "(" + count + ")"); } sb.Append("</div>"); if (!_Cache.ContainsKey(_CategoryID)) { lock (_lock) { if (!_Cache.ContainsKey(_CategoryID)) { _Cache.Add(_CategoryID, sb.ToString()); } } } } return(sb.ToString()); }
string RenderHTML() { List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0); string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry"; if (inds == null || inds.Count == 0) { return("<div><span>没有显示的行业信息!</span></div>"); } List <ProductIndustry> pis = null; ProductIndustry pi = null; StringBuilder sb = new StringBuilder(); string indId = null; int curCount = inds.Count; inds = inds.GetRange(0, Math.Min(_Max, curCount)); sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">"); for (int i = 0; i < inds.Count; i++) { pi = inds[i]; indId = GlobalSettings.Encrypt(pi.IndustryID.ToString()); if (i % _Columns == 0) { sb.AppendLine("<tr>"); } sb.AppendLine("<td>"); sb.AppendLine("<div><div><a href=\"" + nav + "&ID=" + indId + "\" target=\"_blank\">" + pi.IndustryName + "</a></div></div>"); pis = ProductIndustries.GetChildIndustries(pi.IndustryID); for (int j = 0; j < pis.Count; j++) { pi = pis[j]; indId = GlobalSettings.Encrypt(pi.IndustryID.ToString()); sb.AppendLine("<a href=\"" + nav + "&ID=" + indId + "\" target=\"_blank\">" + pi.IndustryName + "</a>"); if (j != pis.Count - 1) { sb.Append(" | "); } } sb.AppendLine("</td>"); if (i % _Columns == _Columns - 1) { sb.AppendLine("</tr>"); } } sb.AppendLine("</table>"); if (curCount > _Max) { sb.Append("<div class=\"list-more\"><a href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry\" title=\"查看全部。。。\"></a></div>"); } return(sb.ToString()); }
string RenderHTML() { if (_Cache.ContainsKey(_BrandID)) { return(_Cache[_BrandID]); } if (_BrandID == 0) { return("<div class=\"" + _CssClass + "\"><span>暂无相关品牌信息!</span></div>"); } else { List <ProductBrand> brands = ProductBrands.GetProductBrands(); StringBuilder sb = new StringBuilder(); ProductBrand pb = ProductBrands.GetProductBrand(_BrandID); List <ProductBrand> bs = GetSubBrand(pb.BrandGroup, brands); if (bs == null || bs.Count == 0 || (bs.Count == 1 && bs[0].BrandID == _BrandID)) { return("<div class=\"" + _CssClass + "\"><span>暂无相关品牌信息!</span></div>"); } sb.Append("<div class=\"" + _CssClass + "\">"); ProductQuery query; int count = 0; PagingDataSet <Product> __ps = null; foreach (ProductBrand b in bs) { if (b.BrandID != _BrandID) { count = 0; query = new ProductQuery(); query.BrandID = b.BrandID; __ps = Products.GetProducts(query); if (__ps != null && __ps.Records != null) { count = Products.GetProducts(query).Records.Count; } sb.AppendFormat(_href, GlobalSettings.Encrypt(b.BrandID.ToString()), b.BrandName + "(" + count + ")"); } } sb.Append("</div>"); if (!_Cache.ContainsKey(_BrandID)) { lock (_lock) if (!_Cache.ContainsKey(_BrandID)) { _Cache.Add(_BrandID, sb.ToString()); } } return(sb.ToString()); } }
string RenderHTML() { if (_Cache.ContainsKey(_IndustryID)) { return(_Cache[_IndustryID]); } List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0); StringBuilder sb = new StringBuilder(); if (_IndustryID == 0) { return("<div class=\"" + _CssClass + "\"><span>暂无子行业信息!</span></div>"); } else { string _indId = string.Empty; ProductIndustry pi = null; List <ProductIndustry> pis = ProductIndustries.GetChildIndustries(_IndustryID); if (pis == null || pis.Count == 0) { return("<div class=\"" + _CssClass + "\"><span>暂无子行业信息!</span></div>"); } sb.Append("<div class=\"" + _CssClass + "\">"); ProductQuery query; int count = 0; PagingDataSet <Product> __ps = null; for (int i = 0; i < pis.Count; i++) { pi = pis[i]; count = 0; query = new ProductQuery(); query.IndustryID = pi.IndustryID; __ps = Products.GetProducts(query); if (__ps != null && __ps.Records != null) { count = Products.GetProducts(query).Records.Count; } sb.AppendFormat(_href, GlobalSettings.Encrypt(pi.IndustryID.ToString()), pi.IndustryName + "(" + count + ")"); } sb.Append("</div>"); if (!_Cache.ContainsKey(_IndustryID)) { lock (_lock) if (!_Cache.ContainsKey(_IndustryID)) { _Cache.Add(_IndustryID, sb.ToString()); } } } return(sb.ToString()); }
string GenerateIndustry(ref bool result) { List <ProductIndustry> pbs = ProductIndustries.GetProductIndustries(); SiteMapBuilder smb = new SiteMapBuilder(); foreach (ProductIndustry pb in pbs) { smb.AddLocalUrl("pages/view.aspx?product-industry&ID=" + GlobalSettings.Encrypt(pb.IndustryID.ToString()), DateTime.Now); } smb.Save(GlobalSettings.MapPath("~/sitemap/industries.xml")); result = true; return("成功生成/更新【产品品牌】地图!"); }
string GenerateBrand(ref bool result) { List <ProductBrand> pbs = ProductBrands.GetProductBrands(); SiteMapBuilder smb = new SiteMapBuilder(); foreach (ProductBrand pb in pbs) { smb.AddLocalUrl("pages/view.aspx?product-brand&ID=" + GlobalSettings.Encrypt(pb.BrandID.ToString()), DateTime.Now); } smb.Save(GlobalSettings.MapPath("~/sitemap/brands.xml")); result = true; return("成功生成/更新【产品行业】地图!"); }
string GenerateCategory(ref bool result) { List <ProductCategory> cats = ProductCategories.GetCategories(); SiteMapBuilder smb = new SiteMapBuilder(); foreach (ProductCategory cat in cats) { smb.AddLocalUrl("pages/view.aspx?product-category&ID=" + GlobalSettings.Encrypt(cat.CategoryID.ToString()), DateTime.Now); } smb.Save(GlobalSettings.MapPath("~/sitemap/categories.xml")); result = true; return("成功生成/更新【产品分类】地图!"); }
/// <summary> /// 重写Url /// </summary> /// <param name="url"></param> /// <returns></returns> public static string Parse(string url) { string key = GlobalSettings.Encrypt(url); string newUrl = LoadCache(key); if (!string.IsNullOrEmpty(newUrl)) { return(newUrl); } #region -Ignore- //Match match = null; //Regex regex = null; //string[] newUrls = null; #endregion string relative = GlobalSettings.RelativeWebRoot; RegexOptions ro = RegexOptions.None; foreach (UrlRewriteSection r in rules) { #region -Ignore- //regex = new Regex(relative + r.VirtualUrl, (r.IgnoreCase ? RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace : RegexOptions.None)); //match = regex.Match(url); //if (match.Success) //{ // GroupCollection gc = match.Groups; // newUrls = new string[gc.Count]; // int i = 0; // foreach (Group g in gc) // { // newUrls[i++] = g.Value; // } // newUrl = String.Format(r.DestinationUrl, newUrls); // UpdateCache(key, newUrl); // return newUrl; //} #endregion if (r.IgnoreCase) { ro = (RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); } if (Regex.IsMatch(url, relative + r.VirtualUrl, ro)) { return(Regex.Replace(url, relative + r.VirtualUrl, r.DestinationUrl, ro)); } } return(null); }
public void ProcessRequest(HttpContext context) { string c = GetValidCode(); HHCookie.AddCookie("HHOnline_ValidateCode", GlobalSettings.Encrypt(c), DateTime.Now.AddMinutes(5)); Bitmap bmp = DrawValidCode(c, 30, 2); context.Response.ClearContent(); context.Response.ContentType = "image/gif"; MemoryStream ms = new MemoryStream(); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); context.Response.BinaryWrite(ms.ToArray()); bmp.Dispose(); context.Response.End(); }
public string GetView(object pid, object favType) { string id = GlobalSettings.Encrypt(pid.ToString()); FavoriteType ft = (FavoriteType)favType; switch (ft) { case FavoriteType.Product: return(GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-product&ID=" + id); case FavoriteType.Article: return(GlobalSettings.RelativeWebRoot + "pages/view.aspx?news-newsdetail&id=" + id); break; } return("#"); }
string GenerateArticle(ref bool result) { ProductQuery pq = new ProductQuery(); pq.HasPublished = true; pq.PageIndex = 0; pq.PageSize = int.MaxValue; List <Article> arts = ArticleManager.GetAllArticles(); SiteMapBuilder smb = new SiteMapBuilder(); foreach (Article p in arts) { smb.AddLocalUrl("pages/view.aspx?news-newsdetail&id=" + GlobalSettings.Encrypt(p.ID.ToString()), DateTime.Now); } smb.Save(GlobalSettings.MapPath("~/sitemap/articles.xml")); result = true; return("成功生成/更新【资讯】地图!"); }
string GenerateProduct(ref bool result) { ProductQuery pq = new ProductQuery(); pq.HasPublished = true; pq.PageIndex = 0; pq.PageSize = int.MaxValue; List <Product> ps = Products.GetProductList(pq); SiteMapBuilder smb = new SiteMapBuilder(); foreach (Product p in ps) { smb.AddLocalUrl("pages/view.aspx?product-product&ID=" + GlobalSettings.Encrypt(p.ProductID.ToString()), DateTime.Now); } smb.Save(GlobalSettings.MapPath("~/sitemap/products.xml")); result = true; return("成功生成/更新【产品】地图!"); }
string RenderHTML() { if (_Cache.ContainsKey(_CategoryID)) { return(_Cache[_CategoryID]); } StringBuilder sb = new StringBuilder(); if (_CategoryID == 0) { sb.Append("您的位置:<b>所有类别</b>"); } else { ProductCategory curCat = ProductCategories.GetCategory(_CategoryID); sb.Append("<b>" + curCat.CategoryName + "</b>"); int parId = curCat.ParentID; string _catId = string.Empty; while (parId != 0) { _catId = GlobalSettings.Encrypt(parId.ToString()); curCat = ProductCategories.GetCategory(parId); if (curCat == null) { break; } sb.Insert(0, string.Format(_href, "&ID=" + _catId, curCat.CategoryName) + ">>"); parId = curCat.ParentID; } sb.Insert(0, "您的位置:" + string.Format(_href, "", "所有类别") + ">>"); if (!_Cache.ContainsKey(_CategoryID)) { lock (_lock) { if (!_Cache.ContainsKey(_CategoryID)) { _Cache.Add(_CategoryID, sb.ToString()); } } } } return(sb.ToString()); }
string RenderCategoryHTML() { string ck = prefixCat + _FirstLetter; if (_Cache.ContainsKey(ck)) { return(_Cache[ck]); } List <ProductCategory> pcs = ProductCategories.GetCategoreisByPY(_FirstLetter); string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-category"; if (pcs == null || pcs.Count == 0) { return("<div><span>没有可显示的分类信息!</span></div>"); } StringBuilder sb = new StringBuilder(); ProductCategory pc = null; int curCount = pcs.Count; string catId = string.Empty; sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">"); for (int i = 0; i < curCount; i++) { pc = pcs[i]; sb.Append("<tr><td>"); catId = GlobalSettings.Encrypt(pc.CategoryID.ToString()); sb.AppendLine("<div><a href=\"" + nav + "&ID=" + catId + "\" target=\"_blank\">" + pc.CategoryName + "</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()); }
void BindIndustry(int pId) { List <ProductIndustry> pi = ProductIndustries.GetIndustriesByProductID(pId); if (pi.Count == 0) { ltIndustry.Text = "<ul><li><span>——</span></li></ul>"; } else { StringBuilder sb = new StringBuilder(); sb.Append("<ul>"); foreach (ProductIndustry p in pi) { sb.Append("<li><a target=\"_blank\" href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry&ID=" + GlobalSettings.Encrypt(p.IndustryID.ToString()) + "\">" + p.IndustryName + "</a></li>"); } ltIndustry.Text = sb.ToString(); } }
string RenderHTML() { if (_Cache.ContainsKey(_CategoryID)) { return(_Cache[_CategoryID]); } List <ProductCategory> pcs = ProductCategories.GetCategories(); StringBuilder sb = new StringBuilder(); if (_CategoryID == 0) { return("无"); } else { List <ProductProperty> props = ProductProperties.GetAllPropertyByCategoryID(_CategoryID); if (props == null || props.Count == 0) { return("无"); } sb.Append("<div class=\"" + _CssClass + "\">"); for (int i = 0; i < props.Count; i++) { sb.AppendFormat(_href, GlobalSettings.Encrypt(_CategoryID.ToString()), GlobalSettings.Encrypt(props[i].PropertyID.ToString()), props[i].PropertyName); } sb.Append("</div>"); if (!_Cache.ContainsKey(_CategoryID)) { lock (_lock) { if (!_Cache.ContainsKey(_CategoryID)) { _Cache.Add(_CategoryID, sb.ToString()); } } } } return(sb.ToString()); }
string RenderHTML() { if (_Cache.ContainsKey(_IndustryID)) { return(_Cache[_IndustryID]); } List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0); StringBuilder sb = new StringBuilder(); if (_IndustryID == 0) { sb.Append("您的位置:<b>所有行业</b>"); } else { ProductIndustry pi = ProductIndustries.GetProductIndustry(_IndustryID); sb.Append("<b>" + pi.IndustryName + "</b>"); int parId = pi.ParentID; while (parId != 0) { pi = ProductIndustries.GetProductIndustry(parId); if (pi == null) { break; } sb.Insert(0, string.Format(_href, "&ID=" + GlobalSettings.Encrypt(pi.IndustryID.ToString()), pi.IndustryName) + ">>"); parId = pi.ParentID; } sb.Insert(0, "您的位置:" + string.Format(_href, "", "所有行业") + ">>"); if (!_Cache.ContainsKey(_IndustryID)) { lock (_lock) if (!_Cache.ContainsKey(_IndustryID)) { _Cache.Add(_IndustryID, sb.ToString()); } } } return(sb.ToString()); }
protected void egvShoppings_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Literal ltPN = e.Row.FindControl("ltProductName") as Literal; Literal ltMN = e.Row.FindControl("ltModelName") as Literal; Literal ltPC = e.Row.FindControl("ltPrice") as Literal; Shopping shop = (Shopping)e.Row.DataItem; Product p = Products.GetProduct(shop.ProductID); ltPN.Text = string.Format(productFormat, GlobalSettings.Encrypt(p.ProductID.ToString()), p.ProductName, p.ProductAbstract, p.GetDefaultImageUrl(50, 50)); decimal?price1 = null; decimal?price2 = null; if (Profile.IsAnonymous) { price1 = ProductPrices.GetPriceDefault(p.ProductID); } else { price1 = ProductPrices.GetPriceMarket(Profile.AccountInfo.UserID, p.ProductID); price2 = ProductPrices.GetPriceMember(Profile.AccountInfo.UserID, p.ProductID); } ltPC.Text = GlobalSettings.GetPrice(price1, price2); if (shop.ModelID != 0) { ProductModel pm = ProductModels.GetModel(shop.ModelID); ltMN.Text = pm.ModelName; } else { ltMN.Text = "——"; } } }
void BindCategory(int pId) { if (cat == null) { cat = GetCategories(pId); } if (cat.Count == 0) { ltCategory.Text = "<ul><li><span>——</span></li></ul>"; } else { StringBuilder sb = new StringBuilder(); sb.Append("<ul>"); foreach (ProductCategory pc in cat) { sb.Append("<li><a target=\"_blank\" href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-category&ID=" + GlobalSettings.Encrypt(pc.CategoryID.ToString()) + "\">" + pc.CategoryName + "</a></li>"); } sb.Append("</ul>"); ltCategory.Text = sb.ToString(); } }
string BindCategory(ProductCategory pc, string nav) { StringBuilder sb = new StringBuilder(); sb.Append("<div>"); string catId = GlobalSettings.Encrypt(pc.CategoryID.ToString()); sb.AppendLine("<div><a href=\"" + nav + "&ID=" + catId + "\" target=\"_blank\">" + pc.CategoryName + "</a></div>"); List <ProductCategory> pcSubList = GetSubCategories(pc.CategoryID); for (int j = 0; j < pcSubList.Count; j++) { pc = pcSubList[j]; catId = GlobalSettings.Encrypt(pc.CategoryID.ToString()); sb.AppendLine("<a href=\"" + nav + "&ID=" + catId + "\" target=\"_blank\">" + pc.CategoryName + "</a>"); if (j != pcSubList.Count - 1) { sb.Append(" | "); } } sb.AppendLine("</div>"); return(sb.ToString()); }
string RenderHTML() { if (_Cache.ContainsKey(_BrandID)) { return(_Cache[_BrandID]); } List <ProductBrand> brands = ProductBrands.GetProductBrands(); StringBuilder sb = new StringBuilder(); if (_BrandID == 0) { sb.Append("您的位置:<b>所有品牌</b>"); } else { ProductBrand pb = ProductBrands.GetProductBrand(_BrandID); sb.Append("<b>" + pb.BrandName + "</b>"); string _bId = string.Empty; List <ProductBrand> bs = GetSubBrand(pb.BrandName, brands); foreach (ProductBrand b in bs) { _bId = GlobalSettings.Encrypt(b.BrandID.ToString()); sb.Insert(0, string.Format(_href, "&ID=" + _bId, b.BrandName) + ">>"); } sb.Insert(0, "您的位置:" + string.Format(_href, "", "所有品牌") + ">>"); if (!_Cache.ContainsKey(_BrandID)) { lock (_lock) if (!_Cache.ContainsKey(_BrandID)) { _Cache.Add(_BrandID, sb.ToString()); } } } return(sb.ToString()); }
HtmlGenericControl BindVarietyList() { List <ProductBrand> brandsTemp = ProductBrands.GetProductBrands(); if (brandsTemp == null || brandsTemp.Count == 0) { HtmlGenericControl p = new HtmlGenericControl("P"); p.InnerText = "没有品牌信息!"; return(p); } List <ProductBrand> brands = brandsTemp.GetRange(0, Math.Min(_Num, brandsTemp.Count)); if (brands == null || brands.Count == 0) { HtmlGenericControl p = new HtmlGenericControl("P"); p.InnerText = "没有品牌信息!"; return(p); } HtmlGenericControl ul = new HtmlGenericControl("ul"); ul.ID = "ulVarietyList"; HtmlGenericControl li = null; HtmlAnchor anchor = null; foreach (var b in brands) { li = new HtmlGenericControl("LI"); anchor = new HtmlAnchor(); anchor.HRef = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-brand&ID=" + GlobalSettings.Encrypt(b.BrandID.ToString()); anchor.InnerText = b.BrandName; anchor.Title = b.BrandTitle; anchor.Target = "_blank"; li.Controls.Add(anchor); ul.Controls.Add(li); } return(ul); }
private void InitialDataBind() { SiteSettings ss = HHContext.Current.SiteSettings; ltCopyRight.Text = ss.Copyright; StringBuilder sbItems = new StringBuilder(); List <ProductBrand> brands = ProductBrands.GetProductBrands(); foreach (ProductBrand item in brands) { sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?product-brand&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>", GlobalSettings.Encrypt(item.BrandID.ToString()), GlobalSettings.SubString(item.BrandName, 10), item.BrandName); } ltBrand.Text = sbItems.ToString(); List <ProductIndustry> inds = ProductIndustries.GetProductIndustries(); sbItems.Remove(0, sbItems.Length); foreach (ProductIndustry item in inds) { sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?product-industry&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>", GlobalSettings.Encrypt(item.IndustryID.ToString()), GlobalSettings.SubString(item.IndustryName, 10), item.IndustryName); } ltIndustry.Text = sbItems.ToString(); ProductQuery q = new ProductQuery(); q.PageIndex = 0; q.PageSize = int.MaxValue; q.HasPublished = true; List <Product> ps = Products.GetProductList(q); sbItems.Remove(0, sbItems.Length); foreach (Product item in ps) { sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?product-product&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>", GlobalSettings.Encrypt(item.ProductID.ToString()), GlobalSettings.SubString(item.ProductName, 17), item.ProductName); } ltProduct.Text = sbItems.ToString(); List <ProductCategory> cats = ProductCategories.GetCategories(); sbItems.Remove(0, sbItems.Length); foreach (ProductCategory item in cats) { sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?product-category&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>", GlobalSettings.Encrypt(item.CategoryID.ToString()), GlobalSettings.SubString(item.CategoryName, 10), item.CategoryName); } ltCategory.Text = sbItems.ToString(); List <Article> ars = ArticleManager.GetAllArticles(); sbItems.Remove(0, sbItems.Length); foreach (Article item in ars) { sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?news-newsdetail&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>", GlobalSettings.Encrypt(item.ID.ToString()), GlobalSettings.SubString(item.Title, 10), item.Title); } ltNews.Text = sbItems.ToString(); //ltCategory; ltIndustry; ltNews; ltProduct; }
public string RenderHTML() { if (_Cache.ContainsKey(_productID)) { return(_Cache[_productID]); } ProductQuery query = new ProductQuery(); Product pT = Products.GetProduct(_productID); query.ProductNameFilter = pT.ProductName; query.PageSize = Int32.MaxValue; query.ProductOrderBy = ProductOrderBy.DisplayOrder; query.SortOrder = SortOrder.Descending; query.PageSize = int.MaxValue; query.HasPublished = true; SearchResultDataSet <Product> ps = ProductSearchManager.Search(query); if (ps == null || ps.Records == null || ps.Records.Count == 0 || (ps.Records.Count == 1 && ps.Records[0].ProductID == _productID)) { return("<div class=\"nopiInfo\"><span>没有相关产品信息!</span></div>"); } string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-product"; List <Product> psList = null; Product p = null; StringBuilder sb = new StringBuilder(); int curCount = ps.Records.Count; psList = ps.Records.GetRange(0, Math.Min(curCount, _Max)); sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">"); string pId = string.Empty; int length = psList.Count; string pn = string.Empty; for (int i = 0; i < psList.Count; i++) { p = psList[i]; if (p.ProductID == _productID) { continue; } if (i % _Columns == 0) { sb.AppendLine("<tr>"); } pId = GlobalSettings.Encrypt(p.ProductID.ToString()); sb.AppendLine("<td>"); sb.AppendLine("<div class=\"piThumbnail\">" + "<a href=\"" + nav + "&ID=" + pId + "\" target=\"_blank\">" + "<div style=\"background-image:url(" + p.GetDefaultImageUrl(100, 100) + ")\" title=\"" + HtmlHelper.RemoveHtml(p.ProductName) + "\" >" + "</div>" + "</a>" + "</div>"); pn = HtmlHelper.RemoveHtml(p.ProductName); sb.AppendLine("<div class=\"piProductName\" title='" + pn + "'>" + GlobalSettings.SubString(pn, 15) + "</div>"); sb.AppendLine("<div class=\"piPrice\">" + GetPrice(p.ProductID) + "</div>"); sb.AppendLine("</td>"); if (i % _Columns == _Columns - 1) { sb.AppendLine("</tr>"); } } sb.AppendLine("</table>"); if (!_Cache.ContainsKey(_productID)) { lock (_lock) if (!_Cache.ContainsKey(_productID)) { if (_Cache.Count > maxCached) { _Cache.Clear(); } _Cache.Add(_productID, sb.ToString()); } } return(sb.ToString()); }
public string RenderHTML() { FocusType ft = (FocusType)_ProductType; if (_Cache.ContainsKey(ft) && DateTime.Now.Minute % 5 != 0) { return(_Cache[ft]); } if (_Cache.ContainsKey(ft)) { _Cache.Remove(ft); } ProductQuery pq = new ProductQuery(); pq.PageSize = int.MaxValue; pq.FocusType = _ProductType; pq.HasPublished = true; List <Product> ps = Products.GetProductList(pq); string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-product"; if (ps == null || ps.Count == 0) { switch (_ProductType) { case FocusType.New: return("<div class=\"nopiInfo\"><span>当前没有相应的新进产品信息!</span></div>"); case FocusType.Hot: return("<div class=\"nopiInfo\"><span>当前没有相应的热销产品信息!</span></div>"); case FocusType.Recommend: return("<div class=\"nopiInfo\"><span>当前没有相应的推荐产品信息!</span></div>"); case FocusType.Promotion: return("<div class=\"nopiInfo\"><span>当前没有相应的促销产品信息!</span></div>"); default: return("<div class=\"nopiInfo\"><span>当前没有相应的产品信息!</span></div>"); } } List <Product> psList = null; Product p = null; StringBuilder sb = new StringBuilder(); int curCount = ps.Count; psList = ps.GetRange(0, Math.Min(curCount, _Max)); sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">"); string pId = string.Empty; int length = psList.Count; for (int i = 0; i < psList.Count; i++) { p = psList[i]; if (i % _Columns == 0) { sb.AppendLine("<tr>"); } pId = GlobalSettings.Encrypt(p.ProductID.ToString()); sb.AppendLine("<td>"); sb.AppendLine("<div class=\"piThumbnail\">" + "<a href=\"" + nav + "&ID=" + pId + "\" target=\"_blank\">" + "<div style=\"background-image:url(" + p.GetDefaultImageUrl(100, 100) + ")\" title=\"" + p.ProductName + "\" >" + "</div>" + "</a>" + "</div>"); sb.AppendLine("<div class=\"piProductName\" title='" + p.ProductName + "'><a href=\"" + nav + "&ID=" + pId + "\" target=\"_blank\">" + GlobalSettings.SubString(p.ProductName, 15) + "</a></div>"); sb.AppendLine("<div class=\"piPrice\">" + GetPrice(p.ProductID) + "</div>"); sb.AppendLine("</td>"); if (i % _Columns == _Columns - 1) { sb.AppendLine("</tr>"); } } sb.AppendLine("</table>"); if (curCount > _Max) { sb.Append("<div class=\"list-more\"><a target=\"_blank\" href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-productfocus&&t=" + (int)this.ProductType + "\" title=\"查看全部。。。\"></a></div>"); } if (!_Cache.ContainsKey(ft)) { lock (_lock) if (!_Cache.ContainsKey(ft)) { _Cache.Add(ft, sb.ToString()); } } return(sb.ToString()); }
void BindProduct() { if (p == null) { p = GetProduct(); } pllProduct.ProductID = p.ProductID; ltProductName.Text = p.ProductName; ltDescription.Text = "最后更新:" + p.UpdateTime.ToShortDateString() + " 关键字:" + p.ProductKeywords; ltProductCode.Text = p.ProductID.ToString();//GetString(p.ProductCode); ltProductAbstract.Text = GetString(p.ProductAbstract); BindCategory(p.ProductID); BindIndustry(p.ProductID); BindBrand(p); BindPrice(p.ProductID); // ltProductName2.Text = p.ProductName; ltBrand2.Text = string.Format("<a target=\"_blank\" href=\"{0}pages/view.aspx?product-brand&ID={1}\">{2}</a>", GlobalSettings.RelativeWebRoot, GlobalSettings.Encrypt(p.BrandID.ToString()), p.BrandName); ltPAbstract.Text = p.ProductAbstract; ltProductDetails.Text = p.ProductContent; BindProperty(p.ProductID); List <ProductModel> models = ProductModels.GetModelsByProductID(p.ProductID); if (models.Count == 0) { rbModel.Visible = false; ltModel.Text = "——"; } else { ListItem li = null; foreach (ProductModel m in models) { li = new ListItem(m.ModelName, m.ModelID.ToString()); li.Attributes.Add("title", m.ModelDesc); rbModel.Items.Add(li); } rbModel.SelectedIndex = 0; } }
void BindBrand(Product p) { if (p.BrandID == 0 || string.IsNullOrEmpty(p.BrandName)) { ltBrand.Text = "无相关品牌"; } else { ProductBrand pb = ProductBrands.GetProductBrand(p.BrandID); //ltBrand.Text = "<b>" + pb.BrandName + "</b> " + pb.BrandContent; ltBrand.Text = string.Format("<a target=\"_blank\" href=\"{0}pages/view.aspx?product-brand&ID={1}\"><b>{2}</b></a>{3}", GlobalSettings.RelativeWebRoot, GlobalSettings.Encrypt(p.BrandID.ToString()), pb.BrandName, pb.BrandContent); } }
HtmlGenericControl BindIndustryList() { List <ProductIndustry> industriesTemp = ProductIndustries.GetProductIndustries(); List <ProductIndustry> industries = industriesTemp.GetRange(0, Math.Min(_Num, industriesTemp.Count)); if (industries.Count == 0) { HtmlGenericControl p = new HtmlGenericControl("P"); p.InnerText = "没有行业应用信息!"; return(p); } HtmlGenericControl ul = new HtmlGenericControl("ul"); ul.ID = "ulIndustryList"; HtmlGenericControl li = null; HtmlAnchor anchor = null; foreach (var b in industries) { li = new HtmlGenericControl("LI"); anchor = new HtmlAnchor(); anchor.HRef = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry&ID=" + GlobalSettings.Encrypt(b.IndustryID.ToString()); anchor.Target = "_blank"; anchor.InnerText = b.IndustryName; anchor.Title = b.IndustryTitle; li.Controls.Add(anchor); ul.Controls.Add(li); } return(ul); }