Esempio n. 1
0
 public void AddStudents(params Student[] addStudents)
 {
     foreach (var item in addStudents)
     {
         students.Add(item);
         StudentsCountChanged?.Invoke(this, new StudentListHandlerEventArgs(Name, "add new student", item));
     }
 }
Esempio n. 2
0
 public bool RemoveStudent(int j)
 {
     if (j >= students.Count || j < 1)
     {
         return(false);
     }
     StudentsCountChanged?.Invoke(this, new StudentListHandlerEventArgs(Name, "remove student", students[j]));
     students.RemoveAt(j);
     return(true);
 }
Esempio n. 3
0
 public void AddDefaults(int number)
 {
     for (int i = 0; i < number; i++)
     {
         string  firstName = $"Name{students.Count}";
         string  lastName  = $"LastName{students.Count}";
         int     group     = students.Count + 5;
         Student student   = new Student(new Person(firstName, lastName, new DateTime()), Education.Вachelor, group);
         student.AddExams(new Exam(firstName, students.Count + 3, new DateTime()));
         students.Add(student);
         StudentsCountChanged?.Invoke(this, new StudentListHandlerEventArgs(Name, "add default student", student));
     }
 }
Esempio n. 4
0
 public void AddStudents(TKey key, params Student[] arr)
 {
     if (arr.Length == 0)
     {
         arr = new Student[0];
         StudentsCountChanged?.Invoke(this, new StudentListHandlerEventArgs(CollectionName, "Added new element", arr[0]));
     }
     if (list == null)
     {
         list = new Dictionary <TKey, Student>();
     }
     for (int i = 0; i < arr.Length; i++)
     {
         list.Add(key, arr[i]);
         StudentsCountChanged?.Invoke(this, new StudentListHandlerEventArgs(CollectionName, "Added new element", arr[i]));
         StudentChanged?.Invoke(this, new StudentsChangedEventArgs <TKey>(CollectionName, Action.Add, "Added new element", key));
         list[key].PropertyChanged += PropChanged;
     }
 }
Esempio n. 5
0
 public void AddDefaults(TKey key)
 {
     list.Add(key, new Student(new Person("Jane", "Crocker", new DateTime(1996, 4, 13)), Education.Вachelor, 4));
     StudentsCountChanged?.Invoke(this, new StudentListHandlerEventArgs(CollectionName, "Added new default element", new Student(new Person("Jane", "Crocker", new DateTime(1996, 4, 13)), Education.Вachelor, 4)));
     list[key].PropertyChanged += PropChanged;
 }