示例#1
0
        public QuestionDS.exam_answer_detailDataTable FindUserAnswer(int userId, int examId)
        {
            QuestionManager manager = new QuestionManager();

            QuestionDS.exam_answer_detailDataTable table = new QuestionDS.exam_answer_detailDataTable();
            table.Merge(manager.FindUserAnswer(userId, examId));
            return(table);
        }
示例#2
0
        public void TestInsertUserAnswer()
        {
            userId = Convert.ToInt32(userAdapter.InsertUser("test", "123", "ceshiyuan", "male", "158", "*****@*****.**", null));

            int answerId = questionManager.InsertUserAnswer(userId, examId, questionId, "A");

            QuestionDS.exam_answer_detailDataTable table = questionManager.FindUserAnswer(userId, examId);
            foreach (var item in table)
            {
                Assert.AreEqual("A", item.user_answer);
            }

            userAdapter.DeleteUserById(userId);
            answerAdapter.DeleteUserAnswer(answerId);
        }
示例#3
0
        //load user answer and correct answer
        private void GetUserAnswerAndCorrectAnswer()
        {
            QuestionDS.exam_answer_detailDataTable tableAdapter = questionManager.FindUserAnswer(RememberUserParameter.userId, FormPassValue.examId);
            var rs = from s in tableAdapter select new { s.user_answer };

            foreach (var item in rs)
            {
                answerList.Add(item.user_answer);
            }

            //query correct answer
            var afterQuestions = from q in questionTable select new { q.correct_answer };

            foreach (var item in afterQuestions)
            {
                correctAnswerList.Add(item.correct_answer);
            }
        }