예제 #1
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()
                }
            });
        }
예제 #2
0
        internal static Expression <Func <SalesQuoteItem, SalesQuoteItemReturn> > Select()
        {
            var key          = SelectKey();
            var treatmentKey = InventoryTreatmentProjectors.SelectInventoryTreatmentKey();
            var product      = ProductProjectors.SelectProduct();
            var packaging    = ProductProjectors.SelectPackagingProduct();

            return(Projector <SalesQuoteItem> .To(i => new SalesQuoteItemReturn
            {
                SalesQuoteItemKeyReturn = key.Invoke(i),
                Quantity = i.Quantity,
                CustomerProductCode = i.CustomerProductCode,
                PriceBase = i.PriceBase,
                PriceFreight = i.PriceFreight,
                PriceTreatment = i.PriceTreatment,
                PriceWarehouse = i.PriceWarehouse,
                PriceRebate = i.PriceRebate,
                InventoryTreatmentKeyReturn = treatmentKey.Invoke(i.Treatment),
                Product = product.Invoke(i.Product),
                Packaging = packaging.Invoke(i.PackagingProduct)
            }));
        }