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); } } }