示例#1
0
        public static void Main(string[] args)
        {
            //Initializing Objects to access the methods of the classes
            Coffee        cfe   = new Coffee();
            Snacks        snk   = new Snacks();
            Staff         staff = new Staff();
            Table         tab   = new Table();
            Order         ord   = new Order();
            CoffeeMachine cm    = new CoffeeMachine();
            Kitchen       kit   = new Kitchen();
            Crockery      ck    = new Crockery();
            Payment       pmt   = new Payment();

            //Continuation bool to handle user flow
            var cont = true;

            List <Snacks>   snackOrderedList  = new List <Snacks>();
            List <Coffee>   CoffeeOrderedList = new List <Coffee>();
            List <Crockery> CrockeryUsed      = new List <Crockery>();
            List <Order>    TotalOrders       = new List <Order>();

            Console.WriteLine("\t\t\t\t\t\tWelcome to LE CAFÉ!\t\t\t");
            Console.WriteLine("\t\t\t\t\t\t-----------------------------\t\t\t\t");

            //Creating Objects of Crockery
            ck.InitializeCrockery();

            //Creating Objects of Coffee to later populate the Coffee List
            cfe.InitializeCoffee();

            //Adding Snacks so that it can be added to snack menu later on
            snk.InitializeSnacks();

            //Adding Staff Members
            staff.InitializeStaff();

            //Adding Tables
            tab.InitializeTables();

            Console.WriteLine("Press any key to see the menu's.");
            Console.Read();

            Console.WriteLine("Please enter the table number you are ordering from");
            int?TableID = Convert.ToInt16(Console.ReadLine());

            try { TableID = Convert.ToInt16(TableID); } catch { TableID = null; }

            cont = true;
            while (cont)
            {
                if (TableID == null)
                {
                    Console.WriteLine("Please try again, enter a valid table number");
                    //TableID = Console.ReadLine();
                    try { TableID = Convert.ToInt16(Console.ReadLine()); } catch { TableID = null; }
                }
                else
                {
                    TableID = tab.Tables.FirstOrDefault(t => t.Key == TableID).Value.TableID;
                    cont    = false;
                }
            }

            Console.WriteLine("\t\t\t\t\t\t\t");
            Console.WriteLine("Please Select the number Coffee you would like to have");
            Console.WriteLine("\t\t\t\t\t\t\t");
            Console.WriteLine("Coffee\t\t--\t\tPrice\t\t--\t\tPrepration Time\t\t--\t\tDescription");

            foreach (Coffee c in cfe.CoffeeList)
            {
                Console.WriteLine(c.CoffeeID + "\t" + c.CoffeeName + "\t" + c.Price.ToString() + "\t" + c.PrepareTime.ToString());
                Console.WriteLine(c.Description);
                Console.WriteLine("\t\t\t\t\t\t\t");
            }

            int?CoffeeID = -1;

            cont = true;
            while (cont)
            {
                try { CoffeeID = Convert.ToInt16(Console.ReadLine()); } catch { CoffeeID = null; }

                if (CoffeeID != null)
                {
                    Coffee orderedCoffee = cfe.CoffeeList.FirstOrDefault(c => c.CoffeeID == CoffeeID);
                    CoffeeOrderedList.Add(orderedCoffee);
                    Crockery crok1 = new Crockery();
                    CrockeryUsed.Add(crok1);
                }

                Console.WriteLine("\t\t\t\t\t\t\t");
                Console.WriteLine("To add more coffe press y or enter n and press enter key");
                Console.WriteLine("\t\t\t\t\t\t\t");

                var moreCoffee = Console.ReadLine();

                if (!moreCoffee.Contains("y"))
                {
                    cont = false;
                }
            }

            foreach (Snacks s in snk.SnackList)
            {
                Console.WriteLine(s.SnackID + "\t" + s.SnackName + "\t" + s.Price.ToString() + "\t" + s.ServingSize + "\t" + s.PrepareTime.ToString());
                Console.WriteLine(s.Description);
                Console.WriteLine("\t\t\t\t\t\t\t");
            }

            Console.WriteLine("\t\t\t\t\t\t\t");
            Console.WriteLine("Please Select the number Snack you would like to have");


            int?SnackID = -1;

            cont = true;
            while (cont)
            {
                try { SnackID = Convert.ToInt16(Console.ReadLine()); } catch { SnackID = null; }

                if (SnackID != null)
                {
                    Snacks orderedSnack = snk.SnackList.FirstOrDefault(s => s.SnackID == SnackID);
                    snackOrderedList.Add(orderedSnack);
                    Crockery crok = new Crockery();
                    CrockeryUsed.Add(crok);
                }

                Console.WriteLine("\t\t\t\t\t\t\t");
                Console.WriteLine("To add more snacks press y or enter n and press enter key");
                Console.WriteLine("\t\t\t\t\t\t\t");

                var moreCoffee = Console.ReadLine();

                if (!moreCoffee.Contains("y"))
                {
                    cont = false;
                }
            }

            Order test = new Order
            {
                OrderID       = (int)TableID + (int)CoffeeID * (int)SnackID,
                TableID       = (int)TableID,
                OrderDate     = DateTime.Now,
                SnackOrdered  = snackOrderedList,
                CoffeeOrdered = CoffeeOrderedList,
                Waiter        = 1,
                ServingTime   = 10,
                Served        = false,
                CrockeryUsed  = CrockeryUsed
            };

            ord.OrderAdded          += cm.PrepareCoffee;
            ord.OrderAdded          += kit.PrepareSnack;
            cm.CoffeePrepareHandler += ck.PrepareSnack;
            kit.SnackPrepareHandler += ck.PrepareSnack;

            ord.AddOrder(test);
            TotalOrders.Add(test);

            Console.WriteLine("Your order will soon be on your table.");
            Console.WriteLine();
            Thread.Sleep(3000);

            var totalBill = pmt.GenerateBill(test);

            Console.WriteLine("are you an employee with us. you can avail a flat 10 bucks discount by entering your id");
            var id = Console.Read();

            totalBill = pmt.ApplyDiscount(totalBill);
            Console.WriteLine("Your Total comes out to be " + totalBill.ToString());
            Console.WriteLine("Please write your full name as signature to authorise the payment.");
            var sign = Console.Read();

            Console.WriteLine("Thank you for ordering with us " + sign.ToString());

            Console.WriteLine("\t\t\t\t\t\tPRESS numeric 1 Key to enter admin mode\t\t\t");
            Console.WriteLine("\t\t\t\t\t\t-----------------------------\t\t\t\t");

            var input = Console.Read();

            if (input == 1)
            {
                Console.WriteLine("Welcome to Admin mode. Here you can see up-to-the-minute information on the snack items and coffees ordered and breakout percentages showing sales of each item versus total sales");
            }

            decimal total = 0.0m;

            foreach (Order ords in TotalOrders)
            {
                foreach (Snacks s in ords.SnackOrdered)
                {
                    Console.WriteLine(ords.OrderID.ToString() + "\t" + s.SnackName);
                    total += s.Price;
                }
                foreach (Coffee c in ords.CoffeeOrdered)
                {
                    Console.WriteLine(ords.OrderID.ToString() + "\t" + c.CoffeeName);
                    total += c.Price;
                }
            }

            Console.WriteLine("\t\t\t\t\t\t-----------------------------\t\t\t\t");
            Console.WriteLine("Total Sales are " + "\t" + total);
        }
示例#2
0
 public void DeleteCoffee(Coffee c)
 {
     CoffeeList.Remove(c);
 }
示例#3
0
        public void InitializeCoffee()
        {
            Coffee c1 = new Coffee
            {
                CoffeeID    = 1,
                CoffeeName  = "Caramel Macchiato",
                Description = "So bewitched are they, you’d think it was some kind of magical elixir. Well there’s no hocus pocus here. We’ll tell you exactly what goes into it: creamy vanilla-flavoured syrup, freshly steamed milk with a topping of velvety-rich foam, an intense hit of our Espresso Roast, a finishing of buttery caramel drizzle",
                Price       = 4.99m,
                PrepareTime = 5,
                InStock     = true
            };
            Coffee c2 = new Coffee
            {
                CoffeeID    = 2,
                CoffeeName  = "Caffè Americano",
                Description = "To create a caffè americano – a coffee that satisfies the American preference for more sips in every cup – Europeans simply add hot water to their espresso. While the americano is similar in strength and taste to American-style brewed coffee, there are subtle differences achieved by pulling a fresh shot of espresso for the beverage base. The best way to discover these nuances, of course, is to try a cup yourself.",
                Price       = 3.5m,
                PrepareTime = 5,
                InStock     = true
            };
            Coffee c3 = new Coffee
            {
                CoffeeID    = 3,
                CoffeeName  = "Caffè Latte",
                Description = "And like most classics, part of its appeal comes from its simplicity. A caffè latte is simply a shot or two of bold, tasty espresso with fresh, sweet steamed milk over it. Some prefer to add syrup or extra espresso to the recipe. Some maintain that it is entirely perfect as is.",
                Price       = 4.5m,
                PrepareTime = 6,
                InStock     = true
            };
            Coffee c4 = new Coffee
            {
                CoffeeID    = 4,
                CoffeeName  = "Caffè Mocha",
                Description = "Both are rich and full of depth. Where one is creamy, the other is roasty. They complement each other perfectly. And when they come together under a fluffy cloud of sweetened whipped cream, you’ll wish their union would last forever.",
                Price       = 4.5m,
                PrepareTime = 6,
                InStock     = true
            };
            Coffee c5 = new Coffee
            {
                CoffeeID    = 5,
                CoffeeName  = "White Chocolate Mocha",
                Description = "That its smooth subtlety makes it a perfect complement to bolder flavours. Well, there aren’t many flavours bolder than our rich, full-bodied espresso. And as it turns out, there aren’t many better ways to experience the decadence of white chocolate than in this delicious beverage.",
                Price       = 5.5m,
                PrepareTime = 4,
                InStock     = true
            };
            Coffee c6 = new Coffee
            {
                CoffeeID    = 6,
                CoffeeName  = "Cappuccino",
                Description = "To make it properly requires much skill and attentiveness. Arguably the most important part is frothing the foam to velvety perfection as the milk steams – something our baristas take great care to achieve. The milky moustache that clings to your upper lip is proof we’ve made yours right. And may we say, you wear it well.",
                Price       = 4.99m,
                PrepareTime = 5,
                InStock     = true
            };
            Coffee c7 = new Coffee
            {
                CoffeeID    = 7,
                CoffeeName  = "Flat White",
                Description = "Expertly steamed milk poured over a double shot of our signature espresso and finished with a thin layer of velvety microfoam.",
                Price       = 3.5m,
                PrepareTime = 3,
                InStock     = true
            };
            Coffee c8 = new Coffee
            {
                CoffeeID    = 8,
                CoffeeName  = "Espresso",
                Description = "Its rich flavour, lingering aroma and caramelly sweetness make it the perfect foundation for lattes, cappuccinos and all our espresso-based beverages. But you can also enjoy it all by itself – indeed, that might be the best way to discover its nuances.",
                Price       = 3.99m,
                PrepareTime = 7,
                InStock     = true
            };

            CoffeeList.Add(c1);
            CoffeeList.Add(c2);
            CoffeeList.Add(c3);
            CoffeeList.Add(c4);
            CoffeeList.Add(c5);
            CoffeeList.Add(c6);
            CoffeeList.Add(c7);
            CoffeeList.Add(c8);
        }
示例#4
0
 public void AddCoffee(Coffee c)
 {
     CoffeeList.Add(c);
 }