/// <summary> /// /// </summary> /// <param name="bType">板材/五金/地板</param> /// <param name="typeName">商品类型</param> /// <param name="productType">筛选类型</param> /// <param name="pageIndex">当前页码 </param> /// <param name="pageSize">每页数据量</param> /// <returns></returns> public List <ProductDto> ListProductByPage(ProductPageAndFilterDto ppfd) { var products = ListProductAll(); if (ppfd.ProductTypes != null && ppfd.ProductTypes.Count > 0) { var bzgg = ppfd.ProductTypes.ContainsKey("ProductBZGG") ? ppfd.ProductTypes["ProductBZGG"] : null; ppfd.ProductTypes.TryGetValue("ProductCD", out string cd); ppfd.ProductTypes.TryGetValue("ProductPP", out string pp); ppfd.ProductTypes.TryGetValue("ProductXH", out string xh); ppfd.ProductTypes.TryGetValue("ProductCZ", out string cz); ppfd.ProductTypes.TryGetValue("ProductHB", out string hb); ppfd.ProductTypes.TryGetValue("ProductHD", out string hd); ppfd.ProductTypes.TryGetValue("ProductGY", out string gy); ppfd.ProductTypes.TryGetValue("ProductHS", out string hs); ppfd.ProductTypes.TryGetValue("ProductMC", out string mc); ppfd.ProductTypes.TryGetValue("ProductDJ", out string dj); ppfd.ProductTypes.TryGetValue("ProductGG", out string gg); ppfd.ProductTypes.TryGetValue("ProductYS", out string ys); products = products.FindAll(m => (bzgg == null || m.ProductBZGG == bzgg) && (cd == null || m.ProductCD == cd) && (pp == null || m.ProductPP == pp) && (xh == null || m.ProductXH == xh) && (cz == null || m.ProductCZ == cz) && (hb == null || m.ProductHB == hb) && (hd == null || m.ProductHD == hd) && (gy == null || m.ProductGY == gy) && (hs == null || m.ProductHS == hs) && (mc == null || m.ProductMC == mc) && (dj == null || m.ProductDJ == dj) && (gg == null || m.ProductGG == gg) && (ys == null || m.ProductYS == ys)); } return(GetFullProductDto(products .FindAll(m => m.BelongTypeNo == ppfd.BType && (m.TypeName == ppfd.TypeName || String.IsNullOrEmpty(ppfd.TypeName) && m.ProductName.Contains(ppfd.SearchText == null?"": ppfd.SearchText))) .Skip((ppfd.PageIndex - 1) * ppfd.PageSize) .Take(ppfd.PageSize).ToList())); }
public List <ProductDto> GetAll(string bType, string typeName, string productTypes, string searchText, int pageIndex, int pageSize) { Dictionary <string, string> dic = new Dictionary <string, string>(); if (productTypes != null && !string.IsNullOrEmpty(productTypes)) { foreach (var productType in productTypes.Split("%5E")) { dic.Add(productType.Split('_')[0], productType.Split('_')[1]); } } var ppfd = new ProductPageAndFilterDto { BType = bType, ProductTypes = dic, TypeName = typeName == "空" ? null : typeName, SearchText = searchText, PageIndex = pageIndex, PageSize = pageSize }; return(_productServer.ListProductByPage(ppfd)); }