Example #1
0
        public void FinaliseOrder(decimal total)
        {
            Console.WriteLine($"Order Total: \t\t${total}");
            Console.WriteLine("Enter payment amount:");
            var payment = decimal.Parse(Console.ReadLine());

            Console.WriteLine($"Customer Payment: \t\t${payment}");
            if (payment >= total)
            {
                Console.WriteLine($"Payment accepted, change due: {total - payment}");
                Console.WriteLine("Press any key to finalise the order");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine($"Insufficient payment, ${payment - total} required. A manager has been called");
                Console.WriteLine("Press any key when payment has been made");
                Console.ReadKey();
            }
            foreach (Item item in this.GetList())
            {
                db.updateStock(item._id, item.Qty);
            }
            Console.WriteLine("Order finalised, press any key to return to main menu");
            Console.ReadKey();
            var newInterface = new Interface();

            newInterface.WelcomeScreen();
        }
Example #2
0
        public void SelectItems(string cat)
        {
            if (cat == "X")
            {
                var newInterface = new Interface();
                newInterface.WelcomeScreen();
            }
            else
            {
                var choice1 = "";
                do
                {
                    Console.Clear();
                    Console.WriteLine("Firing up database, herding hamsters onto their wheels, please wait....");
                    var result1 = db.SearchForItemByCat(cat);
                    Console.Clear();

                    var table = new Table();

                    // Add some columns
                    table.AddColumn("ID");
                    table.AddColumn("Qty");
                    table.AddColumn("Detail");
                    table.AddColumn("Price");

                    foreach (Item item in result1)
                    {
                        table.AddRow(item._id.ToString(), item.Qty.ToString(), item.Detail.ToString(), item.Price.ToString());
                    }

                    // Render the table to the console
                    AnsiConsole.Render(table);

                    Console.WriteLine("Enter Id and press ENTER to add item it order");
                    var orderId1 = Console.ReadLine();
                    this.AddToOrder(orderId1);
                    Console.WriteLine("Add another item from this category?");
                    choice1 = Console.ReadLine();
                }while (choice1.ToUpper() == "Y");
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            Interface newInterface = new Interface();

            newInterface.WelcomeScreen();
        }