internal static IEnumerable <Expression <Func <InventoryShipmentOrder, InventoryShipmentOrderDetailBaseReturn> > > SplitSelectInventoryShipmentOrderDetailBase(IInventoryUnitOfWork inventoryUnitOfWork, DateTime currentDate, InventoryOrderEnum inventoryOrder, ISalesUnitOfWork salesUnitOfWork = null)
        {
            if (inventoryUnitOfWork == null)
            {
                throw new ArgumentNullException("inventoryUnitOfWork");
            }

            var pickedInventory = PickedInventoryProjectors.SplitSelectDetail(inventoryUnitOfWork, currentDate, salesUnitOfWork);
            var shipmentInfo    = ShipmentInformationProjectors.SelectDetail(inventoryOrder);

            return(new Projectors <InventoryShipmentOrder, InventoryShipmentOrderDetailBaseReturn>
            {
                SelectShipmentOrderBase().Merge(o => new InventoryShipmentOrderDetailBaseReturn
                {
                    PurchaseOrderNumber = o.PurchaseOrderNumber,
                    DateOrderReceived = o.DateReceived,
                    OrderRequestedBy = o.RequestedBy,
                    OrderTakenBy = o.TakenBy
                }),
                { pickedInventory, s => i => new InventoryShipmentOrderDetailBaseReturn
                  {
                      PickedInventory = s.Invoke(i.PickedInventory)
                  } },
                i => new InventoryShipmentOrderDetailBaseReturn
                {
                    Shipment = shipmentInfo.Invoke(i.ShipmentInformation)
                }
            });
        }
        public static Expression <Func <SalesQuote, SalesQuoteDetailReturn> > SelectDetail()
        {
            var key      = SelectKey();
            var shipment = ShipmentInformationProjectors.SelectDetail(InventoryOrderEnum.Unknown);
            var facility = FacilityProjectors.Select(false, false);
            var company  = CompanyProjectors.SelectSummary();
            var item     = SalesQuoteItemProjectors.Select();

            return(Projector <SalesQuote> .To(q => new SalesQuoteDetailReturn
            {
                SalesQuoteKeyReturn = key.Invoke(q),
                QuoteNumber = q.QuoteNum,
                QuoteDate = q.QuoteDate,
                DateReceived = q.DateReceived,
                CalledBy = q.CalledBy,
                TakenBy = q.TakenBy,
                PaymentTerms = q.PaymentTerms,
                ShipFromReplace = q.SoldTo,
                Shipment = shipment.Invoke(q.ShipmentInformation),

                SourceFacility = new[] { q.SourceFacility }.Where(f => f != null).Select(f => facility.Invoke(f)).FirstOrDefault(),
                Customer = new[] { q.Customer }.Where(c => c != null).Select(c => company.Invoke(c.Company)).FirstOrDefault(),
                Broker = new[] { q.Broker }.Where(b => b != null).Select(b => company.Invoke(b)).FirstOrDefault(),
                Items = q.Items.Select(i => item.Invoke(i))
            }));
        }