コード例 #1
0
 public override void stateChangeCheck(Student student)
 {
     if (student.GradePointAverage > UpperLimit)
     {
         student.GPAStateId = HonoursState.getInstance().GPAStateId;
         student.changeState();
     }
     else if (student.GradePointAverage < LowerLimit)
     {
         student.GPAStateId = ProbationState.GetInstance().GPAStateId;
         student.changeState();
     }
 }
コード例 #2
0
        /// <summary>
        /// Returns the state of gpa based on its limits
        /// </summary>
        /// <returns></returns>
        /// <summary>
        /// gets an instance of RegularState and populates it if it is null
        /// </summary>
        /// <returns></returns>
        public static ProbationState GetInstance()
        {
            if (probationState == null)
            {
                if (context.ProbationStates.SingleOrDefault() != null)
                {
                    probationState = context.ProbationStates.SingleOrDefault();
                }
                else
                {
                    context.ProbationStates.Add(new ProbationState());
                    context.SaveChanges();
                }
            }

            return(probationState);
        }
コード例 #3
0
        public override void stateChangeCheck(Student student)
        {
            //int s = this.GPAStateId;

            //if (student.GradePointAverage > UpperLimit)
            //{
            //    //set the student state to Probation
            //    GPAStateId +=1;
            //}

            if (student.GradePointAverage > UpperLimit)
            {
                //set the student state to Probation
                student.GPAStateId = ProbationState.GetInstance().GPAStateId;
                student.changeState();
            }
        }