internal static IEnumerable <Expression <Func <SalesOrder, SalesOrderDetailReturn> > > SplitSelectDetail(IInventoryShipmentOrderUnitOfWork inventoryUnitOfWork, DateTime currentDate)
        {
            var company = CompanyProjectors.SelectSummary();

            return(new Projectors <SalesOrder, SalesOrderDetailReturn>
            {
                { InventoryShipmentOrderProjectors.SplitSelectInventoryShipmentOrderDetailBase(inventoryUnitOfWork, currentDate, InventoryOrderEnum.CustomerOrder, inventoryUnitOfWork), p => p.Translate().To <SalesOrder, SalesOrderDetailReturn>(o => o.InventoryShipmentOrder) },
                o => new SalesOrderDetailReturn
                {
                    IsMiscellaneous = o.InventoryShipmentOrder.OrderType == InventoryShipmentOrderTypeEnum.MiscellaneousOrder,
                    SalesOrderStatus = o.OrderStatus,
                    PaymentTerms = o.PaymentTerms,
                    ShipFromReplace = o.SoldTo,
                    CreditMemo = o.CreditMemo,
                    InvoiceDate = o.InvoiceDate,
                    InvoiceNotes = o.InvoiceNotes,
                    FreightCharge = o.FreightCharge,

                    Customer = new[] { o.Customer }.Where(c => c != null).Select(c => company.Invoke(c.Company)).FirstOrDefault(),
                    Broker = new[] { o.Broker }.Where(b => b != null).Select(b => company.Invoke(b)).FirstOrDefault()
                },
                { SplitSelectPickOrderDetail(), p => o => new SalesOrderDetailReturn
                  {
                      PickOrder = p.Invoke(o)
                  } }
            });
        }
Beispiel #2
0
        internal static Expression <Func <TreatmentOrder, TreatmentOrderSummaryReturn> > SelectSummary()
        {
            var treatment = InventoryTreatmentProjectors.SelectInventoryTreatment();

            return(InventoryShipmentOrderProjectors.SelectInventoryShipmentOrderSummary().Merge(Projector <TreatmentOrder> .To(t => new TreatmentOrderSummaryReturn
            {
                Returned = t.Returned,
                InventoryTreatment = treatment.Invoke(t.Treatment)
            }), t => t.InventoryShipmentOrder));
        }
Beispiel #3
0
        internal static IEnumerable <Expression <Func <TreatmentOrder, TreatmentOrderDetailReturn> > > SplitSelectDetail(ITreatmentOrderUnitOfWork treatmentOrderUnitOfWork, DateTime currentDate)
        {
            if (treatmentOrderUnitOfWork == null)
            {
                throw new ArgumentNullException("treatmentOrderUnitOfWork");
            }

            var treatment = InventoryTreatmentProjectors.SelectInventoryTreatment();

            return(new Projectors <TreatmentOrder, TreatmentOrderDetailReturn>
            {
                { InventoryShipmentOrderProjectors.SplitSelectInventoryShipmentOrderDetail(treatmentOrderUnitOfWork, currentDate, InventoryOrderEnum.Treatments), p => p.Translate().To <TreatmentOrder, TreatmentOrderDetailReturn>(t => t.InventoryShipmentOrder) },
                t => new TreatmentOrderDetailReturn
                {
                    Returned = t.Returned,
                    InventoryTreatment = treatment.Invoke(t.Treatment)
                }
            });
        }
        internal static IEnumerable <Expression <Func <SalesOrder, SalesOrderSummaryReturn> > > SplitSelectSummary()
        {
            var company = CompanyProjectors.SelectSummary();

            return(new Projectors <SalesOrder, SalesOrderSummaryReturn>
            {
                InventoryShipmentOrderProjectors.SelectInventoryShipmentOrderSummary().Translate().To <SalesOrder, SalesOrderSummaryReturn>(c => c.InventoryShipmentOrder),
                c => new SalesOrderSummaryReturn
                {
                    SalesOrderStatus = c.OrderStatus,
                    PaymentTerms = c.PaymentTerms,
                    DateOrderReceived = c.InventoryShipmentOrder.DateReceived,
                    InvoiceDate = c.InvoiceDate,
                    CreditMemo = c.CreditMemo,
                    Customer = new[] { c.Customer }.Where(u => u != null).Select(u => company.Invoke(u.Company)).FirstOrDefault(),
                    Broker = new[] { c.Broker }.Where(b => b != null).Select(b => company.Invoke(b)).FirstOrDefault()
                }
            });
        }