Example #1
0
        internal static IEnumerable <Expression <Func <Lot, LotQualitySingleSummaryReturn> > > SplitSelectSingleLotSummary(ILotUnitOfWork lotUnitOfWork, DateTime currentDate)
        {
            var attributeNames = AttributeNameProjectors.SelectActiveAttributeNames(lotUnitOfWork);

            return(SplitSelectLotQualitySummary(lotUnitOfWork, currentDate)
                   .Select(p => Projector <Lot> .To(l => new LotQualitySingleSummaryReturn
            {
                LotSummary = p.Invoke(l)
            }).ExpandAll())
                   .ToAppendedList(Projector <Lot> .To(l => new LotQualitySingleSummaryReturn
            {
                AttributesByTypeReturn = new AttributesByTypeReturn
                {
                    AttributeNamesAndTypes = attributeNames.Invoke()
                }
            })));
        }
        internal static IEnumerable <Expression <Func <PickedInventory, PickedInventoryReturn> > > SplitSelectDetail(IInventoryUnitOfWork inventoryUnitOfWork, DateTime currentDate, ISalesUnitOfWork salesUnitOfWork = null)
        {
            if (inventoryUnitOfWork == null)
            {
                throw new ArgumentNullException("inventoryUnitOfWork");
            }

            var attributeNames = AttributeNameProjectors.SelectActiveAttributeNames(inventoryUnitOfWork);
            var itemSelector   = PickedInventoryItemProjectors.SplitSelect(inventoryUnitOfWork, currentDate, salesUnitOfWork);

            return(new Projectors <PickedInventory, PickedInventoryReturn>
            {
                SelectBase().Merge(i => new PickedInventoryReturn
                {
                    AttributeNamesAndTypes = attributeNames.Invoke()
                }),
                { itemSelector, s => i => new PickedInventoryReturn
                  {
                      PickedInventoryItems = i.Items.Select(m => s.Invoke(m))
                  } }
            });
        }