//编辑填空题确认事件 protected void btEFillConfirm_Click(object sender, EventArgs e) { QuestionsManagement questionsManagement = new QuestionsManagement(); QuestionInfo newQuestion = new QuestionInfo(); //设置修改后的填空题信息 newQuestion.IQuestionId = Convert.ToInt32(Session["Questionid"].ToString()); newQuestion.ISectionId = Convert.ToInt32(Session["Sectionid"].ToString()); newQuestion.StrQuestionBody = this.txbFill.Text; newQuestion.StrAnswer = this.txbFillAnswer.Text; //保存结果到数据库 if (questionsManagement.EditQuestion(newQuestion)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('修改成功!')</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('修改失败!')</script>"); } }
//编辑是非题确认事件 protected void btEJudgeConfirm_Click(object sender, EventArgs e) { QuestionsManagement questionsManagement = new QuestionsManagement(); QuestionInfo newQuestion = new QuestionInfo(); string answer = null; //获得是非题答案 if (RadioButton1.Checked) { answer = "是"; } if(RadioButton2.Checked) { answer = "非"; } if (answer != null) { //设置编辑后的是非题信息 newQuestion.IQuestionId = Convert.ToInt32(Session["Questionid"].ToString()); newQuestion.ISectionId = Convert.ToInt32(Session["Sectionid"].ToString()); newQuestion.StrQuestionBody = this.txbJudge.Text; newQuestion.StrAnswer = answer; //保存结果到数据库 if (questionsManagement.EditQuestion(newQuestion)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('修改成功!')</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('修改失败!')</script>"); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('题目答案为空,请选择答案!')</script>"); } }
//编辑选择题确认事件 protected void btEMultipleConfirm_Click(object sender, EventArgs e) { QuestionsManagement questionsManagement = new QuestionsManagement(); QuestionInfo newQuestion = new QuestionInfo(); string answer = null; //获得选择题答案 if (CheckBoxA.Checked) { answer += "A"; } if (CheckBoxB.Checked) { answer += "B"; } if (CheckBoxC.Checked) { answer += "C"; } if (CheckBoxD.Checked) { answer += "D"; } if (answer != null) { //设置编辑后的选择题信息 newQuestion.IQuestionId = Convert.ToInt32(Session["Questionid"].ToString()); newQuestion.ISectionId = Convert.ToInt32(Session["Sectionid"].ToString()); newQuestion.StrQuestionBody = this.txbMultiple.Text; newQuestion.StrAnswer = answer; //保存结果到数据库 if (questionsManagement.EditQuestion(newQuestion)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('修改成功!')</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('修改失败!')</script>"); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('答案为空,请选择答案!')</script>"); } }