Beispiel #1
0
        private static bool SelectStudentOption(int studentID)
        {
            while (true)
            {
                StudentManager sm = new StudentManager();
                sm.ShowPersonalMessage(studentID);
                Console.WriteLine();

                Console.WriteLine("1. view my schedule per course");
                Console.WriteLine("2. view due date per assignment");
                Console.WriteLine("3. submit assignment");
                Console.WriteLine("9. Logout");
                Console.WriteLine("0. Exit");

                string input = Console.ReadLine();
                Console.Clear();

                bool goodInput = Int32.TryParse(input, out int choice);
                if (!goodInput)
                {
                    continue;
                }

                if (choice == 0)
                {
                    break;
                }

                StudentOptions mainOption = (StudentOptions)choice;

                switch (mainOption)
                {
                case StudentOptions.viewSchedule:
                    AssignmentPerStudentManager manager = new AssignmentPerStudentManager();
                    manager.ReadSchedule(studentID);
                    break;

                case StudentOptions.viewDueDates:
                    AssignmentPerStudentManager manager2 = new AssignmentPerStudentManager();
                    manager2.ReadDueDates(studentID);
                    break;

                case StudentOptions.submitAssignment:
                    AssignmentPerStudentManager manager3 = new AssignmentPerStudentManager();
                    manager3.SubmitAssignmentPerCoursePerStudent(studentID);
                    break;

                case StudentOptions.logout:
                    Console.WriteLine("logging out");
                    Console.ReadKey();
                    Console.Clear();
                    return(false);

                default:
                    break;
                }
            }
            return(true);
        }
Beispiel #2
0
        private static bool SelectTrainerOption(int trainerID)
        {
            while (true)
            {
                TrainerManager tm = new TrainerManager();
                tm.ShowPersonalMessage(trainerID);
                Console.WriteLine();

                Console.WriteLine("1. view my courses");
                Console.WriteLine("2. view students per course");
                Console.WriteLine("3. view assignments per student per course");
                Console.WriteLine("4. mark assignments per student per course");
                Console.WriteLine("9. Logout");
                Console.WriteLine("0. Exit");

                string input = Console.ReadLine();
                Console.Clear();

                bool goodInput = Int32.TryParse(input, out int choice);
                if (!goodInput)
                {
                    continue;
                }

                if (choice == 0)
                {
                    break;
                }

                TrainerOptions mainOption = (TrainerOptions)choice;

                switch (mainOption)
                {
                case TrainerOptions.viewCourses:
                    TrainerPerCourseManager manager = new TrainerPerCourseManager();
                    manager.ReadTrainerCourses(trainerID);
                    break;

                case TrainerOptions.viewStudentsPerCourse:
                    StudentPerCourseManager manager2 = new StudentPerCourseManager();
                    manager2.Read();
                    break;

                case TrainerOptions.viewAssignmentsPerStudentPerCourse:
                    AssignmentPerStudentManager manager3 = new AssignmentPerStudentManager();
                    manager3.ReadAssignmentsPerCoursePerStudent();
                    break;

                case TrainerOptions.markAssignmentsPerStudentPerCourse:
                    AssignmentPerStudentManager manager4 = new AssignmentPerStudentManager();
                    manager4.MarkAssignmentsPerCoursePerStudent();
                    break;

                case TrainerOptions.logout:
                    Console.WriteLine("logging out");
                    Console.ReadKey();
                    Console.Clear();
                    return(false);

                default:
                    break;
                }
            }
            return(true);
        }