Esempio n. 1
0
 public void RemoveObserver(IStudentObserver student)
 {
     for (int i = 0; i < coursesList.Count; i++)
     {
         coursesList[i].RemoveObserver(student);
     }
     studentList.Remove(student);
 }
 private bool ValidateStudent(IStudentObserver o)
 {
     if (o.NameOfStudent != null && o.Age < 30 && (o.NumberOfStudent >= 10000 && o.NumberOfStudent <= 99999))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public void AddObserver(IStudentObserver o)
 {
     for (int i = 0; i < studentObservers.Count; i++)
     {
         if (studentObservers[i].NumberOfStudent == o.NumberOfStudent)
         {
             return;
         }
     }
     if (ValidateStudent(o))
     {
         studentObservers.Add(o);
     }
 }
Esempio n. 4
0
 public void AddObserver(IStudentObserver student, Course course)
 {
     for (int i = 0; i < studentList.Count; i++)
     {
         if (studentList[i].NumberOfStudent == student.NumberOfStudent)
         {
             return;
         }
     }
     if (ValidateStudent(student))
     {
         studentList.Add(student);
         course.AddObserver(student);
     }
 }
 public void RemoveObserver(IStudentObserver o)
 {
     studentObservers.Remove(o);
 }
Esempio n. 6
0
 public void Detach(IStudentObserver student)
 {
     studentObserverList.Remove(student);
 }
Esempio n. 7
0
 public void Attach(IStudentObserver student)
 {
     studentObserverList.Add(student);
 }