private static void ShowMenuGroups(Univercity U) { Console.Write("1 - Добавить запись\n2 - Удалить запись\n3 - Перевести в другую группу\n4 - Вывести список групп\n" + "5 - Вывести список студентов в группе\n6 - Вывести информацию о студенте\n0 - В главное меню"); int s; do { Console.Write("\nВведите соответствуещее значение: "); s = Int32.Parse(Console.ReadLine()); switch (s) { case 1: U.AddGroup(new Group(new NumberGroup(InputSpecialty(), GetNowYear()))); break; case 2: U.RemoveGroup(InputNumberGroup()); break; case 3: U.MoveStudentToAnotherGroup(InputId(), InputNumberGroup()); break; case 4: ShowGroups(U); break; case 5: ShowStudentsInGroup(U, InputNumberGroup()); break; case 6: ShowInfoOfStudentInGroup(U, InputId()); break; } } while (s != 0); }
public static void InitializeUnivercity(Univercity U) { Random Rand = new Random(); U.AddGroup(new Group(new NumberGroup(Specialty.Informatics, 2018))); U.AddGroup(new Group(new NumberGroup(Specialty.StateAudit, 2018))); U.Students.Add(new Student(new FullName("Илья", "Иванов", "Андреевич"), GetRandDate())); U.Students.Add(new Student(new FullName("Петр", "Борисов", "Петрович"), GetRandDate())); U.Groups[0].AddStudent(new Student(new FullName("Илья", "Иванов", "Андреевич"), GetRandDate())); U.Groups[0].AddStudent(new Student(new FullName("Иван", "Петров", "Олегович"), GetRandDate())); U.Groups[0].AddStudent(new Student(new FullName("Мария", "Иванова", "Олеговна"), GetRandDate())); U.Groups[1].AddStudent(new Student(new FullName("Ольга", "Зинко", "Евгеньевна"), GetRandDate())); U.Groups[1].AddStudent(new Student(new FullName("Петр", "Борисов", "Петрович"), GetRandDate())); U.AddTeacher(new Teacher(new FullName("Илья", "Смирнов", "Олегович"), GetRandDate(), Title.Aspirant)); U.AddTeacher(new Teacher(new FullName("Борис", "Петров", "Дмитриевич"), GetRandDate(), Title.Lecture)); U.AddTeacher(new Teacher(new FullName("Мария", "Иванова", "Олеговна"), GetRandDate(), Title.Lecture)); List <ISubject> winterSession = new List <ISubject>() { new Subject("Математика", SubjectType.Exem), new Subject("Физика", SubjectType.Exem), new Subject("Информатика", SubjectType.Credited), new Subject("Психология", SubjectType.Credited) }; List <ISubject> summerSession = new List <ISubject>() { new Subject("Английский", SubjectType.Credited), new Subject("История", SubjectType.Credited) }; U.Subjects.AddRange(winterSession); U.Subjects.AddRange(summerSession); foreach (var t in U.Subjects) { t.AddTeacher(GetRandTeacher()); } U.AddSession(new Session(SessionType.Winter, 2018)); U.AddSession(new Session(SessionType.Summer, 2018)); U.Sessions[0].AddSubjects(U.Subjects); U.Sessions[1].AddSubjects(summerSession); foreach (var session in U.Sessions) { foreach (var group in U.Groups) { session.AddSubjectsInGroup(group); } } U.Sessions[0].Groups[0].Students.ForEach(delegate(IStudent student) { student.Subjects.ForEach(delegate(ISubject subject) { subject.AddAssessment(GetRandAssessment()); }); }); U.Sessions[0].Groups[1].Students.ForEach(delegate(IStudent student) { student.Subjects.ForEach(delegate(ISubject subject) { subject.AddAssessment(GetRandAssessment()); }); }); foreach (var subject in U.Subjects) { subject.AddTeacher(GetRandTeacher()); } DateTime GetRandDate() { return(new DateTime(Rand.Next(1800, 1890), Rand.Next(1, 13), Rand.Next(1, 29))); } ITeacher GetRandTeacher() { return(U.Teachers[Rand.Next(U.Teachers.Count)]); } Assessment GetRandAssessment() { return((Assessment)Rand.Next(Enum.GetNames(typeof(Assessment)).Length)); } }