示例#1
0
 public void changePizzaStore()
 {
     if (this.selectedPizzaStore == this.inPlacePizzaOrder)
     {
         this.selectedPizzaStore = this.onlinePizzaOrder;
         Console.WriteLine("Pizza store changed from 'In place' to 'Online'");
     }
     else
     {
         this.selectedPizzaStore = this.inPlacePizzaOrder;
         Console.WriteLine("Pizza store changed from 'Online' to 'In place'");
     }
 }
示例#2
0
        private PizzaOrderApp()
        {
            AbstractHandler h1 = new FiveHundredBillHandler(10, "FiveHunderBillHandler");
            AbstractHandler h2 = new HundredBillHandler(10, "HundredBillHandler");
            AbstractHandler h3 = new FiftyBillHandler(10, "FiftyBillHandler");
            AbstractHandler h4 = new TenBillHandler(10, "TenBillHandler");

            h1.setNextHandler(h2);
            h2.setNextHandler(h3);
            h3.setNextHandler(h4);

            this.inPlacePizzaOrder  = new InPlacePizzaStore(h1);
            this.onlinePizzaOrder   = new OnlinePizzaStore();
            this.selectedPizzaStore = inPlacePizzaOrder;
        }