Пример #1
0
        public AddOrder(Customer customer)
        {
            InitializeComponent();
            ACustomer = customer;
            Coffee                  aCoffee            = new Coffee();
            CoffeeDarkRoast         aDarkRoastCoffee   = new CoffeeDarkRoast();
            SandwichWithBacon       aBaconSandwich     = new SandwichWithBacon();
            SandwichWithEggSalad    aEggSandwich       = new SandwichWithEggSalad();
            SandwichWithRoastedBeef aRoastBeefSandwich = new SandwichWithRoastedBeef();
            Tea       aTea      = new Tea();
            Milk      aMilk     = new Milk();
            Suggar    aSuggar   = new Suggar();
            Sweetener aSweetner = new Sweetener();
            Cheese    aCheese   = new Cheese();
            Mayo      aMayo     = new Mayo();
            Lettuce   aLettuce  = new Lettuce();
            Tomato    aTomato   = new Tomato();

            lbxOrders.Items.Add(aCoffee);
            lbxOrders.Items.Add(aDarkRoastCoffee);
            lbxOrders.Items.Add(aBaconSandwich);
            lbxOrders.Items.Add(aEggSandwich);
            lbxOrders.Items.Add(aRoastBeefSandwich);
            lbxOrders.Items.Add(aTea);
            lbxAdditions.Items.Add(aSweetner);
            lbxAdditions.Items.Add(aMilk);
            lbxAdditions.Items.Add(aSuggar);
            lbxAdditions.Items.Add(aCheese);
            lbxAdditions.Items.Add(aMayo);
            lbxAdditions.Items.Add(aLettuce);
            lbxAdditions.Items.Add(aTomato);
        }
Пример #2
0
 public AddOrder(CoffeeShop parent, Customer customer)
 {
     InitializeComponent();
     sandwichWithBacon       = new SandwichWithBacon();
     sandwichWithEggSalad    = new SandwichWithEggSalad();
     sandwichWithRoastedBeef = new SandwichWithRoastedBeef();
     coffeeShopForm          = parent;
     this.customer           = customer;
     order = new Order(customer, OrderType.PhoneOrder);
 }
Пример #3
0
        private void btnItem_Click(object sender, EventArgs e)
        {
            if (rbtnCoffee.Checked)
            {
                coffeeDarkRoast = new CoffeeDarkRoast();
                AddAdditions(coffeeDarkRoast);
            }
            if (rbtnTea.Checked)
            {
                tea = new Tea();
                AddAdditions(tea);
            }
            if (rbtnSandwichBacon.Checked)
            {
                sandwichWithBacon = new SandwichWithBacon();
                AddFoodAdditions(sandwichWithBacon);
            }
            if (rbtnSandwichRoastBeef.Checked)
            {
                sandwichWithRoastedBeef = new SandwichWithRoastedBeef();
                AddFoodAdditions(sandwichWithRoastedBeef);
            }
            if (rbtnSandwichEggSalad.Checked)
            {
                sandwichWithEggSalad = new SandwichWithEggSalad();
                AddFoodAdditions(sandwichWithEggSalad);
            }

            if (globalDrink != null)
            {
                order.AddOrderItem(globalDrink);
            }
            if (globalFood != null)
            {
                order.AddOrderItem(globalFood);
            }
            rbtnCoffee.Checked            = false;
            rbtnTea.Checked               = false;
            rbtnSandwichBacon.Checked     = false;
            rbtnSandwichEggSalad.Checked  = false;
            rbtnSandwichRoastBeef.Checked = false;
            numCheese.Value               = 0;
            numLettuce.Value              = 0;
            numMayo.Value     = 0;
            numMilk.Value     = 0;
            numSugar.Value    = 0;
            numSweetner.Value = 0;
            numTomato.Value   = 0;
            globalDrink       = null;
            globalFood        = null;
            txtOrder.Text     = order.ToString();
        }
Пример #4
0
 private static void setMenuItems(IMenuItem[] menuItems)
 {
     menuItems[0] = new Sugar(new Coffee());
     menuItems[1] = new Sugar(new Sugar(new Coffee()));
     menuItems[2] = new Sugar(new Milk(new Coffee()));
     menuItems[3] = new Milk(new Coffee());
     menuItems[4] = new Milk(new Milk(new CoffeeDarkRoast()));
     menuItems[5] = new Milk(new Tea());
     menuItems[6] = new Milk(new Milk(new Tea()));
     menuItems[7] = new SandwichWithBacon();
     menuItems[8] = new SandwichWithRoastedBeef();
     menuItems[9] = new SandwichWithEggSalad();
 }
Пример #5
0
        private void Setmenuitems()
        {
            Coffee                  coffee                  = new Coffee();
            CoffeeDarkRoast         coffedarkroast          = new CoffeeDarkRoast();
            Tea                     tea                     = new Tea();
            SandwichWithBacon       sandwichwithBacon       = new SandwichWithBacon();
            SandwichWithRoastedBeef sandwichWithRoastedBeef = new SandwichWithRoastedBeef();
            SandwichWithEggSalad    sandwichWithEggSalad    = new SandwichWithEggSalad();

            listMenu.Items.Add(coffedarkroast);
            listMenu.Items.Add(tea);
            listMenu.Items.Add(sandwichwithBacon);
            listMenu.Items.Add(sandwichWithRoastedBeef);
            listMenu.Items.Add(sandwichWithEggSalad);
        }
Пример #6
0
        private static void setMenuItems(MenuItem[] menuItems)
        {
            menuItems[0] = new Coffee();


            menuItems[1] = new CoffeeWithSugar();
            menuItems[2] = new CoffeeDoubleSugar();
            menuItems[3] = new CoffeeWithMilk();
            menuItems[4] = new CoffeeDoubleMilk();
            menuItems[5] = new CoffeeSugarAndMilk();
            menuItems[6] = new CoffeeDoubleDouble();
            menuItems[7] = new SandwichWithBacon();
            menuItems[8] = new SandwichWithRoastedBeef();
            menuItems[9] = new SandwichWithEggSalad();
        }
Пример #7
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            if (menuGridView.CurrentRow == null)
            {
                return;
            }
            IMenuItem item = new Coffee();

            if (menuGridView.CurrentRow.Index == 1)
            {
                item = new CoffeeDarkRoast();
            }
            else if (menuGridView.CurrentRow.Index == 2)
            {
                item = new Tea();
            }
            else if (menuGridView.CurrentRow.Index == 3)
            {
                item = new SandwichWithBacon();
            }
            else if (menuGridView.CurrentRow.Index == 4)
            {
                item = new SandwichWithEggSalad();
            }
            else if (menuGridView.CurrentRow.Index == 5)
            {
                item = new SandwichWithRoastedBeef();
            }
            for (int i = 0; i < NUD_Cheese.Value; i++)
            {
                item = new Cheese(item);
            }
            for (int i = 0; i < NUD_Lettuce.Value; i++)
            {
                item = new Lettuce(item);
            }
            for (int i = 0; i < NUD_Mayo.Value; i++)
            {
                item = new Mayo(item);
            }
            for (int i = 0; i < NUD_Milk.Value; i++)
            {
                item = new Milk(item);
            }
            for (int i = 0; i < NUD_Sugar.Value; i++)
            {
                item = new Suggar(item);
            }
            for (int i = 0; i < NUD_Sweetener.Value; i++)
            {
                item = new Sweetener(item);
            }
            for (int i = 0; i < NUD_Tomato.Value; i++)
            {
                item = new Tomato(item);
            }
            orderListGridView.Rows.Add();
            orderListGridView.Rows[numberOfRows].Cells[0].Value   = item.Description;
            orderListGridView.Rows[numberOfRows++].Cells[1].Value = item.Cost;
            items.Add(item);
        }