Esempio n. 1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (cboCourse.SelectedValue == null || txtTitle.Text == "" || txtAnswerA.Text == "" || txtAnswerB.Text == "" || txtAnswerC.Text == "" || txtAnswerD.Text == "")
     {
         MessageBox.Show("请输入完整的题目信息!");
     }
     else if (cboAnswer.Text == "")
     {
         MessageBox.Show("请选择正确答案!");
     }
     else
     {
         try
         {
             SingleMultiProblem smp = new SingleMultiProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, txtAnswerA.Text, txtAnswerB.Text, txtAnswerC.Text, txtAnswerD.Text, cboAnswer.Text);
             QuestionBll.AddsingleProblem(smp);
             MessageBox.Show("添加成功!");
             this.Close();
         }
         catch (Exception ee)
         {
             MessageBox.Show("添加失败!" + ee);
             throw;
         }
     }
 }
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (cboCourse.SelectedValue==null||txtTitle.Text==""||txtAnswerA.Text==""||txtAnswerB.Text==""||txtAnswerC.Text==""||txtAnswerD.Text=="")
     {
         MessageBox.Show("请输入完整的题目信息!");
     }
     else if (cboAnswer.Text=="")
     {
         MessageBox.Show("请选择正确答案!");
     }
     else
     {
         try
         {
             SingleMultiProblem smp = new SingleMultiProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, txtAnswerA.Text, txtAnswerB.Text, txtAnswerC.Text, txtAnswerD.Text, cboAnswer.Text);
             QuestionBll.AddsingleProblem(smp);
             MessageBox.Show("添加成功!");
             this.Close();
         }
         catch (Exception ee)
         {
             MessageBox.Show("添加失败!" + ee);
             throw;
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 添加多选题信息
 /// </summary>
 /// <param name="courseID">课程编号</param>
 /// <param name="title">题目</param>
 /// <param name="answerA">选项A</param>
 /// <param name="answerB">选项B</param>
 /// <param name="answerC">选项C</param>
 /// <param name="answerD">选项D</param>
 /// <param name="answer">正确答案</param>
 public void AddmultiProblem(SingleMultiProblem smp)
 {
     string str = "select count(*)from multiProblem";
     SH.SqlCom(str, CommandType.Text);
     string ID = ((int)SH.SqlES() + 1).ToString();
     str = "insert multiProblem values(@ID,@courseID,@title,@answerA,@answerB,@answerC,@answerD,@answer)";
     SH.SqlCom(str, CommandType.Text);
     string[] str0 = { "@ID", "@courseID", "@title","@answerA","@answerB","@answerC", "@answerD", "@answer" };
     string[] str1 = { ID, smp.CourseID, smp.Title, smp.AnswerA, smp.AnswerB, smp.AnswerC, smp.AnswerD, smp.Answer };
     SH.SqlPar(str0, str1);
     SH.SqlENQ();
 }
Esempio n. 4
0
        /// <summary>
        /// 添加单选题信息
        /// </summary>
        /// <param name="courseID">课程编号</param>
        /// <param name="title">题目</param>
        /// <param name="answerA">选项A</param>
        /// <param name="answerB">选项B</param>
        /// <param name="answerC">选项C</param>
        /// <param name="answerD">选项D</param>
        /// <param name="answer">正确答案</param>
        public void AddsingleProblem(SingleMultiProblem smp)
        {
            string str = "select count(*)from singleProblem";

            SH.SqlCom(str, CommandType.Text);
            string ID = ((int)SH.SqlES() + 1).ToString();

            str = "insert singleProblem values(@ID,@courseID,@title,@answerA,@answerB,@answerC,@answerD,@answer)";
            SH.SqlCom(str, CommandType.Text);
            string[] str0 = { "@ID", "@courseID", "@title", "@answerA", "@answerB", "@answerC", "@answerD", "@answer" };
            string[] str1 = { ID, smp.CourseID, smp.Title, smp.AnswerA, smp.AnswerB, smp.AnswerC, smp.AnswerD, smp.Answer };
            SH.SqlPar(str0, str1);
            SH.SqlENQ();
        }
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (cboCourse.SelectedValue==null||txtTitle.Text==""||txtAnswerA.Text==""||txtAnswerB.Text==""||txtAnswerC.Text==""||txtAnswerD.Text=="")
     {
         MessageBox.Show("请输入完整的题目信息!");
     }
     else if (ckbA.Checked == false && ckbB.Checked == false && ckbC.Checked == false && ckbD.Checked == false)
     {
         MessageBox.Show("请选择正确答案!");
     }
     else
     {
         string answer = "";
         if (ckbA.Checked == true)
         {
             answer += "A";
         }
         if (ckbB.Checked == true)
         {
             answer += "B";
         }
         if (ckbC.Checked == true)
         {
             answer += "C";
         }
         if (ckbD.Checked == true)
         {
             answer += "D";
         }
         try
         {
             SingleMultiProblem smp = new SingleMultiProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, txtAnswerA.Text, txtAnswerB.Text, txtAnswerC.Text, txtAnswerD.Text, answer);
             QuestionBll.AddmultiProblem(smp);
             MessageBox.Show("添加成功!");
             this.Close();
         }
         catch (Exception ee)
         {
             MessageBox.Show("添加失败!"+ee);
             throw;
         }
     }
 }
Esempio n. 6
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (cboCourse.SelectedValue == null || txtTitle.Text == "" || txtAnswerA.Text == "" || txtAnswerB.Text == "" || txtAnswerC.Text == "" || txtAnswerD.Text == "")
     {
         MessageBox.Show("请输入完整的题目信息!");
     }
     else if (ckbA.Checked == false && ckbB.Checked == false && ckbC.Checked == false && ckbD.Checked == false)
     {
         MessageBox.Show("请选择正确答案!");
     }
     else
     {
         string answer = "";
         if (ckbA.Checked == true)
         {
             answer += "A";
         }
         if (ckbB.Checked == true)
         {
             answer += "B";
         }
         if (ckbC.Checked == true)
         {
             answer += "C";
         }
         if (ckbD.Checked == true)
         {
             answer += "D";
         }
         try
         {
             SingleMultiProblem smp = new SingleMultiProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, txtAnswerA.Text, txtAnswerB.Text, txtAnswerC.Text, txtAnswerD.Text, answer);
             QuestionBll.AddmultiProblem(smp);
             MessageBox.Show("添加成功!");
             this.Close();
         }
         catch (Exception ee)
         {
             MessageBox.Show("添加失败!" + ee);
             throw;
         }
     }
 }
Esempio n. 7
0
 /// <summary>
 /// 添加单选题信息
 /// </summary>
 /// <param name="smp">选择题实体集</param>
 public static void AddsingleProblem(SingleMultiProblem smp)
 {
     question.AddsingleProblem(smp);
 }