public void ShowProfile() { Console.WriteLine(); Person person = Person.FindPersonInOrganization(this.allpersons); if (person is Student) { Student student = person as Student; student.Tostring(); } if (person is Teacher) { Teacher teacher = person as Teacher; teacher.Tostring(); } database_Login.ShowInformation(); }
public static void Application(Database_Login database_Login, Database_CourseList database_CourseList, Database_Fees database_Fees, Database_Calendar calendar) { List <Person> all = database_Login.AllPeople(); List <Course> courses = database_CourseList.courseListe; UpdateEveryPersonStatus(all, courses, database_Login, database_CourseList, database_Fees); bool connexion = false; FirstDisplay(); while (connexion == false) { BlackAndWhite(); Console.WriteLine("Enter your email:"); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Red; string answer = Console.ReadLine(); Console.ResetColor(); BlackAndWhite(); Console.WriteLine("Enter your password"); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Red; string answer2 = Console.ReadLine(); Console.ResetColor(); Console.WriteLine(); foreach (Person person in all) { if (person.email == answer && person.password == answer2) { connexion = true; Console.WriteLine("Welcome to you portal " + person.name + " " + person.surname); Console.WriteLine(); if (person.status.ToUpper() == "STUDENT") { Student student = person as Student; string answerstud = ""; while (answerstud != "exit") { Console.WriteLine("Type the number:"); Console.WriteLine("1) To view your personal information."); Console.WriteLine("2) To view your marks."); Console.WriteLine("3) To view your Attendance report."); Console.WriteLine("4) To view your finance."); Console.WriteLine("5) To change your password."); Console.WriteLine("6) To view the academic calendar."); Console.WriteLine("type exit to leave"); Console.WriteLine(); answerstud = Console.ReadLine(); switch (answerstud) { case "1": student.Tostring(); Console.WriteLine(); break; case "2": student.DisplayAllMarks(); Console.WriteLine(); break; case "3": student.DisplayAllAttendanceReport(); Console.WriteLine(); break; case "4": student.DisplayFeeStatues(); break; case "5": database_Login.ChangePassword(student.ID); break; case "6": ManageCalendarRestricted(calendar); Console.WriteLine(); break; case "exit": Console.WriteLine(); break; default: Console.WriteLine("Type correct answer"); Console.WriteLine(); break; } } } if (person.status.ToUpper() == "PROFESSOR") { Teacher teacher = person as Teacher; string answerperson = ""; while (answerperson != "exit") { Console.WriteLine("Type the number:"); Console.WriteLine("1) To view your personal information."); Console.WriteLine("2) To modify the marks of your student."); Console.WriteLine("3) To modify the Attendance report of your students."); Console.WriteLine("4) To change your password."); Console.WriteLine("5) To view the academic calendar."); Console.WriteLine("type exit to leave"); Console.WriteLine(); answerperson = Console.ReadLine(); switch (answerperson) { case "1": teacher.Tostring(); Console.WriteLine(); break; case "2": teacher.ModifyMarksInCourses(); Console.WriteLine(); break; case "3": teacher.ModifyAttendanceInCourses(); Console.WriteLine(); break; case "4": database_Login.ChangePassword(teacher.ID); break; case "5": ManageCalendarRestricted(calendar); Console.WriteLine(); break; case "exit": Console.WriteLine(); break; default: Console.WriteLine("Type correct answer"); Console.WriteLine(); break; } } } if (person.status.ToUpper() == "ADMINISTRATOR") { Administrator admin = person as Administrator; string answerperson = ""; while (answerperson != "exit") { Console.WriteLine("Type the number:"); Console.WriteLine("1) To view your personal information."); Console.WriteLine("2) To modify the marks of a student."); Console.WriteLine("3) To modify the Attendance report of a student."); Console.WriteLine("4) To add a new person to the organization"); Console.WriteLine("5) To modify a person's profile to the organization"); Console.WriteLine("6) To remove a person from the organization"); Console.WriteLine("7) To view someone's informations."); Console.WriteLine("8) To Create a new course."); Console.WriteLine("9) To add a workgroup to a course."); Console.WriteLine("10) To add a student to a course;"); Console.WriteLine("11) To remove a student from a course."); Console.WriteLine("12) To change the teacher in charge of a workgroup in a course."); Console.WriteLine("13) To view all courses datas."); Console.WriteLine("14) To manage the finance status of a student."); Console.WriteLine("15) To see all the late assignements of a course."); Console.WriteLine("16) To see informations about the members of the organization."); Console.WriteLine("17) To change your password."); Console.WriteLine("18) To manage the academic calendar."); Console.WriteLine("type exit to leave"); Console.WriteLine(); answerperson = Console.ReadLine(); switch (answerperson) { case "1": admin.Tostring(); Console.WriteLine(); break; case "2": admin.ModifySomeonesMarks(); Console.WriteLine(); break; case "3": admin.ModifySomeonesAttendance(); Console.WriteLine(); break; case "4": admin.AddPersonInOrganization(); Console.WriteLine(); break; case "5": admin.ModifyProfile(); //have to remove it from the fees file too Console.WriteLine(); break; case "6": admin.RemovePersonFromOrganization(); Console.WriteLine(); break; case "7": admin.ShowProfile(); Console.WriteLine(); break; case "8": admin.CreateNewCourse(); Console.WriteLine(); break; case "9": admin.AddWorkGroupToACourse(); Console.WriteLine(); break; case "10": admin.AddPersonToACourse(); Console.WriteLine(); break; case "11": admin.RemoveStudentInCourse(); Console.WriteLine(); break; case "12": admin.ModifyTeacherInWorkGroup(); Console.WriteLine(); break; case "13": admin.ViewCourseInfos(); Console.WriteLine(); break; case "14": admin.database_Fees.ModifyDatas(); break; case "15": Console.WriteLine("All courses in the organization:"); Console.WriteLine(); foreach (Course course in admin.allcourses) { Console.WriteLine(course.name); } Console.WriteLine(); Console.WriteLine("Which course do you want to check : "); string answ = Console.ReadLine().ToUpper(); foreach (Course c in admin.allcourses) { if (c.name.ToUpper() == answ) { c.HowMuchMissed(); } } Console.WriteLine(); break; case "16": database_Login.ShowSortedFile(); Console.WriteLine(); break; case "17": database_Login.ChangePassword(admin.ID); Console.WriteLine(); break; case "18": ManageCalendar(calendar); Console.WriteLine(); break; case "exit": Console.WriteLine(); break; default: Console.WriteLine("Type correct answer"); Console.WriteLine(); break; } } } } } } }