コード例 #1
0
ファイル: frmStartExam.cs プロジェクト: heroims/OnlineExam
        private void tslQuestionDown_Click(object sender, EventArgs e)
        {
            int count = PaperDetailBll.GetQuestionCount(selectPaper, "questionProblem");

            if (Convert.ToInt32(tslblQuestion.Text) < count)
            {
                tslblQuestion.Text    = (Convert.ToInt32(tslblQuestion.Text) + 1).ToString();
                tslQuestionUp.Enabled = true;
            }
            if (Convert.ToInt32(tslblQuestion.Text) == count)
            {
                tslQuestionDown.Enabled = false;
            }
            Add(txtQuestion.Text);
            ReadAnswer();
        }
コード例 #2
0
ファイル: frmStartExam.cs プロジェクト: heroims/OnlineExam
        private void tslJudgeDown_Click(object sender, EventArgs e)
        {
            int    count  = PaperDetailBll.GetQuestionCount(selectPaper, "judgeProblem");
            string answer = "";

            if (Convert.ToInt32(tslblJudge.Text) < count)
            {
                if (rdoRight.Checked == false && rdoWrong.Checked == false)
                {
                    answer = "";
                    Add(answer);
                }
                tslblJudge.Text    = (Convert.ToInt32(tslblJudge.Text) + 1).ToString();
                tslJudgeUp.Enabled = true;
            }
            if (Convert.ToInt32(tslblJudge.Text) == count)
            {
                tslJudgeDown.Enabled = false;
            }
            ReadAnswer();
        }
コード例 #3
0
ファイル: frmStartExam.cs プロジェクト: heroims/OnlineExam
        private void tslMultiDown_Click(object sender, EventArgs e)
        {
            int    count  = PaperDetailBll.GetQuestionCount(selectPaper, "multiProblem");
            string answer = "";

            if (Convert.ToInt32(tslblMulti.Text) < count)
            {
                if (ckbA.Checked == false && ckbB.Checked == false && ckbC.Checked == false && ckbD.Checked == false)
                {
                    answer = "";
                    Add(answer);
                }
                tslblMulti.Text    = (Convert.ToInt32(tslblMulti.Text) + 1).ToString();
                tslMultiUp.Enabled = true;
            }
            if (Convert.ToInt32(tslblMulti.Text) == count)
            {
                tslMultiDown.Enabled = false;
            }
            ReadAnswer();
        }
コード例 #4
0
ファイル: frmStartExam.cs プロジェクト: heroims/OnlineExam
 /// <summary>
 /// 用户答案初始化
 /// </summary>
 public void FillUa()
 {
     if (PaperDetailBll.GetQuestionCount(selectPaper, "singleProblem") != 0)
     {
         for (int i = 1; i <= PaperDetailBll.GetQuestionCount(selectPaper, "singleProblem"); i++)
         {
             ua.Add("singleProblem" + i.ToString(), new UserAnswer(Convert.ToInt32(selectPaper), User.UserID, "singleProblem", DateTime.Now.ToString(), 0, m1, "", 0, "singleProblem" + i.ToString()));
         }
     }
     if (PaperDetailBll.GetQuestionCount(selectPaper, "multiProblem") != 0)
     {
         for (int i = 1; i <= PaperDetailBll.GetQuestionCount(selectPaper, "multiProblem"); i++)
         {
             ua.Add("multiProblem" + i.ToString(), new UserAnswer(Convert.ToInt32(selectPaper), User.UserID, "multiProblem", DateTime.Now.ToString(), 0, m2, "", 0, "multiProblem" + i.ToString()));
         }
     }
     if (PaperDetailBll.GetQuestionCount(selectPaper, "judgeProblem") != 0)
     {
         for (int i = 1; i <= PaperDetailBll.GetQuestionCount(selectPaper, "judgeProblem"); i++)
         {
             ua.Add("judgeProblem" + i.ToString(), new UserAnswer(Convert.ToInt32(selectPaper), User.UserID, "judgeProblem", DateTime.Now.ToString(), 0, m3, "", 0, "judgeProblem" + i.ToString()));
         }
     }
     if (PaperDetailBll.GetQuestionCount(selectPaper, "fillBlankProblem") != 0)
     {
         for (int i = 1; i <= PaperDetailBll.GetQuestionCount(selectPaper, "fillBlankProblem"); i++)
         {
             ua.Add("fillBlankProblem" + i.ToString(), new UserAnswer(Convert.ToInt32(selectPaper), User.UserID, "fillBlankProblem", DateTime.Now.ToString(), 0, m4, "", 0, "fillBlankProblem" + i.ToString()));
         }
     }
     if (PaperDetailBll.GetQuestionCount(selectPaper, "questionProblem") != 0)
     {
         for (int i = 1; i <= PaperDetailBll.GetQuestionCount(selectPaper, "questionProblem"); i++)
         {
             ua.Add("questionProblem" + i.ToString(), new UserAnswer(Convert.ToInt32(selectPaper), User.UserID, "questionProblem", DateTime.Now.ToString(), 0, m5, "", 0, "questionProblem" + i.ToString()));
         }
     }
 }
コード例 #5
0
ファイル: frmPaperSetUp.cs プロジェクト: heroims/OnlineExam
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (ckbSingleProblem.Checked == false && ckbQuestionProblem.Checked == false && ckbMultiProblem.Checked != false && ckbJudgeProblem.Checked == false && ckbFillBlankProblem.Checked == false)
     {
         MessageBox.Show("请选择试题!");
     }
     else
     {
         if (PaperBll.GetPaper(txtPaperName.Text))
         {
             if (txtTime.Text == "")
             {
                 MessageBox.Show("请输入考试时间!");
             }
             else
             {
                 try
                 {
                     PaperBll.AddPaper(txtPaperName.Text, cboCourse.SelectedValue.ToString());
                     PaperDetailBll.PaperDetailAdd(pd);
                     PrintXPS();
                     MessageBox.Show("添加成功!");
                     this.Close();
                 }
                 catch (Exception ee)
                 {
                     MessageBox.Show("添加失败!" + ee);
                     throw;
                 }
             }
         }
         else
         {
             MessageBox.Show("试卷名已存在!");
         }
     }
 }
コード例 #6
0
ファイル: frmStartExam.cs プロジェクト: heroims/OnlineExam
        /// <summary>
        /// 答题卡显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbAnswer_Click(object sender, EventArgs e)
        {
            frmAnswerCard fac = new frmAnswerCard(ua);

            fac.ShowDialog();
            if (fac.title.IndexOf("singleProblem") != -1)
            {
                tabConQustion.SelectedTab = tabPage1;
                foreach (KeyValuePair <string, UserAnswer> a in ua)
                {
                    if (a.Key == fac.title)
                    {
                        tslblSingle.Text = fac.title.Substring("singleProblem".Length, fac.title.Length - "singleProblem".Length);
                        ReadAnswer();
                        if (tslblSingle.Text == "1")
                        {
                            tslSingleUp.Enabled   = false;
                            tslSingleDown.Enabled = true;
                        }
                        if (tslblSingle.Text == PaperDetailBll.GetQuestionCount(selectPaper, "singleProblem").ToString())
                        {
                            tslSingleDown.Enabled = false;
                            tslSingleUp.Enabled   = true;
                        }
                        if (tslblSingle.Text == "1" && tslblSingle.Text == PaperDetailBll.GetQuestionCount(selectPaper, "singleProblem").ToString())
                        {
                            tslSingleUp.Enabled   = false;
                            tslSingleDown.Enabled = false;
                        }
                        break;
                    }
                }
            }
            else if (fac.title.IndexOf("multiProblem") != -1)
            {
                tabConQustion.SelectedTab = tabPage2;
                foreach (KeyValuePair <string, UserAnswer> a in ua)
                {
                    if (a.Key == fac.title)
                    {
                        tslblMulti.Text = fac.title.Substring("multiProblem".Length, fac.title.Length - "multiProblem".Length);
                        ReadAnswer();
                        if (tslblMulti.Text == "1")
                        {
                            tslMultiUp.Enabled   = false;
                            tslMultiDown.Enabled = true;
                        }
                        if (tslblMulti.Text == PaperDetailBll.GetQuestionCount(selectPaper, "multiProblem").ToString())
                        {
                            tslMultiDown.Enabled = false;
                            tslMultiUp.Enabled   = true;
                        }
                        if (tslblMulti.Text == "1" && tslblMulti.Text == PaperDetailBll.GetQuestionCount(selectPaper, "multiProblem").ToString())
                        {
                            tslMultiUp.Enabled   = false;
                            tslMultiDown.Enabled = false;
                        }
                        break;
                    }
                }
            }
            else if (fac.title.IndexOf("judgeProblem") != -1)
            {
                tabConQustion.SelectedTab = tabPage3;
                foreach (KeyValuePair <string, UserAnswer> a in ua)
                {
                    if (a.Key == fac.title)
                    {
                        tslblJudge.Text = fac.title.Substring("judgeProblem".Length, fac.title.Length - "judgeProblem".Length);
                        ReadAnswer();
                        if (tslblJudge.Text == "1")
                        {
                            tslJudgeUp.Enabled   = false;
                            tslJudgeDown.Enabled = true;
                        }
                        if (tslblJudge.Text == PaperDetailBll.GetQuestionCount(selectPaper, "judgeProblem").ToString())
                        {
                            tslJudgeDown.Enabled = false;
                            tslJudgeUp.Enabled   = true;
                        }
                        if (tslblJudge.Text == "1" && tslblJudge.Text == PaperDetailBll.GetQuestionCount(selectPaper, "judgeProblem").ToString())
                        {
                            tslJudgeUp.Enabled   = false;
                            tslJudgeDown.Enabled = false;
                        }
                        break;
                    }
                }
            }
            else if (fac.title.IndexOf("fillBlankProblem") != -1)
            {
                tabConQustion.SelectedTab = tabPage4;
                foreach (KeyValuePair <string, UserAnswer> a in ua)
                {
                    if (a.Key == fac.title)
                    {
                        tslblFillBlank.Text = fac.title.Substring("fillBlankProblem".Length, fac.title.Length - "fillBlankProblem".Length);
                        ReadAnswer();
                        if (tslblFillBlank.Text == "1")
                        {
                            tslFillBlankUp.Enabled   = false;
                            tslFillBlankDown.Enabled = true;
                        }
                        if (tslblFillBlank.Text == PaperDetailBll.GetQuestionCount(selectPaper, "fillBlankProblem").ToString())
                        {
                            tslFillBlankDown.Enabled = false;
                            tslFillBlankUp.Enabled   = true;
                        }
                        if (tslblFillBlank.Text == "1" && tslblFillBlank.Text == PaperDetailBll.GetQuestionCount(selectPaper, "fillBlankProblem").ToString())
                        {
                            tslFillBlankUp.Enabled   = false;
                            tslFillBlankDown.Enabled = false;
                        }
                        break;
                    }
                }
            }
            else if (fac.title.IndexOf("questionProblem") != -1)
            {
                tabConQustion.SelectedTab = tabPage5;
                foreach (KeyValuePair <string, UserAnswer> a in ua)
                {
                    if (a.Key == fac.title)
                    {
                        tslblQuestion.Text = fac.title.Substring("questionProblem".Length, fac.title.Length - "questionProblem".Length);
                        ReadAnswer();
                        if (tslblQuestion.Text == "1")
                        {
                            tslQuestionUp.Enabled   = false;
                            tslQuestionDown.Enabled = true;
                        }
                        if (tslblQuestion.Text == PaperDetailBll.GetQuestionCount(selectPaper, "questionProblem").ToString())
                        {
                            tslQuestionDown.Enabled = false;
                            tslQuestionUp.Enabled   = true;
                        }
                        if (tslblQuestion.Text == "1" && tslblQuestion.Text == PaperDetailBll.GetQuestionCount(selectPaper, "questionProblem").ToString())
                        {
                            tslQuestionUp.Enabled   = false;
                            tslQuestionDown.Enabled = false;
                        }
                        break;
                    }
                }
            }
        }
コード例 #7
0
ファイル: frmStartExam.cs プロジェクト: heroims/OnlineExam
        /// <summary>
        /// 显示用户答案
        /// </summary>
        public void ReadAnswer()
        {
            PaperDetailBll.UserPaperFillDs(selectPaper);
            switch (tabConQustion.SelectedTab.Text)
            {
            case "单选题":
                TitleID        = tslblSingle.Text;
                txtSingle.Text = PaperDetailBll.sp[Convert.ToInt32(TitleID) - 1].Title;
                oldTitleID     = PaperDetailBll.sp[Convert.ToInt32(TitleID) - 1].TID;
                lblA.Text      = PaperDetailBll.sp[Convert.ToInt32(TitleID) - 1].AnswerA;
                lblB.Text      = PaperDetailBll.sp[Convert.ToInt32(TitleID) - 1].AnswerB;
                lblC.Text      = PaperDetailBll.sp[Convert.ToInt32(TitleID) - 1].AnswerC;
                lblD.Text      = PaperDetailBll.sp[Convert.ToInt32(TitleID) - 1].AnswerD;
                if (Traversal("singleProblem" + TitleID) == "A")
                {
                    rdoA.Checked = true;
                }
                else if (Traversal("singleProblem" + TitleID) == "B")
                {
                    rdoB.Checked = true;
                }
                else if (Traversal("singleProblem" + TitleID) == "C")
                {
                    rdoC.Checked = true;
                }
                else if (Traversal("singleProblem" + TitleID) == "D")
                {
                    rdoD.Checked = true;
                }
                else
                {
                    rdoA.Checked = false;
                    rdoB.Checked = false;
                    rdoC.Checked = false;
                    rdoD.Checked = false;
                }
                break;

            case "多选题":
                TitleID         = tslblMulti.Text;
                txtMulti.Text   = PaperDetailBll.mp[Convert.ToInt32(TitleID) - 1].Title;
                oldTitleID      = PaperDetailBll.mp[Convert.ToInt32(TitleID) - 1].TID;
                lblAnswerA.Text = PaperDetailBll.mp[Convert.ToInt32(TitleID) - 1].AnswerA;
                lblAnswerB.Text = PaperDetailBll.mp[Convert.ToInt32(TitleID) - 1].AnswerB;
                lblAnswerC.Text = PaperDetailBll.mp[Convert.ToInt32(TitleID) - 1].AnswerC;
                lblAnswerD.Text = PaperDetailBll.mp[Convert.ToInt32(TitleID) - 1].AnswerD;
                if (Traversal("multiProblem" + TitleID).IndexOf('A') != -1)
                {
                    ckbA.Checked = true;
                }
                if (Traversal("multiProblem" + TitleID).IndexOf('B') != -1)
                {
                    ckbA.Checked = true;
                }
                if (Traversal("multiProblem" + TitleID).IndexOf('C') != -1)
                {
                    ckbA.Checked = true;
                }
                if (Traversal("multiProblem" + TitleID).IndexOf('D') != -1)
                {
                    ckbA.Checked = true;
                }
                else
                {
                    ckbA.Checked = false;
                    ckbB.Checked = false;
                    ckbC.Checked = false;
                    ckbD.Checked = false;
                }
                break;

            case "判断题":
                TitleID       = tslblJudge.Text;
                txtJudge.Text = PaperDetailBll.jp[Convert.ToInt32(TitleID) - 1].Title;
                oldTitleID    = PaperDetailBll.jp[Convert.ToInt32(TitleID) - 1].TID;
                if (Traversal("judgeProblem" + TitleID) == "0")
                {
                    rdoRight.Checked = true;
                }
                else if (Traversal("judgeProblem" + TitleID) == "1")
                {
                    rdoWrong.Checked = true;
                }
                else
                {
                    rdoRight.Checked = false;
                    rdoWrong.Checked = false;
                }
                break;

            case "填空题":
                TitleID            = tslblFillBlank.Text;
                txtFrontTitle.Text = PaperDetailBll.fbp[Convert.ToInt32(TitleID) - 1].FrontTitle;
                txtBackTitle.Text  = PaperDetailBll.fbp[Convert.ToInt32(TitleID) - 1].BackTitle;
                oldTitleID         = PaperDetailBll.fbp[Convert.ToInt32(TitleID) - 1].TID;
                if (Traversal("fillBlankProblem" + TitleID) != "" || Traversal("fillBlankProblem" + TitleID) != "NULL")
                {
                    txtAnswer.Text = Traversal("fillBlankProblem" + TitleID);
                }
                break;

            case "简答题":
                TitleID       = tslblQuestion.Text;
                txtTitle.Text = PaperDetailBll.qp[Convert.ToInt32(TitleID) - 1].Title;
                oldTitleID    = PaperDetailBll.qp[Convert.ToInt32(TitleID) - 1].TID;
                if (Traversal("questionProblem" + TitleID) != "" || Traversal("questionProblem" + TitleID) != "NULL")
                {
                    txtQuestion.Text = Traversal("questionProblem" + TitleID);
                }
                break;

            default:
                break;
            }
        }
コード例 #8
0
ファイル: frmStartExam.cs プロジェクト: heroims/OnlineExam
 int m5; //简答题每题分数
 /// <summary>
 /// 界面初始化
 /// </summary>
 private void StartReadQuestion()
 {
     timer1.Start();
     tslNo.Text   = User.UserID;
     tslName.Text = User.UserName;
     PaperDetailBll.UserPaperFillDs(selectPaper);
     if (PaperDetailBll.sp != null)
     {
         tsslblTime.Text = PaperDetailBll.sp[0].WriteTime;
         m1             = int.Parse(PaperDetailBll.sp[0].Mark);
         txtSingle.Text = PaperDetailBll.sp[0].Title;
         lblA.Text      = PaperDetailBll.sp[0].AnswerA;
         lblB.Text      = PaperDetailBll.sp[0].AnswerB;
         lblC.Text      = PaperDetailBll.sp[0].AnswerC;
         lblD.Text      = PaperDetailBll.sp[0].AnswerD;
         oldTitleID     = PaperDetailBll.sp[0].TID;
     }
     else
     {
         m1 = 0;
         tslSingleDown.Enabled = false;
         rdoA.Enabled          = false;
         rdoB.Enabled          = false;
         rdoC.Enabled          = false;
         rdoD.Enabled          = false;
     }
     if (PaperDetailBll.mp != null)
     {
         tsslblTime.Text = PaperDetailBll.mp[0].WriteTime;
         m2              = int.Parse(PaperDetailBll.mp[0].Mark);
         txtMulti.Text   = PaperDetailBll.mp[0].Title;
         lblAnswerA.Text = PaperDetailBll.mp[0].AnswerA;
         lblAnswerB.Text = PaperDetailBll.mp[0].AnswerB;
         lblAnswerC.Text = PaperDetailBll.mp[0].AnswerC;
         lblAnswerD.Text = PaperDetailBll.mp[0].AnswerD;
     }
     else
     {
         m2 = 0;
         tslMultiDown.Enabled = false;
         ckbA.Enabled         = false;
         ckbB.Enabled         = false;
         ckbC.Enabled         = false;
         ckbD.Enabled         = false;
     }
     if (PaperDetailBll.jp != null)
     {
         tsslblTime.Text = PaperDetailBll.jp[0].WriteTime;
         m3            = int.Parse(PaperDetailBll.jp[0].Mark);
         txtJudge.Text = PaperDetailBll.jp[0].Title;
     }
     else
     {
         m3 = 0;
         tslJudgeDown.Enabled = false;
         rdoRight.Enabled     = false;
         rdoWrong.Enabled     = false;
     }
     if (PaperDetailBll.fbp != null)
     {
         tsslblTime.Text = PaperDetailBll.fbp[0].WriteTime;
         m4 = int.Parse(PaperDetailBll.fbp[0].Mark);
         txtFrontTitle.Text = PaperDetailBll.fbp[0].FrontTitle;
         txtBackTitle.Text  = PaperDetailBll.fbp[0].BackTitle;
     }
     else
     {
         m4 = 0;
         tslFillBlankDown.Enabled = false;
         txtAnswer.Enabled        = false;
     }
     if (PaperDetailBll.qp != null)
     {
         tsslblTime.Text = PaperDetailBll.qp[0].WriteTime;
         m5            = int.Parse(PaperDetailBll.qp[0].Mark);
         txtTitle.Text = PaperDetailBll.qp[0].Title;
     }
     else
     {
         m5 = 0;
         tslQuestionDown.Enabled = false;
         txtQuestion.Enabled     = false;
     }
 }
コード例 #9
0
ファイル: frmPaperSetUp.cs プロジェクト: heroims/OnlineExam
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (txtTime.Text == "")
     {
         MessageBox.Show("请输入考试时间!");
     }
     else
     {
         if (ckbSingleProblem.Checked == true)
         {
             if (txtSingleMark.Text == "" || txtSingleCount.Text == "")
             {
                 MessageBox.Show("请输入单选题详细信息!");
             }
             else
             {
                 if (Convert.ToInt32(txtSingleCount.Text) < QuestionBll.singleCount(cboCourse.SelectedValue.ToString()))
                 {
                     List <int> count = num(QuestionBll.singleCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtSingleCount.Text));
                     for (int i = 0; i < Convert.ToInt32(txtSingleCount.Text); i++)
                     {
                         pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "singleProblem", count[i], Convert.ToInt32(txtSingleMark.Text), Convert.ToInt32(txtTime.Text)));
                     }
                 }
                 else
                 {
                     MessageBox.Show("题库题目不足!");
                 }
             }
         }
         if (ckbMultiProblem.Checked == true)
         {
             if (txtMultiCount.Text == "" || txtMultiMark.Text == "")
             {
                 MessageBox.Show("请输入多选题详细信息!");
             }
             else
             {
                 if (Convert.ToInt32(txtMultiCount.Text) < QuestionBll.multiCount(cboCourse.SelectedValue.ToString()))
                 {
                     List <int> count = num(QuestionBll.multiCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtMultiCount.Text));
                     for (int i = 0; i < Convert.ToInt32(txtMultiCount.Text); i++)
                     {
                         pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "multiProblem", count[i], Convert.ToInt32(txtMultiMark.Text), Convert.ToInt32(txtTime.Text)));
                     }
                 }
                 else
                 {
                     MessageBox.Show("题库题目不足!");
                 }
             }
         }
         if (ckbFillBlankProblem.Checked == true)
         {
             if (txtFillBlankCount.Text == "" || txtFillBlankMark.Text == "")
             {
                 MessageBox.Show("请输入填空题详细信息!");
             }
             else
             {
                 if (Convert.ToInt32(txtFillBlankCount.Text) < QuestionBll.fillBlankCount(cboCourse.SelectedValue.ToString()))
                 {
                     List <int> count = num(QuestionBll.fillBlankCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtFillBlankCount.Text));
                     for (int i = 0; i < Convert.ToInt32(txtSingleCount.Text); i++)
                     {
                         pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "fillBlankProblem", count[i], Convert.ToInt32(txtFillBlankMark.Text), Convert.ToInt32(txtTime.Text)));
                     }
                 }
                 else
                 {
                     MessageBox.Show("题库题目不足!");
                 }
             }
         }
         if (ckbJudgeProblem.Checked == true)
         {
             if (txtJudgeCount.Text == "" || txtJudgeMark.Text == "")
             {
                 MessageBox.Show("请输入判断题详细信息!");
             }
             else
             {
                 if (Convert.ToInt32(txtJudgeCount.Text) < QuestionBll.judgeCount(cboCourse.SelectedValue.ToString()))
                 {
                     List <int> count = num(QuestionBll.judgeCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtJudgeCount.Text));
                     for (int i = 0; i < Convert.ToInt32(txtJudgeCount.Text); i++)
                     {
                         pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "judgeProblem", count[i], Convert.ToInt32(txtJudgeMark.Text), Convert.ToInt32(txtTime.Text)));
                     }
                 }
                 else
                 {
                     MessageBox.Show("题库题目不足!");
                 }
             }
         }
         if (ckbQuestionProblem.Checked == true)
         {
             if (txtQuestionCount.Text == "" || txtQuestionMark.Text == "")
             {
                 MessageBox.Show("请输入简答题详细信息!");
             }
             else
             {
                 if (Convert.ToInt32(txtQuestionCount.Text) < QuestionBll.questionCount(cboCourse.SelectedValue.ToString()))
                 {
                     List <int> count = num(QuestionBll.questionCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtQuestionCount.Text));
                     for (int i = 0; i < Convert.ToInt32(txtQuestionCount.Text); i++)
                     {
                         pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "questionProblem", count[i], Convert.ToInt32(txtQuestionMark.Text), Convert.ToInt32(txtTime.Text)));
                     }
                 }
                 else
                 {
                     MessageBox.Show("题库题目不足!");
                 }
             }
         }
         if (ckbSingleProblem.Checked == false && ckbQuestionProblem.Checked == false && ckbMultiProblem.Checked == false && ckbJudgeProblem.Checked == false && ckbFillBlankProblem.Checked == false)
         {
             MessageBox.Show("请选择试题!");
         }
         dataGridView1.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "questionProblem").Tables[0];
         dataGridView2.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "singleProblem").Tables[0];
         dataGridView3.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "multiProblem").Tables[0];
         dataGridView4.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "judgeProblem").Tables[0];
         dataGridView5.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "fillBlankProblem").Tables[0];
     }
 }
コード例 #10
0
ファイル: frmPaperSetUp.cs プロジェクト: heroims/OnlineExam
 private void frmPaperSetUp_FormClosing(object sender, FormClosingEventArgs e)
 {
     PaperDetailBll.DropPaper();
 }
コード例 #11
0
ファイル: frmPaperSetUp.cs プロジェクト: heroims/OnlineExam
        /// <summary>
        /// 绘制打印试卷
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            DataSet ds = PaperDetailBll.PaperFillDs(txtPaperName.Text);
            int     r  = 0;
            int     c  = 20;

            r += 120;
            e.Graphics.DrawString(txtPaperName.Text, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, r, c);
            c += 40;
            r  = 0;
            if (ckbSingleProblem.Checked == true)
            {
                e.Graphics.DrawString("单选题", new Font("宋体", 15, FontStyle.Regular), Brushes.Black, r, c);
                c += 20;
                e.Graphics.DrawString("题目", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("A项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("B项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("C项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("D项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目选项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("做卷时间", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目分数", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r  = r + 60;
                r  = 0;
                c += 20;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                    {
                        e.Graphics.DrawString(ds.Tables[0].Rows[i][j].ToString(), new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                        r = r + 60;
                    }
                    r  = 0;
                    c += 20;
                }
            }
            if (ckbMultiProblem.Checked == true)
            {
                e.Graphics.DrawString("多选题", new Font("宋体", 15, FontStyle.Regular), Brushes.Black, r, c);
                c += 20;
                e.Graphics.DrawString("题目", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("A项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("B项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("C项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("D项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目选项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("做卷时间", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目分数", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r  = r + 60;
                r  = 0;
                c += 20;
                for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
                {
                    for (int j = 0; j < ds.Tables[1].Columns.Count; j++)
                    {
                        e.Graphics.DrawString(ds.Tables[1].Rows[i][j].ToString(), new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                        r = r + 60;
                    }
                    r  = 0;
                    c += 20;
                }
            }
            if (ckbJudgeProblem.Checked == true)
            {
                e.Graphics.DrawString("判断题", new Font("宋体", 15, FontStyle.Regular), Brushes.Black, r, c);
                c += 20;
                e.Graphics.DrawString("题目", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("答案", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目选项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("做卷时间", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目分数", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r  = r + 60;
                r  = 0;
                c += 20;
                for (int i = 0; i < ds.Tables[2].Rows.Count; i++)
                {
                    for (int j = 0; j < ds.Tables[2].Columns.Count; j++)
                    {
                        e.Graphics.DrawString(ds.Tables[2].Rows[i][j].ToString(), new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                        r = r + 60;
                    }
                    r  = 0;
                    c += 20;
                }
            }
            if (ckbFillBlankProblem.Checked == true)
            {
                e.Graphics.DrawString("填空题", new Font("宋体", 15, FontStyle.Regular), Brushes.Black, r, c);
                c += 20;
                e.Graphics.DrawString("前描述", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("后描述", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("答案", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目选项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("做卷时间", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目分数", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r  = r + 60;
                r  = 0;
                c += 20;
                for (int i = 0; i < ds.Tables[3].Rows.Count; i++)
                {
                    for (int j = 0; j < ds.Tables[3].Columns.Count; j++)
                    {
                        e.Graphics.DrawString(ds.Tables[3].Rows[i][j].ToString(), new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                        r = r + 60;
                    }
                    r  = 0;
                    c += 20;
                }
            }
            if (ckbQuestionProblem.Checked == true)
            {
                e.Graphics.DrawString("简答题", new Font("宋体", 15, FontStyle.Regular), Brushes.Black, r, c);
                c += 20;
                e.Graphics.DrawString("题目", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("答案", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目选项", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("做卷时间", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r = r + 60;
                e.Graphics.DrawString("题目分数", new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                r  = r + 60;
                r  = 0;
                c += 20;
                for (int i = 0; i < ds.Tables[4].Rows.Count; i++)
                {
                    for (int j = 0; j < ds.Tables[4].Columns.Count; j++)
                    {
                        e.Graphics.DrawString(ds.Tables[4].Rows[i][j].ToString(), new Font("宋体", 10, FontStyle.Regular), Brushes.Black, r, c);
                        r = r + 60;
                    }
                    r  = 0;
                    c += 20;
                }
            }
        }