/// <summary> /// show the descriptive question by setting window controls and their visibility /// </summary> /// <param name="q">question to be shown</param> private void showDescriptiveQuestion(DescriptiveQuestion q) { questionLabel.Text = q.QuestionText; if (q.Submitted != null) { descriptionTextBox.Text = q.Submitted.Answer; } else { descriptionTextBox.Text = ""; } objectiveAnswerGrid.Visibility = Visibility.Hidden; descriptiveAnswerGrid.Visibility = Visibility.Visible; descriptionTextBox.Focus(); Speech.speakPurge("Descriptive Question"); Speech.speakNormal(q.QuestionText); }
/// <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; }
/// <summary> /// to add descriptive question /// </summary> /// <param name="question">descriptive question object to be added</param> public static void addDescriptiveQuestion(DescriptiveQuestion question) { questionsAdapter.InsertQuestion(2, question.QuestionText, null, null, null, null, null, question.Answer.Answer, question.QuestionSubject, null, null, null); }
/// <summary> /// shows descriptive question, correct and submitted answer, adjust visibility /// </summary> /// <param name="q">descriptive question to be shown</param> private void showDescriptiveQuestionAndAnswer(DescriptiveQuestion q) { questionLabel.Text = q.QuestionText; correctAnswerLabel.Text = q.Answer.Answer; Speech.speakPurge( "Descriptive Question"); Speech.speakNormal(q.QuestionText); Speech.speakNormal("Correct Answer"); Speech.speakNormal(q.Answer.Answer); if (q.Submitted != null) { submittedAnswerLabel.Text = q.Submitted.Answer; Speech.speakNormal("Your answer"); Speech.speakNormal(q.Submitted.Answer); } else { submittedAnswerLabel.Text = ""; Speech.speakNormal("You didn't answer"); } }