private void Cancel_Btn_Click(object sender, EventArgs e) { OrderedMenu = null; OrderedMenu_Label.Text = ""; MenuItems_Listbox.SelectedItem = null; Additions_Listbox.SelectedItem = null; Orders_Listbox.Items.Clear(); }
private CoffeeShopLib.MenuItem CreateFoodWithMayo(CoffeeShopLib.MenuItem menuItem, int strength = 0) { CoffeeShopLib.MenuItem item = menuItem; if (strength != 0) { item = new Sweetener(CreateFoodWithMayo(menuItem, --strength)); } return(item); }
private CoffeeShopLib.MenuItem CreateFoodWithTomato(CoffeeShopLib.MenuItem menuItem, int strength = 0) { CoffeeShopLib.MenuItem item = menuItem; if (strength != 0) { item = new Milk(CreateFoodWithTomato(menuItem, --strength)); } return(item); }
private CoffeeShopLib.MenuItem CreateFoodWithLettuce(CoffeeShopLib.MenuItem menuItem, int strength = 0) { CoffeeShopLib.MenuItem item = menuItem; if (strength > 0) { item = new Sugar(CreateFoodWithLettuce(menuItem, --strength)); } return(item); }
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(); }
private void btnAddItemToOrder_Click(object sender, EventArgs e) { MenuItem item = (MenuItem)lbxMenuItem.SelectedItem; if (item == null) { MessageBox.Show("Please, select a menu item."); } else { order.AddOrderItem(item); lblTtotalCost.Text = order.Cost.ToString(); RefreshOrder(); } }
private void AddAdditions(CoffeeShopLib.MenuItem drink) { if (numMilk.Value > 0) { drink = CreateDrinkWithMilk(drink, (int)numMilk.Value); } if (numSweetner.Value > 0) { drink = CreateDrinkWithSweetner(drink, (int)numSweetner.Value); } if (numSugar.Value > 0) { drink = CreateDrinkWithSugar(drink, (int)numSugar.Value); } globalDrink = drink; }
private void AddFoodAdditions(CoffeeShopLib.MenuItem food) { if (numCheese.Value > 0) { food = CreateFoodWithCheese(food, (int)numMilk.Value); } if (numLettuce.Value > 0) { food = CreateFoodWithLettuce(food, (int)numSweetner.Value); } if (numTomato.Value > 0) { food = CreateFoodWithLettuce(food, (int)numSugar.Value); } if (numMayo.Value > 0) { food = CreateFoodWithMayo(food, (int)numMayo.Value); } globalFood = food; }
private void AddItems(CoffeeShopLib.MenuItem menuItem) { if (Additions_Listbox.SelectedItem is Suggar) { OrderedMenu = new Suggar(menuItem); OrderedMenu_Label.Text = OrderedMenu.ToString(); } else if (Additions_Listbox.SelectedItem is Milk) { OrderedMenu = new Milk(menuItem); OrderedMenu_Label.Text = OrderedMenu.ToString(); } else if (Additions_Listbox.SelectedItem is Sweetener) { OrderedMenu = new Sweetener(menuItem); OrderedMenu_Label.Text = OrderedMenu.ToString(); } else if (Additions_Listbox.SelectedItem is Lettuce) { OrderedMenu = new Lettuce(menuItem); OrderedMenu_Label.Text = OrderedMenu.ToString(); } else if (Additions_Listbox.SelectedItem is Cheese) { OrderedMenu = new Cheese(menuItem); OrderedMenu_Label.Text = OrderedMenu.ToString(); } else if (Additions_Listbox.SelectedItem is Mayo) { OrderedMenu = new Mayo(menuItem); OrderedMenu_Label.Text = OrderedMenu.ToString(); } else if (Additions_Listbox.SelectedItem is Tomato) { OrderedMenu = new Tomato(menuItem); OrderedMenu_Label.Text = OrderedMenu.ToString(); } }
private void lbxOrders_SelectedIndexChanged(object sender, EventArgs e) { AMenuItem = lbxOrders.SelectedItem as MenuItem; CurrentOrder = AMenuItem; }
private void MenuItems_Listbox_SelectedIndexChanged(object sender, EventArgs e) { OrderedMenu = (CoffeeShopLib.MenuItem)MenuItems_Listbox.SelectedItem; }