public static IPromotion GetFactory(PromoDefinition promoDef)
        {
            switch (promoDef.PromoType)
            {
            case PromotionTypes.SingleSku:
                return(new SingleSku(promoDef));

            case PromotionTypes.DualProducts:
                return(new DualProduct(promoDef));
                // case Percentage
            }

            throw new ArgumentException("Unable to create PromotionType, invalid promotion type");
        }
Пример #2
0
 public SingleSku(PromoDefinition promo)
 {
     this.product    = promo.ProductList[0];
     this.quantity   = promo.Quantity;
     this.promoPrice = Convert.ToDouble(promo.Value);
 }
Пример #3
0
 public DualProduct(PromoDefinition promo)
 {
     this.product1   = promo.ProductList[0];
     this.product2   = promo.ProductList[1];
     this.promoPrice = Convert.ToDouble(promo.Value);
 }