public int Score(SurveyTemplate pstTemplate, SurveyScoreCard sscScoreCard)
        {
            int intAnswerCount = 0;
            int intAnswerTotal = 0;
            int intReturnScore = 0;

            TemplateID = pstTemplate.TemplateID;
            ScoreCard = sscScoreCard;

            foreach (SurveyAnswer ansThis in ResponseData)
            {
                if (ansThis.Type == QuestionType.Radio || ansThis.Type == QuestionType.DropDown)
                {
                    int? intValue = pstTemplate.GetResponseValue(ansThis.ResponseID);

                    if (intValue != null)
                    {
                        intAnswerCount++;
                        Guid[] strReversibleAnswers = { };                        

                        if (AlternateScore && strReversibleAnswers.Contains(ansThis.ID))
                        {
                            intAnswerTotal += 10 - intValue.Value;
                        }
                        else
                        {
                            intAnswerTotal += intValue.Value;
                        }

                    }

                }
            }

            if (intAnswerCount != 0)
            {
                intReturnScore = intAnswerTotal / intAnswerCount;
            }
            else
            {
                intReturnScore = 0;
            }



            PopulateScoreDisplay(intReturnScore, sscScoreCard);

            return intReturnScore;

        }
Example #2
0
        public int Score(SurveyTemplate pstTemplate, SurveyScoreCard sscScoreCard)
        {
            int intAnswerCount = 0;
            int intAnswerTotal = 0;
            int intReturnScore = 0;

            TemplateID = pstTemplate.TemplateID;
            ScoreCard  = sscScoreCard;

            foreach (SurveyAnswer ansThis in ResponseData)
            {
                if (ansThis.Type == QuestionType.Radio || ansThis.Type == QuestionType.DropDown)
                {
                    int?intValue = pstTemplate.GetResponseValue(ansThis.ResponseID);

                    if (intValue != null)
                    {
                        intAnswerCount++;
                        Guid[] strReversibleAnswers = { };

                        if (AlternateScore && strReversibleAnswers.Contains(ansThis.ID))
                        {
                            intAnswerTotal += 10 - intValue.Value;
                        }
                        else
                        {
                            intAnswerTotal += intValue.Value;
                        }
                    }
                }
            }

            if (intAnswerCount != 0)
            {
                intReturnScore = intAnswerTotal / intAnswerCount;
            }
            else
            {
                intReturnScore = 0;
            }



            PopulateScoreDisplay(intReturnScore, sscScoreCard);

            return(intReturnScore);
        }