Example #1
0
        public int addExamResult(ExamResult examResult)
        {
            //新增检查是否已经存在
            string strSql = " select EXAM_RESULT_ID from ex_exam_result where examination_id=" + examResult.ExaminationId + " and topic_id="+ examResult.TopicId;
            DataTable Dt = listEntity(strSql, null).Tables[0];
            if (Dt.Rows.Count>0)
            {
                return 0;
            }

            strSql = "insert into ex_exam_result(user_id, examination_id, examination_detail_id, topic_id, answers) values(?userId, ?examId, ?examDetailId, ?topicId, ?answer); select last_insert_id();";
            MySqlParameter[] parames = new MySqlParameter[] {
                new MySqlParameter("?userId", MySqlDbType.Int32),
                new MySqlParameter("?examId", MySqlDbType.Int32),
                new MySqlParameter("?examDetailId", MySqlDbType.Int32),
                new MySqlParameter("?topicId", MySqlDbType.Int32),
                new MySqlParameter("?answer", MySqlDbType.VarChar)
            };

            parames[0].Value = examResult.UserId;
            parames[1].Value = examResult.ExaminationId;
            parames[2].Value = examResult.ExaminationDetailId;
            parames[3].Value = examResult.TopicId;
            parames[4].Value = examResult.Answer;
            int examResultId = Convert.ToInt32(MySqlHelper.ExecuteScalar(strSql, parames));
            examResult.ExamResultId = examResultId;
            return examResultId;
        }
Example #2
0
 public int addOrUpdateExamResult(ExamResult examResult)
 {
     int examResultId = examResult.ExamResultId;
     if (examResultId > 0)
     {
         return examResultDao.updateExamResult(examResult);
     }
     else
     {
         return examResultDao.addExamResult(examResult);
     }
 }
Example #3
0
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            //takeExam.mainFrame.panel1.Controls.Clear();
            //TitleMain titleMain = TitleMain.createForm();
            //titleMain.TopLevel = false;
            //titleMain.FormBorderStyle = FormBorderStyle.None;
            //titleMain.Dock = System.Windows.Forms.DockStyle.Fill;
            //takeExam.mainFrame.panel1.Controls.Add(titleMain);
            //titleMain.Show();

            ExamResult examResult = new ExamResult();
            examResult.ExamResultId = examResultId;
            examResult.ExaminationId = examId;
            examResult.ExaminationDetailId = examDetailId;
            examResult.TopicId = topicId;
            examResult.Answer = labResult.Text;
            examResult.UserId = LoginRoler.userId;
            examResultService.addOrUpdateExamResult(examResult);

            //加载主体栏
            takeExam.mainFrame.panel6.Controls.Clear();
            takeExam.mainFrame.panel6.Controls.AddRange(takeExam.mainFrame.items.ToArray());
            BodyMain bodyMain = BodyMain.createForm();
            bodyMain.TopLevel = false;
            bodyMain.FormBorderStyle = FormBorderStyle.None;
            bodyMain.Dock = System.Windows.Forms.DockStyle.Fill;
            takeExam.mainFrame.panel6.Controls.Add(bodyMain);
            bodyMain.Show();
        }
Example #4
0
        private void btnPre_Click(object sender, EventArgs e)
        {
            ExamResult examResult = new ExamResult();
            examResult.ExamResultId = examResultId;
            examResult.ExaminationId = examId;
            examResult.ExaminationDetailId = examDetailId;
            examResult.TopicId = topicId;
            examResult.Answer = labResult.Text;
            examResult.UserId = LoginRoler.userId;
            examResultService.addOrUpdateExamResult(examResult);

            cur--;                                         //当前题号+1
            labResult.Text = "";
            clearLabels();
            showTopic(dt, cur);
        }
Example #5
0
 public int updateExamResult(ExamResult examResult)
 {
     string strSql = "update ex_exam_result set answers = ?answer where exam_result_id = ?examResultId";
     MySqlParameter[] parames = new MySqlParameter[] {
         new MySqlParameter("?answer", MySqlDbType.VarChar),
         new MySqlParameter("?examResultId", MySqlDbType.Int32)
     };
     parames[0].Value = examResult.Answer;
     parames[1].Value = examResult.ExamResultId;
     return Convert.ToInt32(MySqlHelper.ExecuteNonQuery(strSql, parames));
 }
Example #6
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            ExamResult examResult = new ExamResult();
            examResult.ExamResultId = examResultId;
            examResult.ExaminationId = examId;
            examResult.ExaminationDetailId = examDetailId;
            examResult.TopicId = topicId;
            examResult.Answer = labResult.Text;
            examResult.UserId = LoginRoler.userId;
            examResultService.addOrUpdateExamResult(examResult);

            //弹出该次考试的成绩

            BodySelfTest4 bodySelfTest4 = BodySelfTest4.createForm(examId+"");
            bodySelfTest4.selfTest2 = this.selfTest2;
            bodySelfTest4.ShowDialog();
        }