示例#1
0
 public static IList<ProductGroup> GetAllChildProductsGroup(ProductGroup prodGroup)
 {
     IList<ProductGroup> result = GetSubProductsGroups(prodGroup);
     foreach (ProductGroup prodGr in result)
     {
         IList<ProductGroup> subProd = GetAllChildProductsGroup(prodGr);
         result = result.Concat(subProd).ToList();
     }
     return result;
 }
示例#2
0
        public static IList<Product> GetProducts(string productCode, string productName, ProductGroup productGroup, Manufacturer manufacturer)
        {
            var result = productRepository.GetQueryable().Where(p => p.Name.Contains(productName)
                && p.Code.Contains(productCode)).AsEnumerable();
            if (manufacturer != null)
            {
                result = from p in result
                         where p.Manufacturer == manufacturer
                         select p;
            }

            if (productGroup != null)
            {
                IList<ProductGroup> allProductsGroups = GetAllChildProductsGroup(productGroup);
                allProductsGroups.Add(productGroup);
                var productGroupsId = from pG in allProductsGroups
                                      select pG.ProductGroupID;

                result = from p in result
                         where productGroupsId.Contains(p.ProductGroup.ProductGroupID)
                         select p;
            }
            return result.ToList();
        }
示例#3
0
 public static IList<ProductGroup> GetSubProductsGroups(ProductGroup parent)
 {
     //if (prodGroupId == Guid.Empty)
     //    return null;
     return productRepository.GetSubProductsGroups(parent);
 }