/// <summary> /// 商品统计 /// </summary> /// <param name="productName">商品名称</param> /// <param name="storeName">店铺名称</param> /// <param name="categoryName">分类名称</param> /// <param name="brandName">品牌名称</param> /// <param name="storeId">店铺id</param> /// <param name="cateId">分类id</param> /// <param name="brandId">品牌id</param> /// <param name="pageNumber">当前页数</param> /// <param name="pageSize">每页数</param> /// <returns></returns> public ActionResult ProductStat(string productName, string storeName, string categoryName, string brandName, int storeId = -1, int cateId = -1, int brandId = -1, int pageNumber = 1, int pageSize = 15) { string condition = AdminProducts.AdminGetProductListCondition(storeId, 0, productName, cateId, brandId, -1); PageModel pageModel = new PageModel(pageSize, pageNumber, AdminProducts.AdminGetProductCount(condition)); DataTable productList = AdminProducts.AdminGetProductList(pageModel.PageSize, pageModel.PageNumber, condition); StringBuilder pidList = new StringBuilder(); foreach (DataRow row in productList.Rows) { pidList.AppendFormat("{0},", row["pid"]); } ProductStatModel model = new ProductStatModel() { PageModel = pageModel, ProductList = pidList.Length > 0 ? AdminProducts.GetProductSummaryList(pidList.Remove(pidList.Length - 1, 1).ToString()) : new DataTable(), ProductName = productName, StoreId = storeId, StoreName = string.IsNullOrWhiteSpace(storeName) ? "全部店铺" : storeName, CateId = cateId, CategoryName = string.IsNullOrWhiteSpace(categoryName) ? "全部分类" : categoryName, BrandId = brandId, BrandName = string.IsNullOrWhiteSpace(brandName) ? "全部品牌" : brandName }; return(View(model)); }
/// <summary> /// 商品统计 /// </summary> /// <param name="productName">商品名称</param> /// <param name="categoryName">分类名称</param> /// <param name="brandName">品牌名称</param> /// <param name="storeCid">店铺分类id</param> /// <param name="cateId">分类id</param> /// <param name="brandId">品牌id</param> /// <param name="pageNumber">当前页数</param> /// <param name="pageSize">每页数</param> /// <returns></returns> public ActionResult ProductStat(string productName, string categoryName, string brandName, int storeCid = -1, int cateId = -1, int brandId = -1, int pageNumber = 1, int pageSize = 15) { string condition = AdminProducts.AdminGetProductListCondition(WorkContext.StoreId, storeCid, productName, cateId, brandId, -1); PageModel pageModel = new PageModel(pageSize, pageNumber, AdminProducts.AdminGetProductCount(condition)); DataTable productList = AdminProducts.AdminGetProductList(pageModel.PageSize, pageModel.PageNumber, condition); StringBuilder pidList = new StringBuilder(); foreach (DataRow row in productList.Rows) { pidList.AppendFormat("{0},", row["pid"]); } List <SelectListItem> storeClassList = new List <SelectListItem>(); storeClassList.Add(new SelectListItem() { Text = "全部店铺分类", Value = "0" }); foreach (StoreClassInfo storeClassInfo in AdminStores.GetStoreClassList(WorkContext.StoreId)) { storeClassList.Add(new SelectListItem() { Text = storeClassInfo.Name, Value = storeClassInfo.StoreCid.ToString() }); } ProductStatModel model = new ProductStatModel() { PageModel = pageModel, ProductList = pidList.Length > 0 ? AdminProducts.GetProductSummaryList(pidList.Remove(pidList.Length - 1, 1).ToString()) : new DataTable(), ProductName = productName, StoreCid = storeCid, StoreClassList = storeClassList, CateId = cateId, CategoryName = string.IsNullOrWhiteSpace(categoryName) ? "全部分类" : categoryName, BrandId = brandId, BrandName = string.IsNullOrWhiteSpace(brandName) ? "全部品牌" : brandName }; return(View(model)); }