Ejemplo n.º 1
0
        public IQueryable<ProductVariant> Get(LowStockReportSearchModel searchModel)
        {
            IQueryable<ProductVariant> queryOver =
                _session.Query<ProductVariant>().Where(variant => variant.TrackingPolicy == TrackingPolicy.Track);

            if (_ecommerceSettings.WarehouseStockEnabled)
            {
                queryOver =
                    queryOver.Where(
                        variant => variant.WarehouseStock.Sum(stock => stock.StockLevel) <= searchModel.Threshold);
            }
            else
            {
                queryOver = queryOver.Where(variant => variant.StockRemaining <= searchModel.Threshold);
            }
            return queryOver.Cacheable();
        }
Ejemplo n.º 2
0
 public ExportStockReportResult ExportLowStockReport(LowStockReportSearchModel searchModel)
 {
     try
     {
         List<ProductVariant> items = _getLowStockQuery.Get(searchModel).ToList();
         return new ExportStockReportResult
         {
             FileResult = GetLowStockFileResult(_getStockReportFile.GetFile(items)),
             Success = true
         };
     }
     catch (Exception exception)
     {
         CurrentRequestData.ErrorSignal.Raise(exception);
         return new ExportStockReportResult
         {
             Message =
                 _stringResourceProvider.GetValue("Export Low Stock Report Failed",
                     "Low Stock Report exporting has failed. Please try again and contact system administration if error continues to appear.")
         };
     }
 }
Ejemplo n.º 3
0
        public IPagedList<ProductVariant> Search(LowStockReportSearchModel searchModel)
        {
            IQueryable<ProductVariant> queryOver = _getLowStockQuery.Get(searchModel);

            return queryOver.Paged(searchModel.Page);
        }