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); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <ProductIndustry> industries = ProductIndustries.GetProductIndustries(); rpTrade.DataSource = industries; rpTrade.DataBind(); } }
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 GetCategories(int pId) { List <ProductIndustry> inds = ProductIndustries.GetProductIndustries(); List <ProductIndustry> _inds = new List <ProductIndustry>(); foreach (ProductIndustry pi in inds) { if (pi.ParentID == pId) { _inds.Add(pi); } } return(Newtonsoft.Json.JavaScriptConvert.SerializeObject(_inds)); }
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; }