void AddItemToOrder(GadgetSmall AddingGadget, int gadgetsOrdered) { Console.WriteLine("Add this item to your order?"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.Write("(Y) Yes "); Console.ForegroundColor = ConsoleColor.White; Console.Write("-or- Press any other key to "); Console.ForegroundColor = ConsoleColor.Red; Console.Write("Cancel"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(", and then press \"Enter\": "); string userConfirmOrder = Console.ReadLine().ToUpper(); if (userConfirmOrder == "Y") { OrderFromOrderForm.Add(gadgetsOrdered * AddingGadget.GetPrice()); OrderFromOrderForm.Add(gadgetsOrdered); OrderFromOrderForm.Add(" " + AddingGadget.Name); OrderFromOrderForm.Add(gadgetsOrdered * AddingGadget.GetPrice()); WagCustomerTypeAndOrder.MasterOrderForm.Add(OrderFromOrderForm); } }
void OrderSummary(GadgetSmall AddingGadget, int gadgetsOrdered) { Console.WriteLine(); Console.WriteLine("Number of " + AddingGadget.Name + " Gadgets ordering = " + gadgetsOrdered); Console.WriteLine(); Console.Write("Total Price of this item order:"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(" $" + gadgetsOrdered * AddingGadget.GetPrice()); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(); Console.WriteLine(); }
public void DisplayOrder(int NumberOfGadgets, string sizeSelected) { switch (sizeSelected) { case "Small": Console.Clear(); // This is the Small Gadget we are creating GadgetSmall mySmallGadget = new GadgetSmall(); // Display the Form Console.WriteLine("-----------------------------------------------------"); Console.WriteLine("------------------- Small Gadget -------------------"); Console.WriteLine("-----------------------------------------------------"); Console.WriteLine(); // Use the object's method to display the pricing mySmallGadget.DisplayComponents(); Console.WriteLine(); Console.WriteLine("-----------------------------------------------------"); OrderSummary(mySmallGadget, NumberOfGadgets); //Ask the user to confirm the order and then return to Main Menu AddItemToOrder(mySmallGadget, NumberOfGadgets); break; case "Medium": GadgetMedium myMediumGadget = new GadgetMedium(); Console.Clear(); Console.WriteLine("-----------------------------------------------------"); Console.WriteLine("------------------ Medium Gadget -------------------"); Console.WriteLine("-----------------------------------------------------"); myMediumGadget.DisplayComponents(); Console.WriteLine(); Console.WriteLine("-----------------------------------------------------"); OrderSummary(myMediumGadget, NumberOfGadgets); if (WagCustomerTypeAndOrder.CustomerType == "M") { CustomizeOrder(myMediumGadget, NumberOfGadgets); } else { AddItemToOrder(myMediumGadget, NumberOfGadgets); } break; case "Large": GadgetLarge myLargeGadget = new GadgetLarge(); Console.Clear(); Console.WriteLine("-----------------------------------------------------"); Console.WriteLine("------------------- Large Gadget -------------------"); Console.WriteLine("-----------------------------------------------------"); myLargeGadget.DisplayComponents(); Console.WriteLine(); Console.WriteLine("-----------------------------------------------------"); OrderSummary(myLargeGadget, NumberOfGadgets); if (WagCustomerTypeAndOrder.CustomerType == "M") { CustomizeOrder(myLargeGadget, NumberOfGadgets); } else { AddItemToOrder(myLargeGadget, NumberOfGadgets); } break; } }