예제 #1
0
 public IList <ProductListModel> GetProductListModels(ProductListOptionsModel options)
 {
     using (var context = _contextFactory.CreateContext())
     {
         return(context.ProductBases
                .AsNoTracking()
                .FilterBy(options)
                .OrderBy(p => p.ProductBaseCode)
                .ProjectBetween <ProductBase, ProductListModel>()
                .ToList());
     }
 }
예제 #2
0
        public static IQueryable <ProductBase> FilterBy(this IQueryable <ProductBase> productBases, ProductListOptionsModel options)
        {
            Expression <Func <ProductBase, bool> > filter =
                pb => (options.BusinessLineId == null || pb.BusinessLineId == options.BusinessLineId) &&
                (options.ProductStatusId == null || pb.ProductStatusId == options.ProductStatusId) &&
                (options.ProductSourceTypeId == null || pb.ProductSourceTypeId == options.ProductSourceTypeId) &&
                (options.ProductDestinationTypeId == null || pb.ProductDestinationTypeId == options.ProductDestinationTypeId) &&
                (options.ProductMaterialId == null || pb.ProductMaterialId == options.ProductMaterialId) &&
                (options.ProductTypeId == null || pb.ProductTypeId == options.ProductTypeId) &&
                (options.ProductGroupId == null || pb.ProductGroupId == options.ProductGroupId) &&
                (options.ProductBrandId == null || pb.ProductBrandId == options.ProductBrandId) &&
                (options.ProductCollectionId == null || pb.ProductCollectionId == options.ProductCollectionId) &&
                (options.ProductDesignId == null || pb.ProductDesignId == options.ProductDesignId);

            return(productBases.Where(filter));
        }
예제 #3
0
 private void InitializeOptionsModel()
 {
     OptionsModel = _service.GetProductListOptionsModel();
     OptionsModel.OptionChanged += ClearItems;
 }