public override void ApplyPromotionResult(CustomerOrder customerOrder)
        {
            if (!this.PromotionResult.VendorId.HasValue)
            {
                throw new ArgumentNullException("VendorId");
            }

            ProductPromotionHelper_Brasseler helper = new ProductPromotionHelper_Brasseler(this.PricingPipeline, this.promotionAmountProvider);

            helper.ApplyDiscountToOrderLines(this.PromotionResult, customerOrder.OrderLines.Where <OrderLine>((Func <OrderLine, bool>)(ol =>
            {
                if (ol.IsPromotionItem)
                {
                    return(false);
                }
                Guid?vendorId1 = ol.Product.VendorId;
                Guid?vendorId2 = this.PromotionResult.VendorId;
                if (vendorId1.HasValue != vendorId2.HasValue)
                {
                    return(false);
                }
                if (!vendorId1.HasValue)
                {
                    return(true);
                }
                return(vendorId1.GetValueOrDefault() == vendorId2.GetValueOrDefault());
            })), customerOrder);
        }
Ejemplo n.º 2
0
        public override void ApplyPromotionResult(CustomerOrder customerOrder)
        {
            if (this.PromotionResult.Code.IsBlank())
            {
                throw new ArgumentNullException("Code");
            }

            ProductPromotionHelper_Brasseler helper = new ProductPromotionHelper_Brasseler(this.PricingPipeline, this.promotionAmountProvider);

            helper.ApplyDiscountToOrderLines(this.PromotionResult, customerOrder.OrderLines.Where <OrderLine>((Func <OrderLine, bool>)(ol =>
            {
                if (!ol.IsPromotionItem)
                {
                    return(ol.Product.PriceCode.EqualsIgnoreCase(this.PromotionResult.Code));
                }
                return(false);
            })), customerOrder);
        }
        public override void ApplyPromotionResult(CustomerOrder customerOrder)
        {
            if (this.PromotionResult.Category == null)
            {
                throw new ArgumentNullException("Category");
            }

            ProductPromotionHelper_Brasseler helper = new ProductPromotionHelper_Brasseler(this.PricingPipeline, promotionAmountProvider);

            helper.ApplyDiscountToOrderLines(this.PromotionResult, customerOrder.OrderLines.Where <OrderLine>((Func <OrderLine, bool>)(ol =>
            {
                if (!ol.IsPromotionItem)
                {
                    return(this.ProductRepository.IsInCategory(ol.Product, this.PromotionResult.Category.Id));
                }
                return(false);
            })), customerOrder);
        }