private void InitConditionItems(int cateId) { BrandCategoryRelationBll bcrbll = new BrandCategoryRelationBll(); this.cblBrands.DataSource = bcrbll.GetCategoryBrandList(cateId); this.cblBrands.DataTextField = "BrandName"; this.cblBrands.DataValueField = "BrandId"; this.cblBrands.DataBind(); NoName.NetShop.Product.BLL.CategoryModelBll cbll = new CategoryModelBll(); this.cblSubCate.DataSource = cbll.GetSubCategory(cateId); this.cblSubCate.DataTextField = "CateName"; this.cblSubCate.DataValueField = "CateId"; this.cblSubCate.DataBind(); CategoryParaModelBll cpbll = new CategoryParaModelBll(); List<CategoryParaModel> plist = cpbll.GetModelList("status=1 and paratype=1 and cateid=" + cateId); rpItems.DataSource = plist; rpItems.DataBind(); }
private void ShowProducts(string pids) { ProductModelBll pbll = new ProductModelBll(); List<ProductModel> plist = pbll.GetModelList("productId in (" + pids + ")"); string[] vals = (from p in plist select p.ProductName).ToArray(); AddTH("<span>产品基本情况</span>", plist.Count + 1); AddTR("商品名称", (from p in plist orderby p.ProductId select p.ProductName).ToArray(), true); AddTR("产品图片", (from p in plist orderby p.ProductId select "<img class='productPi' src='" + p.SmallImage + "'/>").ToArray(), false); AddTR("产品编号", (from p in plist orderby p.ProductId select p.ProductId.ToString()).ToArray(), false); AddTR("市场价", (from p in plist orderby p.ProductId select p.TradePrice.ToString("F2")).ToArray(), false); AddTR("鼎鼎价", (from p in plist orderby p.ProductId select p.MerchantPrice.ToString("F2")).ToArray(), false); AddTR("库存状态", (from p in plist orderby p.ProductId select p.Stock > 0 ? "现货" : "补货中").ToArray(), false); AddTH("<span>详细参数</span>", plist.Count + 1); int cateNum = (from p in plist select p.CateId).Distinct().ToArray().Length; if (cateNum > 1) { AddTR("商品不属于同一个分类,无法比较", plist.Count + 1); } else { int cateId = plist[0].CateId; CategoryParaModelBll pabll = new CategoryParaModelBll(); List<CategoryParaModel> cplist = pabll.GetModelList("cateId=" + cateId); ProductParaModelBll ppabll = new ProductParaModelBll(); List<ProductParaModel> ppalist = ppabll.GetModelList("productId in (" + pids + ")"); foreach (CategoryParaModel cpmodel in cplist) { string title = cpmodel.ParaName; string[] pvals = (from p in ppalist where p.ParaId == cpmodel.ParaId orderby p.ProductId select p.ParaValue).ToArray(); AddTR(title, pvals, false); } } }