//Ask user number of entries, then creates object and calls method to fill data then stores to list private static void AddStudent() { 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); Student myStudent = new Student(); Console.WriteLine("Select the course to add the student (number). "); int num = InputMinMax(1, Courses.Count) - 1; myStudent.AddCourse(Courses[num]); myStudent.FillData(); if (Courses[num].CheckStudent(myStudent)) { EntryAlreadyExist(); PressKeyToContinue(); } else { Students.Add(myStudent); Courses[num].AddStudent(myStudent); Console.Clear(); ShowData.ShowStudents(Students); PressKeyToContinue(); } } }
//Ask user number of entries, then creates object and calls method to fill data then stores to list private static void AddAssignements() { 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); Assignement myAssignement = new Assignement(); Console.WriteLine("Select the course to add the assignement : "); int num = InputMinMax(1, Courses.Count) - 1; ShowData.ShowStudents(Students); Console.WriteLine("Select the student to add the assignement : "); int num1 = InputMinMax(1, Students.Count) - 1; myAssignement.FillData(Courses[num].StartDate, Courses[num].EndDate); //Checks if assignement and student exist in current course if (Courses[num].CheckAssignement(myAssignement) && Courses[num].CheckStudent(Students[num1])) { EntryAlreadyExist(); PressKeyToContinue(); } else { Students[num1].AddAssignement(myAssignement); Courses[num].AddAssignement(myAssignement); myAssignement.Course = Courses[num];//We need course to access date for submisssion date Assignements.Add(myAssignement); Console.Clear(); ShowData.ShowAssignements(Assignements); 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; } }