/// <summary> /// Get the first_name, field of study, and the information relative /// to the classe Member_of_school /// </summary> public string GetTeacherFile(string teacher_id) { string info = ""; Faculty_member teacher = FindTeacher(teacher_id); info = ("Last_name:" + teacher.Last_name + " First_name:" + teacher.First_name + "\n Fields of study: " + teacher.Subject + "\n Date_of_birth: " + teacher.Date_of_birth + " Gender: " + teacher.Gender + "\n email: " + teacher.Mail); return(info); }
public void Move_CourseFromTimetable(Student student) { DisplayTimeTable(student); int timer; int starthour = 0; int nbhour = 0; DateTime day = new DateTime(2000, 01, 01); TimeSpan interval; do { timer = 0; Console.WriteLine("Select the day of the course to move like 01/18/2020"); string date = Console.ReadLine().Replace("/", String.Empty); Console.WriteLine(date); try { day = new DateTime(Convert.ToInt32(date.Substring(4)), Convert.ToInt32(date.Substring(0, 2)), Convert.ToInt32(date.Substring(2, 2))); } catch (Exception e) { Console.WriteLine("Date impossible"); timer--; } Console.WriteLine("Select the hour begin of the course to move. Write only the hour without minutes as 8 for 8:00"); try { starthour = Convert.ToInt32(Console.ReadLine()); } catch (Exception e) { Console.WriteLine("Hour impossible"); timer--; } if (starthour < 7 || starthour > 22) { timer--; Console.WriteLine("This hour is not in the TimeTable"); } interval = day - student.Timetable.Date[0]; if ((int)interval.TotalDays < 0 || (int)interval.TotalDays > student.Timetable.CourseTable.GetLength(0)) { timer--; Console.WriteLine("This Date is out of the TimeTable"); } else if (student.Timetable.CourseTable[(int)interval.TotalDays, starthour - 7] == new Course("", "", "")) { timer--; Console.WriteLine("This slot is empty"); } Console.WriteLine("Select the duration of the course with only the number of hour"); try { nbhour = Convert.ToInt32(Console.ReadLine()); } catch (Exception e) { Console.WriteLine("Hour impossible"); timer--; } } while (timer < 0); int starthour2 = 0; int nbhour2 = 0; DateTime day2 = new DateTime(2000, 01, 01); TimeSpan interval2; do { timer = 0; Console.WriteLine("Select the day of the course to move like 01/18/2020"); string date = Console.ReadLine().Replace("/", String.Empty); Console.WriteLine(date); try { day2 = new DateTime(Convert.ToInt32(date.Substring(4)), Convert.ToInt32(date.Substring(0, 2)), Convert.ToInt32(date.Substring(2, 2))); } catch (Exception e) { Console.WriteLine("Date impossible"); timer--; } Console.WriteLine("Select the hour begin of the course to move. Write only the hour without minutes as 8 for 8:00"); try { starthour2 = Convert.ToInt32(Console.ReadLine()); } catch (Exception e) { Console.WriteLine("Hour impossible"); timer--; } if (starthour2 < 7 || starthour2 > 22) { timer--; Console.WriteLine("This hour is not in the TimeTable"); } interval2 = day - student.Timetable.Date[0]; if ((int)interval2.TotalDays < 0 || (int)interval2.TotalDays > student.Timetable.CourseTable.GetLength(0)) { timer--; Console.WriteLine("This Date is out of the TimeTable"); } else if (student.Timetable.CourseTable[(int)interval2.TotalDays, starthour2 - 7] != new Course("", "", "")) { timer--; Console.WriteLine("This slot is already used"); } Console.WriteLine("Select the duration of the course with only the number of hour"); try { nbhour2 = Convert.ToInt32(Console.ReadLine()); } catch (Exception e) { Console.WriteLine("Hour impossible"); timer--; } } while (timer < 0); Faculty_member teacher = new Faculty_member("", "", "", "", "", "", "", "", new List <Student>(), promoAdmin); string topic = ""; string professor = ""; string description = ""; for (int i = starthour - 7; i < starthour - 7 + nbhour; i++) { topic = student.Timetable.CourseTable[(int)interval.TotalDays, i].Topic; professor = student.Timetable.CourseTable[(int)interval.TotalDays, i].Professor; description = student.Timetable.CourseTable[(int)interval.TotalDays, i].Description; student.Timetable.CourseTable[(int)interval.TotalDays, i] = new Course("", "", ""); } for (int i = starthour2 - 7; i < starthour2 - 7 + nbhour2; i++) { foreach (Faculty_member teacherName in promoAdmin.ListTeacherPromo) { if (student.Timetable.CourseTable[(int)interval.TotalDays, i].Professor == teacherName.TeacherName) { teacher = teacherName; } } student.Timetable.CourseTable[(int)interval2.TotalDays, i] = new Course(topic, professor, description, student); if (teacher.Timetable.CourseTable[(int)interval2.TotalDays, i] == new Course("", "", "")) { teacher.Timetable.CourseTable[(int)interval.TotalDays, i] = new Course(topic, professor, description); } } }
public void Modify_Description_CourseFromTimeTable(Student student) { int timer; int starthour = 0; int nbhour = 0; DateTime day = new DateTime(2000, 01, 01); TimeSpan interval; do { timer = 0; Console.WriteLine("Select the day of the course like 01/18/2020"); string date = Console.ReadLine().Replace("/", String.Empty); Console.WriteLine(date); try { day = new DateTime(Convert.ToInt32(date.Substring(4)), Convert.ToInt32(date.Substring(0, 2)), Convert.ToInt32(date.Substring(2, 2))); } catch (Exception e) { Console.WriteLine("Date impossible"); timer--; } Console.WriteLine("Select the hour begin of the course. Write only the hour without minutes as 8 for 8:00"); try { starthour = Convert.ToInt32(Console.ReadLine()); } catch (Exception e) { Console.WriteLine("Hour impossible"); timer--; } if (starthour < 7 || starthour > 22) { timer--; Console.WriteLine("This hour is not in the TimeTable"); } interval = day - student.Timetable.Date[0]; if ((int)interval.TotalDays < 0 || (int)interval.TotalDays > student.Timetable.CourseTable.GetLength(0)) { timer--; Console.WriteLine("This Date is out of the TimeTable"); } else if (student.Timetable.CourseTable[(int)interval.TotalDays, starthour - 7] != new Course("", "", "")) { timer--; Console.WriteLine("This slot is already used"); } Console.WriteLine("Select the duration of the course with only the number of hour"); try { nbhour = Convert.ToInt32(Console.ReadLine()); } catch (Exception e) { Console.WriteLine("Hour impossible"); timer--; } } while (timer < 0); Faculty_member teacher = new Faculty_member("", "", "", "", "", "", "", "", new List <Student>(), promoAdmin); Console.WriteLine("Write the new description"); string description = Console.ReadLine(); for (int i = starthour - 7; i < starthour - 7 + nbhour; i++) { student.Timetable.CourseTable[(int)interval.TotalDays, i].Description = description; } string answer; do { Console.WriteLine("Do this action on all participant? yes or no"); answer = Console.ReadLine(); timer = 0; if (answer != "yes" && answer != "no") { timer--; } } while (timer < 0); if (answer == "yes") { for (int i = starthour - 7; i < starthour - 7 + nbhour; i++) { foreach (Student students in student.Timetable.CourseTable[(int)interval.TotalDays, i].Participant) { students.Timetable.CourseTable[(int)interval.TotalDays, i].Description = description; } } } }
public void DeleteCourseFromTimetable(Student student) { DisplayTimeTable(student); int timer; int starthour = 0; int nbhour = 0; DateTime day = new DateTime(2000, 01, 01); TimeSpan interval; do { timer = 0; Console.WriteLine("Select the day of the course like 01/18/2020"); string date = Console.ReadLine().Replace("/", String.Empty); Console.WriteLine(date); try { day = new DateTime(Convert.ToInt32(date.Substring(4)), Convert.ToInt32(date.Substring(0, 2)), Convert.ToInt32(date.Substring(2, 2))); } catch (Exception e) { Console.WriteLine("Date impossible"); timer--; } Console.WriteLine("Select the hour begin of the course. Write only the hour without minutes as 8 for 8:00"); try { starthour = Convert.ToInt32(Console.ReadLine()); } catch (Exception e) { Console.WriteLine("Hour impossible"); timer--; } if (starthour < 7 || starthour > 22) { timer--; Console.WriteLine("This hour is not in the TimeTable"); } interval = day - student.Timetable.Date[0]; if ((int)interval.TotalDays < 0 || (int)interval.TotalDays > student.Timetable.CourseTable.GetLength(0)) { timer--; Console.WriteLine("This Date is out of the TimeTable"); } else if (student.Timetable.CourseTable[(int)interval.TotalDays, starthour - 7] == new Course("", "", "")) { timer--; Console.WriteLine("This slot is already empty"); } Console.WriteLine("Select the duration of the course with only the number of hour"); try { nbhour = Convert.ToInt32(Console.ReadLine()); } catch (Exception e) { Console.WriteLine("Hour impossible"); timer--; } } while (timer < 0); Faculty_member teacher = new Faculty_member("", "", "", "", "", "", "", "", new List <Student>(), promoAdmin); for (int i = starthour - 7; i < starthour - 7 + nbhour; i++) { foreach (Faculty_member teacherName in promoAdmin.ListTeacherPromo) { if (student.Timetable.CourseTable[(int)interval.TotalDays, i].Professor == teacherName.TeacherName) { teacher = teacherName; } } student.Timetable.CourseTable[(int)interval.TotalDays, i] = new Course("", "", ""); if (teacher.Timetable.CourseTable[(int)interval.TotalDays, i] != new Course("", "", "")) { teacher.Timetable.CourseTable[(int)interval.TotalDays, i] = new Course("", "", ""); } } string answer; do { Console.WriteLine("If you want to repeat it each week write yes, if not write no"); answer = Console.ReadLine(); if (answer != "yes" && answer != "no") { timer--; } } while (timer < 0); if (answer == "yes") { for (int j = (int)interval.TotalDays; j < student.Timetable.CourseTable.GetLength(0); j = +7) { for (int i = starthour - 7; i < starthour - 7 + nbhour; i++) { student.Timetable.CourseTable[j, i] = new Course("", "", ""); if (teacher.Timetable.CourseTable[(int)interval.TotalDays, i] != new Course("", "", "")) { teacher.Timetable.CourseTable[(int)interval.TotalDays, i] = new Course("", "", ""); } } } } }