Ejemplo n.º 1
0
 /// <summary>
 /// Prints the Receipt in a format that
 /// </summary>
 public void PrintReceipt()
 {
     RecieptPrinter.PrintLine("Order #" + Order.Number.ToString());
     RecieptPrinter.PrintLine(DateTime.Now.ToString());
     RecieptPrinter.PrintLine("");
     RecieptPrinter.PrintLine("Items Ordered:");
     foreach (IOrderItem item in Order)
     {
         if (item is Combo combo)
         {
             Entree entree = combo.Entree;
             Side   side   = combo.Side;
             Drink  drink  = combo.Drink;
             RecieptPrinter.PrintLine(item.Name);
             RecieptPrinter.PrintLine(string.Format("{0:C}", item.Price));
             foreach (string s in item.SpecialInstructions)
             {
                 if (s.Equals(entree.ToString()))
                 {
                     RecieptPrinter.PrintLine("   " + entree.ToString());
                 }
                 else if (s.Equals(side.ToString()))
                 {
                     RecieptPrinter.PrintLine("\n   " + side.ToString());
                 }
                 else if (s.Equals(drink.ToString()))
                 {
                     RecieptPrinter.PrintLine("\n   " + drink.ToString());
                 }
                 else
                 {
                     RecieptPrinter.PrintLine("      - " + s);
                 }
             }
             RecieptPrinter.PrintLine("");
         }
         else
         {
             RecieptPrinter.PrintLine(item.Name);
             RecieptPrinter.PrintLine(string.Format("{0:C}", item.Price));
             foreach (string s in item.SpecialInstructions)
             {
                 RecieptPrinter.PrintLine("  -" + s);
             }
             RecieptPrinter.PrintLine("");
         }
     }
     RecieptPrinter.PrintLine("");
     RecieptPrinter.PrintLine("Subtotal: " + string.Format("{0:C}", Order.Subtotal));
     RecieptPrinter.PrintLine("Tax: " + string.Format("{0:C}", Order.Tax));
     RecieptPrinter.PrintLine("Total: " + string.Format("{0:C}", Order.Total));
     RecieptPrinter.PrintLine("Payment Method: " + PaymentMethod);
     RecieptPrinter.PrintLine("Change: " + string.Format("{0:C}", Change));
     RecieptPrinter.CutTape();
 }
 public EntreeCustomization(Entree e)
 {
     InitializeComponent();
     entree = e;
     name   = e.ToString();
     ArrangeButton();
     Customizebutton.Click  += MainMenu;
     Customizebutton.Content = "To Main Menu--";
 }