예제 #1
0
 public void GetInfo(string name, ConsolePrinter printer)
 {
     printer.Print("\nFor:" + name);
     foreach (var item in OrderList)
     {
         printer.Print(item.ItemName);
     }
     printer.Print("Cost: " + TotalCost);
 }
예제 #2
0
        static void Main(string[] args)
        {
            var printer = new ConsolePrinter();

            printer.Print("Welcome, how many people are going to make an order?");

            var countOfPeople = 0;

            while (!int.TryParse(Console.ReadLine(), out countOfPeople))
            {
                printer.Print("Invalid number, try again");
            }

            var menu = CreationOfMenu();

            printer.Print("\nHere is our menu:");
            foreach (var item in menu)
            {
                item.PrintItem(printer);
            }
            var People = new List <Person>();

            for (int i = 0; i < countOfPeople; i++)
            {
                printer.Print("\nOrder for person " + (i + 1) + " What's your name?");
                var name = Console.ReadLine();
                if (string.IsNullOrWhiteSpace(name))
                {
                    throw new FormatException("Invalid name");
                }

                People.Add(new Person(name, menu, new Order(menu)));
                People[i].Order.MakeOrder(printer);
            }

            foreach (var person in People)
            {
                person.Order.GetInfo(person.Name, printer);
            }

            Console.ReadLine();
        }
예제 #3
0
 public void PrintItem(ConsolePrinter printer)
 {
     Console.ForegroundColor = ConsoleColor.Yellow;
     printer.Print("Name: " + ItemName + "\tCost: " + ItemCost);
     Console.ForegroundColor = ConsoleColor.Gray;
 }