//Button to Open up Menu private void Open_Menu(object sender, RoutedEventArgs e) { string changedNumber = Switcher.GetLanding().tableNumber.Text; if (changedNumber != null) { try { int result = Int32.Parse(changedNumber); if (result < 0 || result > 100) { MessageBox.Show("Invalid input."); } else { MainWindow.TableNumber = result; Switcher.GetNewMenu().DisplayTableNumber.Text = "Table: " + result.ToString(); Switcher.GetCart().DisplayTableNumber.Text = "Table: " + result.ToString(); Switcher.GetCheckout().DisplayTableNumber.Text = "Table " + result.ToString(); Switcher.Switch(Switcher.GetNewMenu()); } } catch (FormatException) { Console.WriteLine($"Cannot Parse, not a number!"); MessageBox.Show("Invald input!"); } } }
public void RemoveItemCheckout(object sender, RoutedEventArgs e) { //var cartChildren = Switcher.GetCart().CartItemList.Children; foreach (CartItem child in Switcher.GetCart().CartItemList.Children) { if (child.cart_item_counter == this.checkout_item_counter) { //Modify Prices float price = float.Parse(this.CheckoutItemPrice.Text.Substring(1)); float priceTotal = price * float.Parse(this.CheckoutItemQuantity.Text); MainWindow.GlobalSubtotal -= priceTotal; string test = MainWindow.GlobalSubtotal.ToString("0.00"); Switcher.GetCart().CartMenuTotal.Text = ("$" + test); Switcher.GetCheckout().Subtotal.Text = ("$" + test); Switcher.GetNewMenu().MenuTotal.Text = ("$" + test); Switcher.GetCheckout().GST.Text = "$" + (MainWindow.GlobalSubtotal * 0.1).ToString("0.00"); float gst = float.Parse(Switcher.GetCheckout().GST.Text.Substring(1)); float subtotal = float.Parse(Switcher.GetCheckout().Subtotal.Text.Substring(1)); Switcher.GetCheckout().Total.Text = "$" + (gst + subtotal).ToString("0.00"); Switcher.GetCart().CartItemList.Children.Remove(child); Switcher.GetCheckout().CheckoutItemList.Children.Remove(this); break; //If we do not break, causes problems with enumerator since we are changing the list we are iterating over } } }
private void OrderMore(object sender, RoutedEventArgs e) { Switcher.GetNewMenu().PreviousOrderButton.Opacity = 1; Switcher.GetNewMenu().PreviousOrderButton.IsEnabled = true; Switcher.GetCart().PreviousOrderButton.Opacity = 1; Switcher.GetCart().PreviousOrderButton.IsEnabled = true; Switcher.Switch(Switcher.GetNewMenu()); }
private void DecreaseQuantityCart(object sender, RoutedEventArgs e) { try { int current = Int32.Parse(this.ItemQuantity.Text); if (current != 1) { current -= 1; this.ItemQuantity.Text = (current).ToString(); float price = float.Parse(this.ItemPrice.Text.Substring(1)); MainWindow.GlobalSubtotal -= price; string test = MainWindow.GlobalSubtotal.ToString("0.00"); Switcher.GetCart().CartMenuTotal.Text = ("$" + test); Switcher.GetCheckout().Subtotal.Text = ("$" + test); Switcher.GetNewMenu().MenuTotal.Text = ("$" + test); Switcher.GetCheckout().GST.Text = "$" + (MainWindow.GlobalSubtotal * 0.1).ToString("0.00"); float gst = float.Parse(Switcher.GetCheckout().GST.Text.Substring(1)); float subtotal = float.Parse(Switcher.GetCheckout().Subtotal.Text.Substring(1)); Switcher.GetCheckout().Total.Text = "$" + (gst + subtotal).ToString("0.00"); foreach (CheckoutItem child in Switcher.GetCheckout().CheckoutItemList.Children) { if (child.checkout_item_counter == this.cart_item_counter) { child.checkout_item_quantity = (current).ToString(); child.CheckoutItemQuantity.Text = (current).ToString(); if (child.CheckoutItemQuantity.Text == "1") { child.DecreaseButton.Opacity = 0; } else { child.DecreaseButton.Opacity = 1; } break; //If we do not break, causes problems with enumerator since we are changing the list we are iterating over } } } else { current = 1; } if (current == 1) { DecreaseButton.Opacity = 0; } } catch (Exception) { Console.WriteLine("broken"); } }
private void Confirm_Order2(object sender, RoutedEventArgs e) { float addReviewOrderSubtotal = 0.00f; //Clear Checkout UC Children Switcher.GetReviewOrder().ReviewItemList.Children.Clear(); foreach (CheckoutItem child in Switcher.GetCheckout().CheckoutItemList.Children) { ReviewOrderItem reviewOrderItem = new ReviewOrderItem(); reviewOrderItem.ReviewOrderItemName.Text = child.CheckoutItemName.Text; reviewOrderItem.ReviewOrderItemPrice.Text = child.CheckoutItemPrice.Text; reviewOrderItem.ReviewOrderItemQuantity.Text = child.CheckoutItemQuantity.Text; reviewOrderItem.ReviewOrderSR.Text = child.CheckoutItemSR.Text; Switcher.GetReviewOrder().ReviewItemList.Children.Add(reviewOrderItem); //Adding Prices for Review Page string temp = reviewOrderItem.ReviewOrderItemPrice.Text.Substring(1); float itemPrice = float.Parse(temp); float totalItemPrice = itemPrice * (float.Parse(reviewOrderItem.ReviewOrderItemQuantity.Text)); addReviewOrderSubtotal += totalItemPrice; } //Last Calculation for Prices float addReviewOrderGST = addReviewOrderSubtotal * MainWindow.GST; float addReviewOrderTotal = addReviewOrderSubtotal + addReviewOrderGST; //Set Calculation Prices on ReviewOrder Switcher.GetReviewOrder().ReviewOrderSubtotal.Text = "$" + addReviewOrderSubtotal.ToString("0.00"); Switcher.GetReviewOrder().ReviewOrderGST.Text = "$" + addReviewOrderGST.ToString("0.00"); Switcher.GetReviewOrder().ReviewOrderTotal.Text = "$" + addReviewOrderTotal.ToString("0.00"); if (MainWindow.hasAlcohol == true) { this.Confirm_Alcohol.Text = "Alcohol"; } //Clear Checkout and Cart Switcher.GetCheckout().CheckoutItemList.Children.Clear(); Switcher.GetCart().CartItemList.Children.Clear(); //Clear Pricing MainWindow.GlobalSubtotal = 0; //Prices Switcher.GetCart().CartMenuTotal.Text = "$0.00"; Switcher.GetCheckout().Subtotal.Text = ("$0.00"); Switcher.GetNewMenu().MenuTotal.Text = ("$0.00"); Switcher.GetCheckout().GST.Text = "$0.00"; Switcher.GetCheckout().Total.Text = "$0.00"; }
private void AddToCart(object sender, RoutedEventArgs e) { CartItem cartItem = new CartItem(); cartItem.cart_item_counter = MainWindow.GlobalCounter; MainWindow.GlobalCounter++; cartItem.ItemName.Text = DisplayItemName.Text; cartItem.ItemPrice.Text = DisplayItemPrice.Text; cartItem.ItemQuantity.Text = DisplayItemQuantity.Text; cartItem.CartItemSR.Text = SpecialRequest.Text; cartItem.cart_alcohol = ia_alcohol; if (cartItem.ItemQuantity.Text == "1") { cartItem.DecreaseButton.Opacity = 0; } else { cartItem.DecreaseButton.Opacity = 1; } Switcher.GetCart().CartItemList.Children.Add(cartItem); AddToCheckout(sender, e, cartItem); string tempPrice = cartItem.ItemPrice.Text.Substring(1); float price = float.Parse(tempPrice); float total = price * (float.Parse(cartItem.ItemQuantity.Text)); MainWindow.GlobalSubtotal += total; string test = MainWindow.GlobalSubtotal.ToString("0.00"); //Prices Switcher.GetCart().CartMenuTotal.Text = "$" + test; Switcher.GetCheckout().Subtotal.Text = ("$" + test); Switcher.GetNewMenu().MenuTotal.Text = ("$" + test); Switcher.GetCheckout().GST.Text = "$" + (MainWindow.GlobalSubtotal * 0.1).ToString("0.00"); float gst = float.Parse(Switcher.GetCheckout().GST.Text.Substring(1)); float subtotal = float.Parse(Switcher.GetCheckout().Subtotal.Text.Substring(1)); Switcher.GetCheckout().Total.Text = "$" + (gst + subtotal).ToString("0.00"); Close_ItemAddition(sender, e); }
public MainWindow() { InitializeComponent(); /*************************** * Big Data: 15 Items ***************************/ /* * Items from: * https://littlecaesars.ca/en-ca/order/pickup/stores/4047/menu * https://orderve.menu/menu/una-pizza-17th-1607978767006x175589733865881600?view=cat&menu=1607979445096x703551211714641900 * https://earls.ca/locations/16th-ave/menu/ */ // Spicy, Peanut, Gluten, Vegetarian, Alcoholic //MenuItem cowboyBurgerItem = new MenuItem("", "", 17.99f, "", false, false, false, false, false); spice, peanut, gluten, veggie, alcohol MenuItem caesarSaladItem = new MenuItem("Caesar Salad", "Lettuce, dry bread, and caesar sause", 5.99f, "/Resources/CaesarSalad.jpg", false, true, true, true, false); MenuItem greekSaladItem = new MenuItem("Greek Salad", "Tomatoes, cucumbers, olives, kalamata", 6.99f, "/Resources/GreekSalad.jpg", false, true, true, true, false); MenuItem prawnGyozaItem = new MenuItem("Prawn Gyoza", "Tender prawns, spring onion, ginger, citrus soy", 17.99f, "/Resources/PrawnGyoza.png", false, false, true, false, false); MenuItem crazybreadItem = new MenuItem("Crazy Bread", "Eight bread sticks with flavours of butter and garlic, then sprinkled with parmesan style cheese", 5.99f, "/Resources/crazybread.jpg", false, false, false, false, false); MenuItem stuffedcrazybreadItem = new MenuItem("Stuffed Crazy Bread", "4 bread sticks stuffed with mozzarella cheese and topped with flavours of butter and garlic then sprinkled with parmesan style cheese", 6.99f, "/Resources/stuffedcrazybread.jpg", false, false, false, false, false); MenuItem canadianPrimeSirloinItem = new MenuItem("Canadian Prime Sirloin", "Served with buttery garlic mashed potatoes and seasonal vegetables", 30.99f, "/Resources/CanadianPrimeSirloin.png", false, true, true, false, false); MenuItem cowboyBurgerItem = new MenuItem("Cowboy Burger", "Tomatoes, onion, lettuce, pickles, mayonnaise and mustard, on a toasted bun", 17.99f, "/Resources/CowboyBurger.png", false, true, false, false, false); MenuItem salmonFetaCaperAioliItem = new MenuItem("Salmon + Feta Caper Aioli", "Oven roasted salmon, jasmine rice and seasonal vegetables", 25.99f, "/Resources/SalmonFetaCaperAioli.png", false, true, true, false, false); MenuItem blackenedChickenItem = new MenuItem("Blackened Chicken", "Blackened full breast of chicken, garlic butter, warm potato salad, smoky bacon, coleslaw", 27.99f, "/Resources/BlackenedChicken.png", false, false, true, false, false); //MenuItem hawaiianItem = new MenuItem("Hawaiian Pizza", "Round pizza with Ham and Pineapple", 11.99f, "/Resources/hawaiian.jpg", false, false, false, false, false); //MenuItem bbqChickenItem = new MenuItem("BBQ Chicken Pizza", "Round pizza with BBQ Sauce, Chicken, Red Onions and Oregano", 14.99f, "/Resources/bbqchicken.jpg", false, false, false, false, false); //MenuItem meat3Item = new MenuItem("3 Meat Pizza", "Round pizza with Pepperoni, Italian Sausage and Bacon", 14.99f, "/Resources/3meat.jpg", false, false, false, false, false); //MenuItem canadianItem = new MenuItem("Canadian Pizza", "Round pizza with Pepperoni, Bacon and Mushrooms", 13.99f, "/Resources/canadian.jpg", false, false, false, false, false); MenuItem ultimateItem = new MenuItem("Ultimate Supreme Pizza", "Round pizza with Pepperoni, Italian Sausage, Mushrooms, Green Peppers and Onions", 199.99f, "/Resources/ultimatesupreme.jpg", false, false, false, false, false); //MenuItem veggieItem = new MenuItem("Veggie Pizza", "Round pizza with Pepperoni, Italian Sausage, Mushrooms, Green Peppers and Onions", 1.99f, "/Resources/veggie.jpg", false, false, false, true, false); MenuItem pepperoniItem = new MenuItem("Classic Pepperoni Pizza", "Round pizza with Pepperoni.", 12.99f, "/Resources/pepperoni.jpg", false, false, false, false, false); //MenuItem cheeseItem = new MenuItem("Classic Cheese Pizza", "Round pizza with just cheese", 10.99f, " /Resources/cheese.jpg", false, false, true, true, false); MenuItem pottedvanillacheesecakeItem = new MenuItem("Potted Vanilla Cheesecake", "Coconut sponge toffee + seed crust, raspberry compote", 9.99f, "/Resources/pottedvanillacheesecake.png", false, true, false, false, false); MenuItem stickyToffeeChocolatePuddingItem = new MenuItem("Sticky Toffee Chocolate Pudding", "Warm pudding cake, chocolate and toffee sauces, vanilla ice cream, maple crumble", 10.99f, "/Resources/StickyToffeeChocolatePudding.png", false, false, false, true, false); MenuItem waterItem = new MenuItem("Water", "Water", 0.99f, "Resources/water.jpg", false, false, false, false, false); MenuItem follyOfTheBeastPinotNoir5Item = new MenuItem("Folly of the Beast Pinot Noir 5oz.", "Sonoma Coast, USA", 12.99f, "/Resources/FollyOfTheBeastPinotNoir.png", false, false, false, false, true); MenuItem follyOfTheBeastPinotNoir7Item = new MenuItem("Folly of the Beast Pinot Noir 7oz.", "Sonoma Coast, USA", 16.99f, "/Resources/FollyOfTheBeastPinotNoir.png", false, false, false, false, true); MenuItem quinoaAvocadoPowerbowlItem = new MenuItem("Quinoa + Avocado Powerbowl", "Roasted squash, beets, green goddess dressing, toasted pumpkin seeds, crispy chickpeas", 15.99f, "/Resources/QuinoaAvocadoPowerbowl.png", false, false, true, true, false); MenuItem crispyPrawnRollItem = new MenuItem("Crispy Prawn Roll", "Avocado, prawn, cucumber, mango, soy paper, unagi sauce, sriracha mayo", 17.99f, "/Resources/CrispyPawnRoll.png", true, false, true, false, false); //MenuItem spicycheddardipItem = new MenuItem("Spicy Cheddar Dip", "", 1.99f, "/Resources/spicycheddardip.jpg", true, false, false, false, false); MenuItem bbqranchdipItem = new MenuItem("BBQ Ranch Dip", "", 1.99f, "/Resources/bbqranchdip.jpg", false, false, false, false, false); //MenuItem creamygarlicdipItem = new MenuItem("Creamy Garlic Dip", "", 1.99f, "/Resources/creamygarlicdip.jpg", false, false, false, false, false); MenuItem ranchDipItem = new MenuItem("Ranch Dip", "", 1.99f, "/Resources/ranchdip.jpg", false, false, false, false, false); //Working Menu Switcher.GetNewMenu().AppetisersList.Children.Add(caesarSaladItem); Switcher.GetNewMenu().AppetisersList.Children.Add(greekSaladItem); Switcher.GetNewMenu().AppetisersList.Children.Add(prawnGyozaItem); Switcher.GetNewMenu().AppetisersList.Children.Add(crazybreadItem); Switcher.GetNewMenu().AppetisersList.Children.Add(stuffedcrazybreadItem); Switcher.GetNewMenu().EntreesList.Children.Add(canadianPrimeSirloinItem); Switcher.GetNewMenu().EntreesList.Children.Add(cowboyBurgerItem); Switcher.GetNewMenu().EntreesList.Children.Add(salmonFetaCaperAioliItem); Switcher.GetNewMenu().EntreesList.Children.Add(blackenedChickenItem); //Switcher.GetNewMenu().EntreesList.Children.Add(hawaiianItem); //Switcher.GetNewMenu().EntreesList.Children.Add(bbqChickenItem); //Switcher.GetNewMenu().EntreesList.Children.Add(meat3Item); //Switcher.GetNewMenu().EntreesList.Children.Add(canadianItem); Switcher.GetNewMenu().EntreesList.Children.Add(ultimateItem); //Switcher.GetNewMenu().EntreesList.Children.Add(veggieItem); Switcher.GetNewMenu().EntreesList.Children.Add(pepperoniItem); //Switcher.GetNewMenu().EntreesList.Children.Add(cheeseItem); Switcher.GetNewMenu().DessertsList.Children.Add(pottedvanillacheesecakeItem); Switcher.GetNewMenu().DessertsList.Children.Add(stickyToffeeChocolatePuddingItem); Switcher.GetNewMenu().DrinksList.Children.Add(waterItem); Switcher.GetNewMenu().DrinksList.Children.Add(follyOfTheBeastPinotNoir5Item); Switcher.GetNewMenu().DrinksList.Children.Add(follyOfTheBeastPinotNoir7Item); Switcher.GetNewMenu().SidesList.Children.Add(quinoaAvocadoPowerbowlItem); Switcher.GetNewMenu().SidesList.Children.Add(crispyPrawnRollItem); //Switcher.GetNewMenu().SidesList.Children.Add(spicycheddardipItem); Switcher.GetNewMenu().SidesList.Children.Add(bbqranchdipItem); //Switcher.GetNewMenu().SidesList.Children.Add(creamygarlicdipItem); Switcher.GetNewMenu().SidesList.Children.Add(ranchDipItem); //Checkout Items List <CheckoutItem> FullCheckout = new List <CheckoutItem>(); //Cart Items List <CartItem> FullCart = new List <CartItem>(); //Review Order Items List <ReviewOrderItem> FullReview = new List <ReviewOrderItem>(); ReviewOrderItem testRO = new ReviewOrderItem(); FullReview.Add(testRO); Switcher.pageSwitcher = this; Switcher.Switch(Switcher.GetLanding()); }
private void Open_Menu(object sender, RoutedEventArgs e) { Switcher.Switch(Switcher.GetNewMenu()); }