Beispiel #1
0
        private void ApplyProfilePoints(int ProfileID, int QuizStatus, int ModuleID, int UserID)
        {
            BusinessServices.Profile objProfile = new BusinessServices.Profile();
            bool ApplyToQuiz   = objProfile.QuizRequiredForPoints(ProfileID);
            bool ApplyToLesson = objProfile.LessonRequiredForPoints(ProfileID);

            // If both Quiz and Lesson need to be completed to gain points
            if (ApplyToQuiz && ApplyToLesson)
            {
                //Check if Lesson has been completed
                if ((objProfile.CheckQuizComplete(UserID, ProfileID, ModuleID)) && (objProfile.CheckLessonComplete(UserID, ProfileID, ModuleID)))
                {
                    if (!(objProfile.CheckLessonPointsAlreadyGivenForPeriod(ProfileID, UserID, ModuleID, 2)) || !(objProfile.CheckQuizPointsAlreadyGivenForPeriod(ProfileID, UserID, ModuleID, 2)))
                    {
                        objProfile.ApplyCPDPoints(ProfileID, UserID, ModuleID, 2);
                    }
                }
            }
            else                 // then either quiz only or lesson only
            {
                if (ApplyToQuiz) // quiz only
                {
                    // if quiz passed then apply points to user
//					if(QuizStatus == 2)
//					{
                    if (!(objProfile.CheckQuizPointsAlreadyGivenForPeriod(ProfileID, UserID, ModuleID, 1)))
                    {
                        objProfile.ApplyCPDPoints(ProfileID, UserID, ModuleID, 1);
                    }
//					}
                }
                // not worried about lesson in this scenario as have just completed quiz
            }
        }
Beispiel #2
0
        private void ApplyProfilePoints(int ProfileID)
        {
            BusinessServices.Profile objProfile = new BusinessServices.Profile();
            bool ApplyToQuiz   = objProfile.QuizRequiredForPoints(ProfileID);
            bool ApplyToLesson = objProfile.LessonRequiredForPoints(ProfileID);

            int ModuleID = Int32.Parse(Request.QueryString["ModuleID"].ToString());
            int UserID   = Int32.Parse(Request.QueryString["UserID"].ToString());

            // If both Quiz and Lesson need to be completed to gain points
            if (ApplyToQuiz && ApplyToLesson)
            {
                //Check if quiz has been completed
                //if it has and if lesson completed then apply points to user
                if ((objProfile.CheckQuizComplete(UserID, ProfileID, ModuleID)) && (objProfile.CheckLessonComplete(UserID, ProfileID, ModuleID)))
                {
                    if (!(objProfile.CheckLessonPointsAlreadyGivenForPeriod(ProfileID, UserID, ModuleID, 2)) || !(objProfile.CheckQuizPointsAlreadyGivenForPeriod(ProfileID, UserID, ModuleID, 2)))
                    {
                        objProfile.ApplyCPDPoints(ProfileID, UserID, ModuleID, 2);
                    }
                }
            }
            else                   // then either quiz only or lesson only
            {
                if (ApplyToLesson) // lesson only
                {
                    // if lesson completed then apply points to user
                    if (!(objProfile.CheckLessonPointsAlreadyGivenForPeriod(ProfileID, UserID, ModuleID, 0)))
                    {
                        objProfile.ApplyCPDPoints(ProfileID, UserID, ModuleID, 0);
                    }
                }
                // not worried about quiz in this scenario as have just completed lesson
            }
        }