Exemple #1
0
        // Student submenu
        public override void Menu()
        {
            Console.WriteLine("--------------------");
            Console.WriteLine("--- Student menu --- ");
            do
            {
                Console.WriteLine("--------------------------------------------------------------------");
                Console.WriteLine("1. List students 2.Staff availability 3.Make booking 4.Cancel booking 5.Exit");
                //check input
                do
                {
                    input = Console.ReadLine();
                }while (!UtilTool.checkInput(input));

                stSelection = int.Parse(input);

                if (stSelection == 1)
                {
                    Console.WriteLine("--- List students ---");
                    foreach (Students s in Program.studentList)
                    {
                        Console.WriteLine(s.id + " " + s.name + " " + s.email);
                    }
                    Console.WriteLine("--------------------");
                }
                else if (stSelection == 2)
                {
                    Console.WriteLine("--- Staff availability---");
                    string date;
                    string staffId;
                    do
                    {
                        Console.WriteLine("Enter date for staff availability (dd-mm-yyyy): ");
                        date = Console.ReadLine();
                    } while (!UtilTool.checkSlotDate(date));

                    do
                    {
                        Console.WriteLine("Enter staff ID: ");
                        staffId = Console.ReadLine();
                    } while (!UtilTool.checkStaffId(staffId));

                    UtilTool.printAvailableStaff(date, staffId);
                    Console.WriteLine("--------------------");
                }
                else if (stSelection == 3)
                {
                    Console.WriteLine("--- Make booking ---");
                    makeBooking();
                    Console.WriteLine("----------------------");
                }
                else if (stSelection == 4)
                {
                    Console.WriteLine("--- Cancel booking ---");
                    cancelBooking();
                    Console.WriteLine("--------------------");
                }
                else if (stSelection == 5)
                {
                    Console.WriteLine("--- Back to main menu --- ");
                    Console.WriteLine("--------------------");
                    break;
                }
            } while (stSelection != 5);
        }