Пример #1
0
        private void GetRandomQuestion(QuestionAnswerSet questionAnswers)
        {
            QuestionAnswerSet.QuestionsDataTable qt   = questionsAnswers[activeSetIndex, activeZoneIndex].Questions;
            QuestionAnswerSet.QuestionsRow[]     rows =
                (QuestionAnswerSet.QuestionsRow[])qt.Select("DifficultyLevelId = " + activeDifficultyLevel.ToString());
            if (rows.Length == 0)
            {
                throw new Exception(
                          String.Format(
                              "The content of the test is incorrent. There is not enough questions of difficulty {0} in zone {1} of question set {2}",
                              activeDifficultyLevel, activeZoneIndex + 1, activeSetIndex + 1));
            }

            questionAnswers.Clear();
            activeQuestion.Clear();

            QuestionAnswerSet.QuestionsRow q = rows[random.Next(rows.Length)];
            DataRow[] dr = new DataRow[] { q };
            QuestionAnswerSet.AnswersRow[] ar = q.GetAnswersRows();
            activeQuestion.Merge(dr);
            activeQuestion.Merge(ar);
            questionAnswers.Merge(dr);
            questionAnswers.Merge(ar);

            qt.RemoveQuestionsRow(q);
        }
Пример #2
0
 public override void DoGetActiveQuestion(QuestionAnswerSet questionAnswerSet)
 {
     questionAnswerSet.Clear();
     QuestionAnswerSet.QuestionsRow qr =
         questionsAnswers[activeSetIndex].Questions[activeQuestionIndexes[activeSetIndex]];
     questionAnswerSet.Merge(new DataRow[] { qr });
     questionAnswerSet.Merge(qr.GetAnswersRows());
 }
Пример #3
0
 public override void DoGetActiveQuestion(QuestionAnswerSet questionAnswerSet)
 {
     questionAnswerSet.Clear();
     questionAnswerSet.Merge(new DataRow[] { activeQuestion.Questions[0] });
     questionAnswerSet.Merge(activeQuestion.Questions[0].GetAnswersRows());
 }