void bindPromo() { ddlPromotion.DataSource = PromotionHandler.getAll(); ddlPromotion.DataValueField = "Discount"; ddlPromotion.DataTextField = "Title"; ddlPromotion.DataBind(); }
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); }
public void Setup() { activePromotions = new List <IReceiver <Cart> > { new PromotionA(), new PromotionB(), new PromotionCD() }; handler = new PromotionHandler(activePromotions.ToArray()); }
public static List <Promotion> getAll() { return(PromotionHandler.getAll()); }
public static Promotion get(String title) { return(PromotionHandler.getPromo(title)); }
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)); }