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))
            }));
        }
Esempio n. 2
0
        internal static IEnumerable <Expression <Func <PackSchedule, ProductionPacketReturn> > > SplitSelectProductionPacket(IInventoryUnitOfWork inventoryUnitOfWork, DateTime currentDate, ILotKey batchKey = null)
        {
            var packScheduleKey          = SelectKey();
            var companyHeader            = CompanyProjectors.SelectHeader();
            var workType                 = WorkTypeProjectors.Select();
            var chileProduct             = ProductProjectors.SelectProduct();
            var productKeyName           = ProductProjectors.SelectProductKeyName();
            var productionBatchPredicate = batchKey != null?ProductionBatchPredicates.ByLotKey(batchKey) : b => true;

            return(ProductionBatchProjectors.SplitSelectProductionPacket(inventoryUnitOfWork, currentDate)
                   .Select(b => Projector <PackSchedule> .To(p => new ProductionPacketReturn
            {
                Batches = p.ProductionBatches.Where(a => productionBatchPredicate.Invoke(a)).Select(a => b.Invoke(a))
            }))
                   .ToAppendedList(Projector <PackSchedule> .To(p => new ProductionPacketReturn
            {
                PackScheduleKeyReturn = packScheduleKey.Invoke(p),
                PSNum = p.PSNum,
                DateCreated = p.DateCreated,
                SummaryOfWork = p.SummaryOfWork
            }),
                                   Projector <PackSchedule> .To(p => new ProductionPacketReturn
            {
                ChileProduct = chileProduct.Invoke(p.ChileProduct.Product),
                PackagingProduct = productKeyName.Invoke(p.PackagingProduct.Product)
            }),
                                   Projector <PackSchedule> .To(p => new ProductionPacketReturn
            {
                ProductionLineDescription = p.ProductionLineLocation.Description,
                WorkType = workType.Invoke(p.WorkType),
                Customer = new[] { p.Customer }.Where(c => c != null).Select(c => companyHeader.Invoke(c.Company)).FirstOrDefault()
            })));
        }
        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)
                  } }
            });
        }
Esempio n. 4
0
        private static IEnumerable <Expression <Func <Contract, ContractBaseReturn> > > SelectContractBase()
        {
            var key       = SelectKey();
            var company   = CompanyProjectors.SelectSummary();
            var warehouse = FacilityProjectors.Select(false, true);

            return(new[]
            {
                Projector <Contract> .To(c => new ContractBaseReturn
                {
                    ContractKeyReturn = key.Invoke(c),

                    CustomerPurchaseOrder = c.CustomerPurchaseOrder,
                    ContractNumber = c.ContractId,
                    ContractDate = c.ContractDate,
                    TermBegin = c.TermBegin,
                    TermEnd = c.TermEnd,
                    PaymentTerms = c.PaymentTerms,
                    ContactName = c.ContactName,
                    FOB = c.FOB,

                    ContractType = c.ContractType,
                    ContractStatus = c.ContractStatus,

                    DefaultPickFromFacility = warehouse.Invoke(c.DefaultPickFromFacility)
                }),
                Projector <Contract> .To(c => new ContractBaseReturn
                {
                    Customer = company.Invoke(c.Customer.Company),
                    Broker = company.Invoke(c.Broker),
                })
            });
        }
Esempio n. 5
0
        internal static IEnumerable <Expression <Func <InventoryPickOrderItem, InventoryPickOrderItemReturn> > > SplitSelect()
        {
            var key                   = SelectKey();
            var productKey            = ProductProjectors.SelectProductKey();
            var inventoryTreatmentKey = InventoryTreatmentProjectors.SelectInventoryTreatmentKey();
            var company               = CompanyProjectors.SelectHeader();

            return(new Projectors <InventoryPickOrderItem, InventoryPickOrderItemReturn>
            {
                i => new InventoryPickOrderItemReturn
                {
                    InventoryPickOrderItemKeyReturn = key.Invoke(i),
                    ProductKeyReturn = productKey.Invoke(i.Product),
                    ProductName = i.Product.Name,
                    ProductCode = i.Product.ProductCode,
                    TreatmentNameShort = i.InventoryTreatment.ShortName,
                    InventoryTreatmentKeyReturn = inventoryTreatmentKey.Invoke(i.InventoryTreatment),
                    Quantity = i.Quantity,
                    CustomerLotCode = i.CustomerLotCode,
                    CustomerProductCode = i.CustomerProductCode
                },
                i => new InventoryPickOrderItemReturn
                {
                    PackagingProductKeyReturn = productKey.Invoke(i.PackagingProduct.Product),
                    PackagingName = i.PackagingProduct.Product.Name,
                    PackagingWeight = i.PackagingProduct.Weight,
                    TotalWeight = i.PackagingProduct.Weight * i.Quantity
                },
                i => new InventoryPickOrderItemReturn
                {
                    Customer = new [] { i.Customer }.Where(c => c != null).Select(c => company.Invoke(c.Company)).FirstOrDefault()
                }
            });
        }
Esempio n. 6
0
        internal static Expression <Func <Customer, CustomerNotesReturn> > SelectNotes()
        {
            var note = CustomerNoteProjectors.Select();

            return(CompanyProjectors.SelectHeader().Merge(Projector <Customer> .To(c => new CustomerNotesReturn
            {
                CustomerNotes = c.Notes.Select(n => note.Invoke(n))
            }), c => c.Company));
        }
Esempio n. 7
0
        internal static IEnumerable <Expression <Func <SampleOrder, SampleOrderDetailReturn> > > SelectDetail()
        {
            var key      = SelectKey();
            var company  = CompanyProjectors.SelectHeader();
            var employee = EmployeeProjectors.SelectSummary();
            var item     = SampleOrderItemProjectors.Select();
            var journal  = SampleOrderJournalEntryProjectors.Select();

            return(new Projectors <SampleOrder, SampleOrderDetailReturn>
            {
                s => new SampleOrderDetailReturn
                {
                    DateDue = s.DateDue,
                    DateReceived = s.DateReceived,
                    DateCompleted = s.DateCompleted,
                    Status = s.Status,
                    Active = s.Active,
                    FOB = s.FOB,
                    ShipVia = s.ShipmentMethod,

                    RequestedByShippingLabel = s.Request,
                    ShipToCompany = s.ShipToCompany,
                    ShipToShippingLabel = s.ShipTo,

                    Comments = s.Comments,
                    NotesToPrint = s.PrintNotes,

                    SampleOrderKeyReturn = key.Invoke(s),
                },
                s => new SampleOrderDetailReturn
                {
                    RequestedByCompany = new [] { s.RequestCustomer }.Where(c => c != null).Select(c => company.Invoke(c.Company)).FirstOrDefault(),
                    Broker = new [] { s.Broker }.Where(c => c != null).Select(c => company.Invoke(c)).FirstOrDefault(),
                    CreatedByUser = employee.Invoke(s.Employee),
                },
                s => new SampleOrderDetailReturn
                {
                    Items = s.Items.Select(i => item.Invoke(i))
                },
                s => new SampleOrderDetailReturn
                {
                    JournalEntries = s.JournalEntries.Select(j => journal.Invoke(j))
                }
            });
        }
        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()
                }
            });
        }
Esempio n. 9
0
        internal static Expression <Func <SampleOrder, SampleOrderSummaryReturn> > SelectSummary()
        {
            var key      = SelectKey();
            var company  = CompanyProjectors.SelectHeader();
            var employee = EmployeeProjectors.SelectSummary();

            return(Projector <SampleOrder> .To(s => new SampleOrderSummaryReturn
            {
                DateDue = s.DateDue,
                DateReceived = s.DateReceived,
                DateCompleted = s.DateCompleted,
                Status = s.Status,

                RequestedByCompany = new [] { s.RequestCustomer }.Where(c => c != null).Select(c => company.Invoke(c.Company)).FirstOrDefault(),
                Broker = new [] { s.Broker }.Where(c => c != null).Select(c => company.Invoke(c)).FirstOrDefault(),
                CreatedByUser = employee.Invoke(s.Employee),

                SampleOrderKeyReturn = key.Invoke(s),
            }));
        }
        private static Expression <Func <ChileMaterialsReceived, ChileMaterialsReceivedReturn> > SelectBase()
        {
            var key          = LotProjectors.SelectLotKey <ChileMaterialsReceived>();
            var chileProduct = ProductProjectors.SelectChileProductSummary();
            var company      = CompanyProjectors.SelectSummary();
            var treatment    = InventoryTreatmentProjectors.SelectInventoryTreatment();

            return(Projector <ChileMaterialsReceived> .To(m => new ChileMaterialsReceivedReturn
            {
                DateReceived = m.DateReceived,
                LoadNumber = m.LoadNumber,
                PurchaseOrder = m.ChileLot.Lot.PurchaseOrderNumber,
                ShipperNumber = m.ChileLot.Lot.ShipperNumber,

                ChileProduct = chileProduct.Invoke(m.ChileProduct),
                Supplier = company.Invoke(m.Supplier),
                Treatment = treatment.Invoke(m.InventoryTreatment),

                LotKeyReturn = key.Invoke(m),
            }));
        }
Esempio n. 11
0
        internal static Expression <Func <Customer, CompanySummaryReturn> > SelectCompanySummary()
        {
            var summary = CompanyProjectors.SelectSummary();

            return(c => summary.Invoke(c.Company));
        }
Esempio n. 12
0
        internal static Expression <Func <Customer, CompanyHeaderReturn> > SelectCompanyHeader()
        {
            var header = CompanyProjectors.SelectHeader();

            return(c => header.Invoke(c.Company));
        }