public StudentCourseTask(CourseAttandee forStudent, Course inCourse, string TaskName, float TaskGrade) { ForStudent = forStudent; InCourse = inCourse; Name = TaskName; Grade = TaskGrade; }
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); }
public bool RemoveStudent(CourseAttandee student) { if (CheckAttending(student)) { return(mAttendees.Remove(student)); } return(false); }
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); }
public bool CheckAttending(CourseAttandee studentToFind) { return(CheckAttending(studentToFind.Name)); }