/// <summary> /// Adjusts the TuitionRateFactore of Student based on the ProbationState /// </summary> /// <param name="student">Student object</param> /// <returns>Student object's appropriate TuitionRateFactor</returns> public override double TuitionRateAdjustment(Student student) { BITCollege_MGContext db = new BITCollege_MGContext(); Registration registration = db.Registrations.Where(x => x.StudentId == student.StudentId).SingleOrDefault(); double tuition = this.TuitionRateFactor; if (student.Registration.Count >= 5 && (registration.Grade != null)) { tuition = 1.035; } return(tuition); }
/// <summary> /// Checks for an existing RegularState instance. /// Instantiates an RegularState and populates it to the database if there is none. /// </summary> /// <returns>honourState : instance of the RegularState sub class</returns> public static RegularState GetInstance() { if (regularState == null) { BITCollege_MGContext db = new BITCollege_MGContext(); regularState = db.RegularStates.SingleOrDefault(); if (regularState == null) { RegularState regularState = new RegularState(); db.RegularStates.Add(regularState); db.SaveChanges(); } } return(regularState); }
/// <summary> /// Checks for an existing ProbationState instance. /// Instantiates an ProbationState and populates it to the database if there is none. /// </summary> /// <returns>honourState : instance of the ProbationState sub class</returns> public static ProbationState GetInstance() { if (probationState == null) { BITCollege_MGContext db = new BITCollege_MGContext(); probationState = db.ProbationStates.SingleOrDefault(); if (probationState == null) { ProbationState probationState = new ProbationState(); db.ProbationStates.Add(probationState); db.SaveChanges(); } } return(probationState); }
/// <summary> /// Checks for an existing SuspendedState instance. /// Instantiates an SuspendedState and populates it to the database if there is none. /// </summary> /// <returns>honourState : instance of the SuspendedState sub class</returns> public static SuspendedState GetInstance() { if (suspendedState == null) { BITCollege_MGContext db = new BITCollege_MGContext(); suspendedState = db.SuspendedStates.SingleOrDefault(); if (suspendedState == null) { SuspendedState suspendedState = new SuspendedState(); db.SuspendedStates.Add(suspendedState); db.SaveChanges(); } } return(suspendedState); }
/// <summary> /// /// </summary> /// <returns>nextStudent : instance of the NextStudent sub class</returns> public static NextStudent GetInstance() { if (nextStudent == null) { BITCollege_MGContext db = new BITCollege_MGContext(); nextStudent = db.NextStudents.SingleOrDefault(); if (nextStudent == null) { NextStudent nextStudent = new NextStudent(); db.NextStudents.Add(nextStudent); db.SaveChanges(); } } return(nextStudent); }
/// <summary> /// /// </summary> /// <returns>nextMasteryCourse : instance of the NextMasteryCourse sub class</returns> public static NextMasteryCourse GetInstance() { if (nextMasteryCourse == null) { BITCollege_MGContext db = new BITCollege_MGContext(); nextMasteryCourse = db.NextMasteryCourses.SingleOrDefault(); if (nextMasteryCourse == null) { NextMasteryCourse nextMasteryCourse = new NextMasteryCourse(); db.NextMasteryCourses.Add(nextMasteryCourse); db.SaveChanges(); } } return(nextMasteryCourse); }
/// <summary> /// Checks for an existing HonoursState instance. /// Instantiates an HonoursState and populates it to the database if there is none. /// </summary> /// <returns>honourState : instance of the HonoursState sub class</returns> public static HonoursState GetInstance() { if (honoursState == null) { BITCollege_MGContext db = new BITCollege_MGContext(); honoursState = db.HonoursStates.SingleOrDefault(); if (honoursState == null) { HonoursState honoursState = new HonoursState(); db.HonoursStates.Add(honoursState); db.SaveChanges(); } } return(honoursState); }
/// <summary> /// /// </summary> /// <returns>nextRegistration : instance of the NextRegistration sub class</returns> public static NextRegistration GetInstance() { if (nextRegistration == null) { BITCollege_MGContext db = new BITCollege_MGContext(); nextRegistration = db.NextRegistrations.SingleOrDefault(); if (nextRegistration == null) { NextRegistration nextRegistration = new NextRegistration(); db.NextRegistrations.Add(nextRegistration); db.SaveChanges(); } } return(nextRegistration); }