private static void CourseSelection(Assignment assignment) { Console.Clear(); Console.WriteLine("\n\t\t\tChoose Course/Courses\n\n\tType Course Number to Assign and PRESS Enter or PRESS Enter without typing a number to exit\n"); CourseLogic.PrintAllCourses(); var choise = "k"; while (true) { choise = Console.ReadLine(); if (!String.IsNullOrWhiteSpace(choise) && Convert.ToInt32(choise) <= CourseLogic.allCoursesList.Count) { assignment.assignmentsCourse = CourseLogic.allCoursesList[Convert.ToInt32(choise) - 1]; if (!assignment.assignmentsCourse.assignmentsPerCourse.Contains(assignment)) { assignment.assignmentsCourse.assignmentsPerCourse.Add(assignment); } Console.WriteLine($"{assignment.Title.ToUpper()} added to {assignment.assignmentsCourse.Title.ToUpper()}\nPress Enter to exit or choose another course..."); } else { break; } } }
private static void CourseSelection(Student student) { Console.Clear(); Console.WriteLine("\n\t\t\tChoose Course/Courses\n\n\tType Course Number to Assign and PRESS Enter or PRESS Enter without typing a number to exit\n"); CourseLogic.PrintAllCourses(); var choise = "k"; while (true) { choise = Console.ReadLine(); if (!String.IsNullOrWhiteSpace(choise) && Convert.ToInt32(choise) <= CourseLogic.allCoursesList.Count) { student.studentsCourse = CourseLogic.allCoursesList[Convert.ToInt32(choise) - 1]; student.studentsCourses.Add(student.studentsCourse); if (!student.studentsCourse.studentsPerCourse.Contains(student)) { student.studentsCourse.studentsPerCourse.Add(student); } Console.WriteLine($"Student : {student.FirstName.ToUpper()} added to {student.studentsCourse.Title.ToUpper()}\n\nPress Enter to exit or choose another course..."); } else { break; } } if (student.studentsCourses.Count > 1) // Students With More than One Course List { studentsWithMoreThanOneCourseList.Add(student); } }
public static void PrintMenu() { while (true) { Console.Clear(); Console.WriteLine("\tLists Menu \n1) All Courses \n2) All Assignments \n3) All Trainers \n4) All Students \n5) Trainers Per Course \n6) Assignments Per Course \n7) Students per Course" + "\n8) Assignments per Student \n9) Students with two courses or more \n10) Assignment Submissions \n\n"); Console.Write("Select an option , or press Enter to return to Main Menu : "); switch (Console.ReadLine()) { case "1": if (CourseLogic.allCoursesList.Count == 0) { Console.Clear(); Console.WriteLine("No courses have been registered yet.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } else { Console.Clear(); CourseLogic.PrintAllCourses(); Console.Write("\n\nPress Enter to return to View menu."); Console.ReadLine(); continue; } case "2": if (AssignmentsLogic.allAssignmentsList.Count == 0) { Console.Clear(); Console.WriteLine("No assignments have been registered yet.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } else { Console.Clear(); AssignmentsLogic.PrintAllAssignments(); Console.Write("\n\nPress Enter to return to View menu."); Console.ReadLine(); continue; } case "3": if (TrainersLogic.allTrainersList.Count == 0) { Console.Clear(); Console.WriteLine("No trainers have been registered yet.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } else { Console.Clear(); TrainersLogic.PrintAllTrainers(); Console.Write("\n\nPress Enter to return to View menu."); Console.ReadLine(); continue; } case "4": if (StudentsLogic.allStudentsList.Count == 0) { Console.Clear(); Console.WriteLine("No students have been registered yet.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } else { Console.Clear(); StudentsLogic.PrintAllStudents(); Console.Write("\n\nPress Enter to return to View menu."); Console.ReadLine(); continue; } case "5": if (CourseLogic.allCoursesList.Count == 0 || TrainersLogic.allTrainersList.Count == 0) { Console.Clear(); Console.WriteLine("No trainers or courses have been registered yet.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } CourseLogic.PrintAllTrainersPerCourse(); continue; case "6": if (AssignmentsLogic.allAssignmentsList.Count == 0 || CourseLogic.allCoursesList.Count == 0) { Console.Clear(); Console.WriteLine("No assignments or courses have been registered yet.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } else { CourseLogic.PrintAllAssignmentsPerCourse(); continue; } case "7": if (StudentsLogic.allStudentsList.Count == 0 || CourseLogic.allCoursesList.Count == 0) { Console.Clear(); Console.WriteLine("No students or courses have been registered yet.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } CourseLogic.PrintAllStudentsPerCourse(); continue; case "8": if (StudentsLogic.allStudentsList.Count == 0 || AssignmentsLogic.allAssignmentsList.Count == 0) { Console.Clear(); Console.WriteLine("No students or assignments have been registered yet.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } StudentsLogic.PrintAllAssignmentsPerStudent(); continue; case "9": if (StudentsLogic.studentsWithMoreThanOneCourseList.Count == 0) { Console.Clear(); Console.WriteLine("No student has more than one course.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } StudentsLogic.PrintAllStudentsWithMoreThanOneCourses(); continue; case "10": if (StudentsLogic.allStudentsList.Count == 0 || AssignmentsLogic.allAssignmentsList.Count == 0) { Console.Clear(); Console.WriteLine("No students or assignments have been registered yet.\n\nPress Enter to return to View Menu"); Console.ReadLine(); continue; } StudentsLogic.AssignmentSubmissions(); continue; default: break; } break; } }