/// <summary> /// Testing content /// </summary> /// <param name="testing"></param> /// <returns></returns> public List <TestingContent> CurrentTesting(TestingContent testing) { SqlConnection connection = new SqlConnection(CONNECTION_STRING); connection.Open(); SqlCommand command = new SqlCommand("spTestingContent", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@examId", testing.ExamId)); List <TestingContent> testList = new List <TestingContent>(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { TestingContent test = new TestingContent(); test.Id = reader.GetInt32(0); test.QuestionContent = reader.GetString(1); test.ChoiceA = reader.GetString(2); test.ChoiceB = reader.GetString(3); test.ChoiceC = reader.GetString(4); test.ChoiceD = reader.GetString(5); test.CorrectAnwser = reader.GetString(6); testList.Add(test); } } return(testList); }
/// <summary> /// Current testing. /// </summary> /// <param name="testingContent">Include exam id</param> /// <returns>All question in this question</returns> public TestingContent[] CurrentTesting(TestingContent testingContent) { try { return(client.CurrentTesting(testingContent)); } catch (RequestExceprion ex) { throw ex; } }
/// <summary> /// Into content /// </summary> /// <param name="flag"></param> private void IntoContent(int flag) { TestingContent currentQuestion = CurrentTesting(flag); this.currentQuestion.Text = flag + 1 + "/" + tempExam.QuestionQuantity; this.questionContent.Text = currentQuestion.QuestionContent; this.choiceAContent.Text = currentQuestion.ChoiceA; this.choiceBContent.Text = currentQuestion.ChoiceB; this.choiceCContent.Text = currentQuestion.ChoiceC; this.choiceDContent.Text = currentQuestion.ChoiceD; this.choiceAIcon.Text = "A"; this.choiceBIcon.Text = "B"; this.choiceCIcon.Text = "C"; this.choiceDIcon.Text = "D"; }
/// <summary> /// Current question /// </summary> /// <param name="flag"></param> /// <returns></returns> private TestingContent CurrentTesting(int flag) { TestingContent testingContent = new TestingContent(); testingContent.ExamId = currentExamId; try { questionList = studentExamManage.CurrentTesting(testingContent); } catch (Exception ex) { string str = ex.Message; MessageBox.Show(str, "system error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(questionList[flag]); }
/// <summary> /// Current testing /// </summary> /// <param name="testingContent"></param> /// <returns></returns> public List <TestingContent> CurrentTesting(TestingContent testingContent) { return(studentDb.CurrentTesting(testingContent)); }