//Ask user number of entries, then creates object and calls method to fill data then stores to list private static void AddTrainer() { Console.WriteLine("How many entries would you like to make ? "); int times = InputMinMax(1, 10); //wanted to limit entries doesn't make sense for user to have int.Max entries //we can change max value anytime for (int i = 1; i <= times; i++) { Console.Clear(); ShowData.ShowCourses(Courses); Trainer myTrainer = new Trainer(); Console.WriteLine("Select the course to add the trainer (number). "); int num = InputMinMax(1, Courses.Count) - 1; myTrainer.FillData(); if (Courses[num].CheckTrainer(myTrainer)) { EntryAlreadyExist(); PressKeyToContinue(); } else { Trainers.Add(myTrainer); Courses[num].AddTrainer(myTrainer); Console.Clear(); ShowData.ShowTrainers(Trainers); PressKeyToContinue(); } } }
//Dissplays application's display data menu private static void DisplaydataMenu() { Console.Clear(); WriteInColor(schoolName, ConsoleColor.Yellow); WriteInColor("\n\n1.", ConsoleColor.Green); WriteInColor(" Show Courses\n", ConsoleColor.Cyan); //show all information on course WriteInColor("2.", ConsoleColor.Green); WriteInColor(" Show Trainers\n", ConsoleColor.Cyan); //show all info on trainers WriteInColor("3.", ConsoleColor.Green); WriteInColor(" Show Students\n", ConsoleColor.Cyan); //show all info students WriteInColor("4.", ConsoleColor.Green); WriteInColor(" Show Assignements\n", ConsoleColor.Cyan); //show all assignement info WriteInColor("5.", ConsoleColor.Green); WriteInColor(" Show Trainers per Course\n", ConsoleColor.Cyan); //show trainers per course WriteInColor("6.", ConsoleColor.Green); WriteInColor(" Show Students per Course\n", ConsoleColor.Cyan); //show students per course WriteInColor("7.", ConsoleColor.Green); WriteInColor(" Show Assignement per Course\n", ConsoleColor.Cyan); //show assignement per course WriteInColor("8.", ConsoleColor.Green); WriteInColor(" Show Assignements per Student\n", ConsoleColor.Cyan); //show assignement per student WriteInColor("9.", ConsoleColor.Green); WriteInColor(" Show Student with more than one Course\n", ConsoleColor.Cyan); //show students with more than one course WriteInColor("10.", ConsoleColor.Green); WriteInColor(" Return\n", ConsoleColor.Red); Console.Write(Environment.NewLine); int selection = InputMinMax(1, 10); switch (selection) { case 1: ShowData.ShowCourses(Courses); PressKeyToContinue(); DisplaydataMenu(); break; case 2: ShowData.ShowTrainers(Trainers); PressKeyToContinue(); DisplaydataMenu(); break; case 3: ShowData.ShowStudents(Students); PressKeyToContinue(); DisplaydataMenu(); break; case 4: ShowData.ShowAssignements(Assignements); PressKeyToContinue(); DisplaydataMenu(); break; case 5: ShowData.ShowTrainerPerCourse(Courses); PressKeyToContinue(); DisplaydataMenu(); break; case 6: ShowData.ShowStudentsPerCourse(Courses); PressKeyToContinue(); DisplaydataMenu(); break; case 7: ShowData.ShowAssignementPerCourse(Courses); PressKeyToContinue(); DisplaydataMenu(); break; case 8: ShowData.ShowAssignementPerStudent(Students); PressKeyToContinue(); DisplaydataMenu(); break; case 9: ShowData.ShowStudentsWithManyCourses(Students); PressKeyToContinue(); DisplaydataMenu(); break; case 10: ShowMainMenu(); break; default: InvalidSelection(); DisplaydataMenu(); break; } }