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
 public static void sortStudens(Student[] students, StudentOptions options)
 {
     if (options == StudentOptions.MSSV)
     {
         Array.Sort(students);
     }
     else if (options == StudentOptions.fullname)
     {
         Array.Sort(students, Student.SortFullNameAscending());
     }
 }
Beispiel #3
0
        private void GetAllStudent()
        {
            StudentOptions studentOptions = new StudentOptions(displayAll, displayOne);
            List <Student> students       = studentOptions.DisplayAllStudents();

            Console.WriteLine("Student who are younger than 25 years");
            IEnumerable <Student> studentsWithAGe25 = from student in students
                                                      where student.Age < 25
                                                      orderby student.Age
                                                      select student;


            foreach (Student st in studentsWithAGe25)
            {
                Console.WriteLine("name " + st.Name + " Age: " + st.Age);
            }
        }
Beispiel #4
0
        public List <StudentOptions> GetCalledNames(ClassOptions options)
        {
            var list = new List <StudentOptions>();

            var filePath = GlobalDefaults.GetCalledNamesConfigPath(options);
            var lines    = filePath.ReadAllLines();

            if (lines.Length > 0)
            {
                foreach (var line in lines)
                {
                    var student = StudentOptions.FromString(line);
                    if (student is not null)
                    {
                        list.Add(student);
                    }
                }
            }

            return(list);
        }
        public Student GetStudentById(string id)
        {
            StudentOptions studentOptions = new StudentOptions(displayAll, displayOne);

            return(studentOptions.DisplayStudentById(int.Parse(id)));
        }
        public List <Student> GetAllStudents()
        {
            StudentOptions studentOptions = new StudentOptions(displayAll, displayOne);

            return(studentOptions.DisplayAllStudents());
        }
 private void ShowStudent(StudentOptions student, bool isShowMask = true)
 {
     tbxName.Text = student.ToString(isShowMask);
 }