private void btnAdd_Click(object sender, EventArgs e) { if (cboCourse.SelectedValue == null || txtTitle.Text == "") { MessageBox.Show("请输入完整的题目信息!"); } else if (txtAnswer.Text == "") { MessageBox.Show("请输入正确答案!"); } else { try { JudgeQuestionProblem jqp = new JudgeQuestionProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, txtAnswer.Text); QuestionBll.AddquestionProblem(jqp); MessageBox.Show("添加成功!"); this.Close(); } catch (Exception ee) { MessageBox.Show("添加失败!" + ee); throw; } } }
private void btnAdd_Click(object sender, EventArgs e) { string RightWrong="False"; if (cboCourse.SelectedValue==null||txtTitle.Text=="") { MessageBox.Show("请输入完整的题目信息!"); } else if (rdoRight.Checked == false && rdoWrong.Checked == false) { MessageBox.Show("请选择正确答案!"); } else { if (rdoRight.Checked == true) { RightWrong = "True"; } try { JudgeQuestionProblem jqp = new JudgeQuestionProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, RightWrong); QuestionBll.AddjudgeProblem(jqp); MessageBox.Show("添加成功!"); this.Close(); } catch (Exception ee) { MessageBox.Show("添加失败!" + ee); throw; } } }
private void btnAdd_Click(object sender, EventArgs e) { string RightWrong = "False"; if (cboCourse.SelectedValue == null || txtTitle.Text == "") { MessageBox.Show("请输入完整的题目信息!"); } else if (rdoRight.Checked == false && rdoWrong.Checked == false) { MessageBox.Show("请选择正确答案!"); } else { if (rdoRight.Checked == true) { RightWrong = "True"; } try { JudgeQuestionProblem jqp = new JudgeQuestionProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, RightWrong); QuestionBll.AddjudgeProblem(jqp); 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=="") { MessageBox.Show("请输入完整的题目信息!"); } else if (txtAnswer.Text=="") { MessageBox.Show("请输入正确答案!"); } else { try { JudgeQuestionProblem jqp = new JudgeQuestionProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, txtAnswer.Text); QuestionBll.AddquestionProblem(jqp); MessageBox.Show("添加成功!"); this.Close(); } catch (Exception ee) { MessageBox.Show("添加失败!" + ee); throw; } } }
/// <summary> /// 添加判断题信息 /// </summary> /// <param name="courseID">课程编号</param> /// <param name="title">题目</param> /// <param name="answer">正确答案</param> public void AddjudgeProblem(JudgeQuestionProblem jqp) { string str = "select count(*)from judgeProblem"; SH.SqlCom(str, CommandType.Text); string ID = ((int)SH.SqlES() + 1).ToString(); str = "insert judgeProblem values(@ID,@courseID,@title,@answer)"; SH.SqlCom(str, CommandType.Text); string[] str0 = { "@ID", "@courseID", "@title", "@answer" }; string[] str1 = { ID, jqp.CourseID, jqp.Title, jqp.Answer }; SH.SqlPar(str0, str1); SH.SqlENQ(); }
/// <summary> /// 添加简答题信息 /// </summary> /// <param name="courseID">课程编号</param> /// <param name="title">题目</param> /// <param name="answer">正确答案</param> public void AddquestionProblem(JudgeQuestionProblem jqp) { string str = "select count(*)from questionProblem"; SH.SqlCom(str, CommandType.Text); string ID = ((int)SH.SqlES() + 1).ToString(); str = "insert questionProblem values(@ID,@courseID,@title,@answer)"; SH.SqlCom(str, CommandType.Text); string[] str0 = { "@ID", "@courseID", "@title", "@answer" }; string[] str1 = { ID, jqp.CourseID, jqp.Title, jqp.Answer }; SH.SqlPar(str0, str1); SH.SqlENQ(); }
/// <summary> /// 添加简答题信息 /// </summary> /// <param name="jqp">判断题实体集</param> public static void AddquestionProblem(JudgeQuestionProblem jqp) { question.AddquestionProblem(jqp); }