void bindPromo()
 {
     ddlPromotion.DataSource = PromotionHandler.getAll();
     ddlPromotion.DataValueField = "Discount";
     ddlPromotion.DataTextField = "Title";
     ddlPromotion.DataBind();
 }
예제 #2
0
        static void Main(string[] args)
        {
            PromotionHandler handler = new PromotionHandler();

            handler.SetNext(new PromotionA());
            handler.SetNext(new PromotionB());
            handler.SetNext(new PromotionCD());
            List <char> items = new List <char>
            {
                'A',
                'A',
                'A',
                'B',
                'B',
                'C',
                'D'
            };
            var cart = new Cart
            {
                Items = SkuHelper.GetSkuList(items)
            };

            var val = handler.Handle(ref cart);
            var msg = val == 205 ? "Hurray!! Your promotions applied.Happy Saving"
                                : "There something wrong with your bill. Please contact admin.";

            Console.WriteLine(msg);
        }
예제 #3
0
 public void Setup()
 {
     activePromotions = new List <IReceiver <Cart> >
     {
         new PromotionA(),
         new PromotionB(),
         new PromotionCD()
     };
     handler = new PromotionHandler(activePromotions.ToArray());
 }
예제 #4
0
 public static List <Promotion> getAll()
 {
     return(PromotionHandler.getAll());
 }
예제 #5
0
 public static Promotion get(String title)
 {
     return(PromotionHandler.getPromo(title));
 }
예제 #6
0
        public static void create(String title, String desc, int discount)
        {
            Promotion newPromo = PromotionFactory.create(title, desc, discount);

            PromotionHandler.create(newPromo);
        }
 public GenericCommandResult Create([FromBody] CreatePromotionCommand command, [FromServices] PromotionHandler handler)
 {
     return((GenericCommandResult)handler.Handle(command));
 }