Пример #1
0
 public QAResult(Question q, Answer a)
 {
     Question = q;
     Answer   = a;
 }
Пример #2
0
        private void SubmitAnswer(object sender, EventArgs e)
        {
            if (closing)
            {
                Close();
                return;
            }
            String ans = string.Empty;

            if (choiceA.Checked)
            {
                ans = choiceA.Text;
            }
            if (choiceB.Checked)
            {
                ans = choiceB.Text;
            }
            if (choiceC.Checked)
            {
                ans = choiceC.Text;
            }
            if (choiceD.Checked)
            {
                ans = choiceD.Text;
            }
            bool c = false;

            switch (correct)
            {
            case 0:
                if (choiceA.Checked)
                {
                    c = true;
                }
                break;

            case 1:
                if (choiceB.Checked)
                {
                    c = true;
                }
                break;

            case 2:
                if (choiceC.Checked)
                {
                    c = true;
                }
                break;

            case 3:
                if (choiceD.Checked)
                {
                    c = true;
                }
                break;
            }
            if (c)
            {
                correctQs++;
            }
            Answer qa = new Answer(que, ans, c, questionTimer.ElapsedMilliseconds);

            questionTimer.Restart();
            results.Add(new QAResult(que, qa));
            answered++;
            newQuestion     = true;
            choiceA.Checked = false;
            choiceB.Checked = false;
            choiceC.Checked = false;
            choiceD.Checked = false;
        }
Пример #3
0
        public bool ApplyAnswerToSignature(QuSignature signature, string symptomName, Answer answer)
        {
            bool requiredAnswer = signature.symptoms[symptomName].valoare;
            bool answerValue    = answer.GetAnswerBoolean();

            if (requiredAnswer == answerValue)
            {
                signature.currentPositiveScore += signature.symptoms[symptomName].importanta;
                return(true);
            }
            signature.currentScore -= signature.symptoms[symptomName].importanta;
            return(false);
        }