Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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);
        }
Example #4
0
        /// <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);
        }
Example #5
0
        /// <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);
        }
Example #6
0
        /// <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);
        }
Example #7
0
        /// <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);
        }
Example #8
0
        /// <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);
        }