Beispiel #1
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));
        }
        internal static Expression <Func <SalesOrder, SalesOrderInternalAcknowledgementReturn> > SelectWarehouseAcknowlegement()
        {
            var note = CustomerNoteProjectors.Select();
            var orderItemContracKey = SalesOrderItemProjectors.SelectInternalAcknoweldgement();

            return(Projector <SalesOrder> .To(o => new SalesOrderInternalAcknowledgementReturn
            {
                PaymentTerms = o.PaymentTerms,
                Broker = new[] { o.Broker }.Select(b => b.Name).FirstOrDefault(),
                SoldToShippingLabel = o.SoldTo,
                CustomerNotes = new[] { o.Customer }.Where(c => c != null).SelectMany(c => c.Notes.Select(n => note.Invoke(n))),
                OrderItems = o.SalesOrderItems.Select(i => orderItemContracKey.Invoke(i))
            }));
        }