Exemple #1
0
 public QuestionBase FindOriginalQuestion(ClientQuestion q, ref Test originalTest)
 {
     try
         {
             return originalTest[q.QuestionID];
         }
         catch
         {
             throw new ArgumentException();
         }
 }
Exemple #2
0
        public override int Verify(ClientQuestion clientQuestion)
        {
            if (VerifyByBalls == true)
            {
                return VerifyBalls(clientQuestion);
            }
            else
            {

                return VerifyCountAll(clientQuestion);
            }
        }
Exemple #3
0
 public override int Verify(ClientQuestion clientQuestion)
 {
     int res = this.MinBall;
     try
     {
         if (this.answers.ElementAt(0).Data.Text == clientQuestion.Answers[0].Data.Text)
         {
             res = this.MaxBall;
         }
     }
     catch (Exception ex)
     {
         return res;
     }
     return res;
 }
Exemple #4
0
 public override int Verify(ClientQuestion clientQuestion)
 {
     int res = this.MinBall;
     try
     {
         if (this.GetRightAnswers().ElementAt(0).ID.Equals(clientQuestion.Answers[0].Data.Text))
         {
             res = this.MaxBall;
         }
     }
     catch (Exception ex)
     {
         return res;
     }
     return res;
 }
Exemple #5
0
 public override int Verify(ClientQuestion clientQuestion)
 {
     return VerifyList(clientQuestion);
     //int res = this.MinBall;
     //string s = Encoding.Unicode.GetString(Encoding.Unicode.GetBytes(clientQuestion.Answers[0].Data.Text));
     //string ss = s;
     //try
     //{
     //    if (this.answers.ElementAt(0).Data.Text.Equals(clientQuestion.Answers[0].Data.Text))
     //    {
     //        res = this.MaxBall;
     //    }
     //}
     //catch (Exception ex)
     //{
     //    return res;
     //}
     //return res;
 }
Exemple #6
0
 /// <summary>
 /// проверка ответа пользователя
 /// </summary>
 /// <returns>балл за вопрос</returns>
 public abstract int Verify(ClientQuestion clientQuestion);
Exemple #7
0
 private int VerifyList(ClientQuestion clientQuestion)
 {
     int res = this.MinBall;
     string ans_client = prepareAnswer(clientQuestion.Answers[0].Data.Text);
     try
     {
         foreach (AnswerBase answer in Answers)
         {
             string ans_test = prepareAnswer(answer.Data.Text);
             if (ans_test.Equals(ans_client) == true)
             {
                 res = this.MaxBall;
                 break;
             }
         }
     }
     catch (Exception ex)
     {
         return res;
     }
     return res;
 }
Exemple #8
0
        private int VerifyOLD(ClientQuestion clientQuestion)
        {
            int res = this.MinBall;
            if (clientQuestion.Answers.Count != this.GetRightAnswers().Count)
            { res = this.MinBall; return res; }

            int allball = this.GetRightAnswers().Count;
            int ball = 0;

            for (int i = 0; i < clientQuestion.Answers.Count; i++)
            {
                if (FindAnswerFromRightAnswers(clientQuestion.Answers[i].Data.Text) == true)
                {
                    ball++;
                }
                else
                {
                  //  ball--;
                }
            }

            float procent = ((float)ball / (float)this.GetRightAnswers().Count) * 100;
            if (this.VerifyByBalls == true)
            {
                if (procent <= 30)
                {
                    res = this.MinBall;
                }
                if (procent >= 80)
                {
                    res = this.MaxBall;
                }
                if (procent > 30 & procent < 80)
                {
                    res = (this.MaxBall - this.MinBall) / 2;
                }
            }
            else
            {
                if (procent <= 50)
                {
                    res = this.MinBall;
                }
                if (procent > 50)
                {
                    res = this.MaxBall;
                }
            }

            return res;
        }
Exemple #9
0
        private int VerifyCountRight(ClientQuestion clientQuestion)
        {
            int resultBall = this.MinBall;
            int rightCount = 0;
            int originalRightAnswersCount = this.GetRightAnswers().Count();

            foreach (ClientQuestionAnswer clientQuestionAnswer in clientQuestion.Answers)
            {
                if (IsAnswerRight(clientQuestionAnswer) == true)
                {
                    rightCount++;
                }

            }

               if (originalRightAnswersCount == 0)
               {
               return 0;
               }

               resultBall = (int) Math.Round((double) ((rightCount/originalRightAnswersCount)*this.MaxBall));
               return resultBall;
        }
Exemple #10
0
        private int VerifyCountAll(ClientQuestion clientQuestion)
        {
            int resultBall = this.MinBall;
            int rightCount = 0;
            int originalRightAnswersCount = this.GetRightAnswers().Count();
            int wrongCount = 0;

            foreach (ClientQuestionAnswer clientQuestionAnswer in clientQuestion.Answers)
            {
                if (IsAnswerRight(clientQuestionAnswer) == true)
                {
                    rightCount++;
                }
                else
                {
                    wrongCount++;
                }
            }

            if (originalRightAnswersCount == 0)
            {
                return 0;
            }

            if (originalRightAnswersCount == rightCount && wrongCount == 0)
            {
                resultBall =  this.MaxBall;
            }
            else
            {
                resultBall = this.MinBall;
            }
            return resultBall;
        }
Exemple #11
0
        private int VerifyBalls(ClientQuestion clientQuestion)
        {
            int resultBall = clientQuestion.Answers.Where(clientQuestionAnswer => FindOriginalAnswer(clientQuestionAnswer) != null).
                Sum(clientQuestionAnswer => ( FindOriginalAnswer(clientQuestionAnswer)).Ball);

            if (resultBall < 0)
            {
                resultBall = 0;
            }

            return resultBall;
        }