Beispiel #1
0
    /// <summary>
    /// shows objective question, correct and submitted answer, adjust visibility
    /// </summary>
    /// <param name="q">objective question to be shown</param>
    private void showObjectiveQuestionAndAnswer(ObjectiveQuestion q)
    {
      questionLabel.Text = q.QuestionText;
      correctAnswerLabel.Text = q.Choices[q.Answer.Answer-1];
      Speech.speakPurge("Objective Question");
      Speech.speakNormal(q.QuestionText);
      
      Speech.speakNormal("Correct Answer");
      Speech.speakNormal(q.Choices[q.Answer.Answer-1]);

      if (q.Submitted != null)
      {
        submittedAnswerLabel.Text = q.Choices[q.Submitted.Answer-1];
        Speech.speakNormal("Your answer");
        Speech.speakNormal(q.Choices[q.Submitted.Answer-1]);
      }
      else 
      {
        submittedAnswerLabel.Text = "";
        Speech.speakNormal("You didn't answer");
      }
    }
Beispiel #2
0
    /// <summary>
    ///  show the objective question by setting window controls and their visibility
    /// </summary>
    /// <param name="q">question to be shown</param>
    private void showObjectiveQuestion(ObjectiveQuestion q)
    {
      questionLabel.Text = q.QuestionText;
      option0Text.Text = q.Choices[0];
      option1Text.Text = q.Choices[1];
      option2Text.Text = q.Choices[2];
      option3Text.Text = q.Choices[3];

      if (q.Submitted != null)
      {
        if (q.Submitted.Answer == 1)
        {
          option0.IsChecked = true;
        }
        else if (q.Submitted.Answer == 2)
        {
          option1.IsChecked = true;
        }
        else if (q.Submitted.Answer == 3)
        {
          option2.IsChecked = true;
        }
        else if (q.Submitted.Answer == 4)
        {
          option3.IsChecked = true;
        }
      }
      else
      {
        option0.IsChecked = false;
        option1.IsChecked = false;
        option2.IsChecked = false;
        option3.IsChecked = false;
      }

      objectiveAnswerGrid.Visibility = Visibility.Visible;
      descriptiveAnswerGrid.Visibility = Visibility.Hidden;

      Speech.speakPurge("Objective Question");
      Speech.speakNormal(q.QuestionText);

      Speech.speakNormal("option one");
      Speech.speakNormal(q.Choices[0]);
      Speech.speakNormal("option two");
      Speech.speakNormal(q.Choices[1]);
      Speech.speakNormal("option three");
      Speech.speakNormal(q.Choices[2]);
      Speech.speakNormal("option four");
      Speech.speakNormal(q.Choices[3]);
    }
Beispiel #3
0
 /// <summary>
 ///   to add objective question
 /// </summary>
 /// <param name="question">objective question object to be added</param>
 public static void addObjectiveQuestion(ObjectiveQuestion question)
 {           
   questionsAdapter.InsertQuestion(1, question.QuestionText, 
     question.Choices[0], question.Choices[1], question.Choices[2], 
     question.Choices[3], question.Answer.Answer, null, 
     question.QuestionSubject, null, null, null);
 }
Beispiel #4
0
 /// <summary>
 ///   To get all questions by filtering with subject and type
 /// </summary>
 /// <param name="subject">test subject</param>
 /// <param name="type">test type</param>
 /// <returns>
 ///   arraylist of questions with specified subject and type
 /// </returns>
 public static ArrayList getAllQuestionsBySubjectAndType(int subject, byte type) 
 {
   CTVIATBankDataSet.QuestionsDataTable allQuestionsTable = 
   questionsAdapter.GetAllQuestionBySubjectAndType(subject, type);
   ArrayList questions = new ArrayList();
   foreach (DataRow row in allQuestionsTable)
   {
     if (row["questionType"].ToString() == "1")
     {
       String[] choices = new String[4];
       choices[0] = Convert.ToString(row["objectiveChoiceOne"]);
       choices[1] = Convert.ToString(row["objectiveChoiceTwo"]);
       choices[2] = Convert.ToString(row["objectiveChoiceThree"]);
       choices[3] = Convert.ToString(row["objectiveChoiceFour"]);
       ObjectiveQuestion temp = 
       new ObjectiveQuestion(Convert.ToString(row["question"]), choices,
         new ObjectiveAnswer(Convert.ToByte(row["objectiveAnswer"])),
         Convert.ToInt32(row["questionID"]),
         Convert.ToInt32(row["questionSubject"]));
       questions.Add(temp);
     }
     else if (row["questionType"].ToString() == "2")
     {
       DescriptiveQuestion temp = 
       new DescriptiveQuestion(Convert.ToString(row["question"]),
         new DescriptiveAnswer(Convert.ToString(row["descriptiveAnswer"])),
         Convert.ToInt32(row["questionID"]), 
         Convert.ToInt32(row["questionSubject"]));
       questions.Add(temp);
     }
     else
     {
       ActionBasedQuestion temp = 
       new ActionBasedQuestion(Convert.ToString(row["question"]),
         Convert.ToInt32(row["actionType"]),
         Convert.ToString(row["actionParameterOne"]),
         Convert.ToString(row["actionParameterTwo"]),
         Convert.ToInt32(row["questionID"]),
         Convert.ToInt32(row["questionSubject"]));
       questions.Add(temp);
     }
   }
   return questions;
 }