Beispiel #1
0
 public DefaultTermsOptionPage(EasyConsoleCore.Program program, Term defaultTerm) : base("Calculate loan payments", program, new[]
 {
     new Option("No", () => program.NavigateTo <CalculateLoanPage>()),
     new Option("Yes", () => program.NavigateTo <ChangeTermsPage>()),
 })
 {
     _defaultTerm = defaultTerm;
 }
Beispiel #2
0
 public WelcomePage(EasyConsoleCore.Program program, Term defaultTerm, Term effectiveTerm) : base("Cloud Engineer Banking Challenge", program, new []
 {
     new Option("Calculate", () => program.NavigateTo <DefaultTermsOptionPage>()),
     new Option("Calculation history", () => program.NavigateTo <HistoryPage>()),
     new Option("About", () => program.NavigateTo <AboutPage>()),
 })
 {
     effectiveTerm.MaxAdministrationFee     = defaultTerm.MaxAdministrationFee;
     effectiveTerm.AdministrationFeePercent = defaultTerm.AdministrationFeePercent;
     effectiveTerm.Interest = defaultTerm.Interest;
 }
Beispiel #3
0
        public MainMenuPage(EasyConsoleCore.Program program)
            : base("Main Page", program,

                   /*new Option("Add General Passenger", () => program.NavigateTo<AddGeneralPassengerPage>()),
                    *              new Option("Add Loyalty Passenger", () => program.NavigateTo<AddLoyaltyPassengerPage>()),
                    *              new Option("Add Airline Passenger", () => program.NavigateTo<AddAirlinePassengerPage>()),
                    *              new Option("Add Discount Passenger", () => program.NavigateTo<AddDiscountPassengerPage>()),*/
                   new Option("Load Passengers", () => program.NavigateTo <BulkLoadPassengerPage>()),
                   new Option("Display Summary", () => program.NavigateTo <DisplaySummaryPage>()))
        {
        }
Beispiel #4
0
        public override void Display()
        {
            base.Display();
            ConsoleColor.Yellow.WriteLine("PAYMENT:");
            Console.WriteLine("--------------------------------------------------");
            Console.WriteLine($"Order number: {ShoppingCart.orderDetails[0].orderNr}" + " " + " " + " " + " " + "Total price: " + ShoppingCart.CountTotalSum() + ":-");
            Console.WriteLine("--------------------------------------------------");
            ConsoleColor.Red.Write("PIN: ");

            string pass = "";

            do
            {
                ConsoleKeyInfo key = Console.ReadKey(true);
                // Backspace Should Not Work
                if (key.Key != ConsoleKey.Backspace && key.Key != ConsoleKey.Enter)
                {
                    pass += key.KeyChar;
                    ConsoleColor.Red.Write("*");
                }
                else
                {
                    if (key.Key == ConsoleKey.Backspace && pass.Length > 0)
                    {
                        pass = pass.Substring(0, (pass.Length - 1));
                        Console.Write("\b \b");
                    }
                    else if (key.Key == ConsoleKey.Enter)
                    {
                        program.NavigateTo <Receipt>();
                    }
                }
            } while (true);
        }
Beispiel #5
0
        public override void Display()
        {
            ConsoleKey input;

            while (true)
            {
                base.Display();

                string banner = $" _    _      _                            _         ______ _                            _       _            _\n" +
                                "| |  | |    | |                          | |        | ___ (_)                          | |     | |          | |\n" +
                                "| |  | | ___| | ___ ___  _ __ ___   ___  | |_ ___   | |_/ /_ __________ _   _ __   __ _| | __ _| |_ ___  ___| |_\n" +
                                "| |/\\| |/ _ \\ |/ __/ _ \\| '_ ` _ \\ / _ \\ | __/ _ \\  |  __/| |_  /_  / _` | | '_ \\ / _` | |/ _` | __/ __|/ _ \\ __|\n" +
                                "\\  /\\  /  __/ | (_| (_) | | | | | |  __/ | || (_) | | |   | |/ / / / (_| | | |_) | (_| | | (_| | |_\\__ \\  __/ |_\n" +
                                " \\/  \\/ \\___|_|\\___\\___/|_| |_| |_|\\___|  \\__\\___/  \\_|   |_/___/___\\__,_| | .__/ \\__,_|_|\\__,_|\\__|___/\\___|\\__|\n" +
                                "                                                                           | |\n" +
                                "                                                                           |_| \n";
                Console.WriteLine(banner);
                Console.WriteLine("Create a new order:");
                Console.WriteLine("\n");
                Console.WriteLine("Press Enter");
                input = Console.ReadKey().Key;


                if (input == ConsoleKey.Enter)
                {
                    program.NavigateTo <MainMenu>();
                }

                Console.Clear();
            }
        }
Beispiel #6
0
        public override void Display()
        {
            int input;
            int b = Menu.numberOfPizzas - 1;

            while (true)
            {
                base.Display();

                Console.WriteLine("\t\t\t\t\t\t\t\t\t\t\tNr of items: " + ShoppingCart.orderDetails.Count);

                Menu.DisplayPizzas(0, b);
                //Console.WriteLine("\n");
                Console.WriteLine("Go to checkout, press " + Menu.numberOfPizzas);
                //Console.WriteLine("\n");

                Console.Write("Please enter a number you want to choose:", 0, b + 1);

                while (true)
                {
                    if (int.TryParse(Console.ReadKey(true).KeyChar.ToString(), out input))
                    {
                        break;
                    }
                }

                if (input >= 0 && input <= b)
                {
                    // stores the choosen pizza in workingOrderDetails
                    ShoppingCart.workingOrderDetails = new OrderDetails(Menu.standardPizza[input]);
                    // Goes to the ingredients page to buy extras or change ingredients
                    program.NavigateTo <IngredientsMenu>();
                }
                else if (input == b + 1)
                {
                    if (ShoppingCart.orderDetails.Count != 0)   // needs a order
                    {
                        program.NavigateTo <OrderListMenu>();
                    }
                }
                Console.Clear();
            }
        }
Beispiel #7
0
        public override void Display()
        {
            ConsoleKey input;

            //double totalPrice = 0;
            //int totalQty = 0;
            //Menu visar bara pizzor. Om jag väljer någonting annat, det syns inte här.



            while (true)
            {
                base.Display();
                if (ShoppingCart.orderDetails.Count == 0)
                {
                    program.NavigateBack();
                }

                Console.WriteLine("--------------------------------------------------");
                ConsoleColor.Yellow.WriteLine("ORDER DETAILS:" + "                        Order no: " + ShoppingCart.orderDetails[0].orderNr);
                Console.WriteLine("--------------------------------------------------");
                //Console.WriteLine("Order no: " + ShoppingCart.orderDetails[0].orderNr);
                var table = new ConsoleTable("No", "Product", "Qty", "Price");
                //totalPrice = 0;
                for (int i = 0; i < ShoppingCart.orderDetails.Count; i++)
                {
                    table.AddRow(i, ShoppingCart.orderDetails[i].orderItem.name, ShoppingCart.orderDetails[i].qty, ShoppingCart.orderDetails[i].price);
                    //Console.WriteLine(i + ". " + "Item: " + ShoppingCart.orderDetails[i].orderItem.name + " " + "Qty: " + ShoppingCart.orderDetails[i].qty + " " + "Price: " + ShoppingCart.orderDetails[i].price + ":-");
                    //totalPrice = totalPrice + ShoppingCart.orderDetails[i].price;
                }
                table.Write();
                Console.WriteLine("\n");
                Console.WriteLine($"Number of items: " + ShoppingCart.CountQty() + " " + " " + " " + " " + "Total price: " + ShoppingCart.CountTotalSum() + ":-");
                Console.WriteLine("-----------------------------------------------------------" + "-");



                Console.WriteLine("\n");
                Console.WriteLine("Please press 'P' to pay");
                Console.WriteLine("Please press 'B' to go back to meny to add items");
                Console.WriteLine("Please press 'D' to delete items");
                Console.WriteLine("Please press 'Q' to change quantity of items");
                Console.WriteLine("\n");

                input = Console.ReadKey(true).Key;

                if (input == ConsoleKey.P)
                {
                    program.NavigateTo <PayMenu>();
                }

                else if (input == ConsoleKey.B)
                {
                    program.NavigateTo <MainMenu>();
                }

                //raderar bara pizzor
                else if (input == ConsoleKey.D)
                {
                    Console.WriteLine("Enter number of the orderline to delete it:");
                    try
                    {
                        int input2 = Convert.ToInt32(Console.ReadLine());
                        ShoppingCart.DeleteOrder(input2);
                    } catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                }

                else if (input == ConsoleKey.Q)
                {
                    try {
                        Console.WriteLine("Enter number of the orderline to change quantity to it and then press Enter:");
                        int input3 = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("Enter a number for quantity");
                        int input4 = Convert.ToInt32(Console.ReadLine());
                        ShoppingCart.ChangeQty(input3, input4);
                    } catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                }
                Console.Clear();
            }
        }