Esempio n. 1
0
        public decimal ApplyPromotion(List <IProduct> product)
        {
            try
            {
                _product       = Utility.GetProductA(product);
                _promotionType = new Promotion1();
                totalPrice    += _promotionType.CalculatePriceAfterPromotion(_product);

                _product       = Utility.GetProductB(product);
                _promotionType = new Promotion2();
                totalPrice    += _promotionType.CalculatePriceAfterPromotion(_product);

                _product       = Utility.GetProductCD(product);
                _promotionType = new Promotion3();
                totalPrice    += _promotionType.CalculatePriceAfterPromotion(_product);
            }
            catch (Exception ex)
            {
                throw new PromotionException("error:-", ex);
            }
            return(totalPrice);
        }