Exemplo n.º 1
0
 public StudentCourseTask(CourseAttandee forStudent, Course inCourse, string TaskName, float TaskGrade)
 {
     ForStudent = forStudent;
     InCourse   = inCourse;
     Name       = TaskName;
     Grade      = TaskGrade;
 }
Exemplo n.º 2
0
        public bool SignUp(CourseAttandee aStudent, Course toCourse)
        {
            if (aStudent == null)
            {
                throw new StudentNotFound("Student does not exist");
            }
            if (toCourse == null)
            {
                throw new CourseNotFound("Course does not exist");
            }
            try
            {
                aStudent.AttendedCourse = toCourse;
                toCourse.Attendees      = new List <CourseAttandee>()
                {
                    aStudent
                };
                Console.WriteLine($"Succesfully signed up {aStudent} to {toCourse}");
                return(true);
            }
            catch (StudentIsBusy e)
            {
                Console.WriteLine($"\n\tThrown an {e.GetType()} Exception saying: {e.Message}\n" + e.StackTrace);
            }
            catch (Exception e)
            {
                Console.WriteLine($"\t\tException! caught:\n{e.Message}\n" + e.StackTrace);
                if (e.Message.Contains("already full!") && aStudent.AttendedCourse != null)
                {
                    aStudent.AttendedCourse = null;
                }
            }

            return(false);
        }
Exemplo n.º 3
0
 public bool RemoveStudent(CourseAttandee student)
 {
     if (CheckAttending(student))
     {
         return(mAttendees.Remove(student));
     }
     return(false);
 }
Exemplo n.º 4
0
 public bool UnSignUp(CourseAttandee aStudent, Course fromCourse)
 {
     if (fromCourse.CheckAttending(aStudent.Name))
     {
         fromCourse.RemoveStudent(aStudent);
         aStudent.AttendedCourse = null;
         Console.WriteLine($"Succesfully un-signed up {aStudent} from {fromCourse}");
         return(true);
     }
     Console.WriteLine($"'tINFO\t Student {aStudent} has not been currently signed up for course {fromCourse}\n");
     return(true);
 }
Exemplo n.º 5
0
 public bool CheckAttending(CourseAttandee studentToFind)
 {
     return(CheckAttending(studentToFind.Name));
 }