public IResult <IQueryable <IInventoryShipmentOrderSummaryReturn> > GetInterWarehouseOrders(FilterInterWarehouseOrderParameters parameters)
        {
            var predicate = parameters.ParseToPredicate();

            if (!predicate.Success)
            {
                return(predicate.ConvertTo <IQueryable <IInventoryShipmentOrderSummaryReturn> >());
            }
            var select = InventoryShipmentOrderProjectors.SelectInventoryShipmentOrderSummary();
            var query  = _inventoryShipmentOrderUnitOfWork.InventoryShipmentOrderRepository.Filter(predicate.ResultingObject).AsExpandable().Select(select);

            return(new SuccessResult <IQueryable <IInventoryShipmentOrderSummaryReturn> >(query));
        }
        internal static IResult <Expression <Func <InventoryShipmentOrder, bool> > > ParseToPredicate(this FilterInterWarehouseOrderParameters parameters)
        {
            var predicate = InventoryShipmentOrderPredicates.ByOrderType(InventoryShipmentOrderTypeEnum.InterWarehouseOrder);

            if (parameters != null)
            {
                if (parameters.OriginFacilityKey != null)
                {
                    var facilityKey = KeyParserHelper.ParseResult <IFacilityKey>(parameters.OriginFacilityKey);
                    if (!facilityKey.Success)
                    {
                        return(facilityKey.ConvertTo <Expression <Func <InventoryShipmentOrder, bool> > >());
                    }

                    predicate = predicate.And(InventoryShipmentOrderPredicates.ByOriginFacility(new FacilityKey(facilityKey.ResultingObject)).ExpandAll());
                }

                if (parameters.DestinationFacilityKey != null)
                {
                    var facilityKey = KeyParserHelper.ParseResult <IFacilityKey>(parameters.DestinationFacilityKey);
                    if (!facilityKey.Success)
                    {
                        return(facilityKey.ConvertTo <Expression <Func <InventoryShipmentOrder, bool> > >());
                    }

                    predicate = predicate.And(InventoryShipmentOrderPredicates.ByDestinationFacility(new FacilityKey(facilityKey.ResultingObject)).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <InventoryShipmentOrder, bool> > >(predicate));
        }
Пример #3
0
 public IResult <IQueryable <IInventoryShipmentOrderSummaryReturn> > GetWarehouseOrders(FilterInterWarehouseOrderParameters parameters = null)
 {
     try
     {
         return(_warehouseOrderServiceProvider.GetInterWarehouseOrders(parameters));
     }
     catch (Exception ex)
     {
         _exceptionLogger.LogException(ex);
         return(new FailureResult <IQueryable <IInventoryShipmentOrderSummaryReturn> >(null, ex.Message));
     }
 }