Пример #1
0
        public IResult <IQueryable <IInventoryTransactionReturn> > GetInventoryReceived(GetInventoryReceivedParameters parameters)
        {
            var predicate = InventoryTransactionPredicates.ByTransactionType(InventoryTransactionType.ReceiveInventory);

            if (parameters != null)
            {
                if (parameters.LotKey != null)
                {
                    var lotKeyResult = KeyParserHelper.ParseResult <ILotKey>(parameters.LotKey);
                    if (!lotKeyResult.Success)
                    {
                        return(lotKeyResult.ConvertTo <IQueryable <IInventoryTransactionReturn> >());
                    }

                    predicate = predicate.And(InventoryTransactionPredicates.BySourceLot(lotKeyResult.ResultingObject.ToLotKey()));
                }
                else if (parameters.LotType != null)
                {
                    predicate = predicate.And(InventoryTransactionPredicates.BySourceLotType(parameters.LotType.Value));
                }

                if (parameters.DateReceivedStart != null)
                {
                    predicate = predicate.And(InventoryTransactionPredicates.ByDateReceivedRangeStart(parameters.DateReceivedStart.Value));
                }

                if (parameters.DateReceivedEnd != null)
                {
                    predicate = predicate.And(InventoryTransactionPredicates.ByDateReceivedRangeEnd(parameters.DateReceivedEnd.Value));
                }
            }

            var select = InventoryTransactionProjectors.Select(_inventoryUnitOfWork);

            var results = _inventoryUnitOfWork.InventoryTransactionsRepository
                          .Filter(predicate)
                          .AsExpandable()
                          .Select(select);

            return(new SuccessResult <IQueryable <IInventoryTransactionReturn> >(results));
        }
Пример #2
0
 public IResult <IQueryable <IInventoryTransactionReturn> > GetInventoryReceived(GetInventoryReceivedParameters parameters)
 {
     try
     {
         return(_inventoryServiceProvider.GetInventoryReceived(parameters));
     }
     catch (Exception ex)
     {
         _exceptionLogger.LogException(ex);
         return(new FailureResult <IQueryable <IInventoryTransactionReturn> >(null, ex.Message));
     }
 }