protected void btnDelete_Click(object sender, EventArgs e) { Questions.Questions myQuestion = new Questions.Questions(); /* *这里是测试代码 * string strError = myQuestion.AddQuestionTopaper(3, 2); lblTest.Text = strError; GridView2.DataBind();*/ for (int index = 0; index < GridView2.Rows.Count; index++) { CheckBox checkSelect = GridView2.Rows[index].Cells[0].FindControl("checkSelect") as CheckBox; if (checkSelect.Checked) { //string strError = myQuestion.DelPaper(Convert.ToInt32(Request.Cookies["papID"].Value)); string strError = myQuestion.DelJudgeQesFromPaper(Convert.ToInt32(Request.Cookies["papID"].Value), Convert.ToInt32(GridView2.Rows[index].Cells[2].Text.ToString())); //string strError = myQuestion.AddQuestionTopaper(3, 5); lblTest.Text = strError; } } GridView2.DataBind(); GridView2.Visible = true; }
protected void btnSubmit_Click(object sender, EventArgs e) { Questions.Questions myQuestion = new Questions.Questions(); /* *这里是测试代码 * string strError = myQuestion.AddQuestionTopaper(3, 2); lblTest.Text = strError; GridView2.DataBind();*/ for (int index = 0; index < GridView1.Rows.Count; index++) { CheckBox checkSelect = GridView1.Rows[index].Cells[0].FindControl("checkSelect") as CheckBox; if (checkSelect.Checked) { string h_PapID = Request.Cookies["papID"].Value.ToString(); SqlConnection objconn1 = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); objconn1.Open(); //string h_PapID = "2"; SqlCommand objcmd1 = new SqlCommand(" select JudgePapPnt from Paper where papID='" + h_PapID + "'", objconn1); String point1 = objcmd1.ExecuteScalar().ToString(); string strError = myQuestion.AddJudgeQuestionTopaper(Convert.ToInt32(Request.Cookies["papID"].Value), Convert.ToInt32(GridView1.DataKeys[index].Value.ToString()), Convert.ToInt32(point1)); //string strError = myQuestion.AddQuestionTopaper(3, 5); lblTest.Text = strError; GridView2.DataBind(); } } }
protected void btn_Submit_Click(object sender, EventArgs e) { Questions.Questions question = new Questions.Questions(); if (Label1.Text == "添加试题") { string strError = question.AddJudgeQuestion(txtDes.Text.ToString(), Convert.ToBoolean(rblKey.SelectedValue)); if (strError == "1") { Response.Write("<script>alert('添加试题成功!');location='JudgeQuestion.aspx'</script>"); GridView1.DataBind(); } else lblTest.Text = strError; } else if (Label1.Text == "修改试题") { string strError = question.EditJudgeQuestion(Convert.ToInt32(GridView1.SelectedDataKey.Value), txtDes.Text.ToString(),Convert.ToBoolean(rblKey.SelectedValue)); if (strError == "1") { Response.Write("<script>alert('修改试题成功!');location='JudgeQuestion.aspx'</script>"); GridView1.DataBind(); } else lblTest.Text = strError; } }
protected void btnBegain_Click(object sender, EventArgs e) { Questions.Questions myQuestion = new Questions.Questions(); string strError= myQuestion.AddPaper(Convert.ToInt32( txtPapDuration.Text.ToString()),Convert.ToInt32( Request.Cookies["UserID"].Value.ToString()), txtPapName.Text.ToString(), txtPapRmk.Text.ToString(), txtPoint.Text.ToString(), txtMultiSelectPoint.Text.ToString(), txtJudgePoint.Text.ToString(), txtFillBlankPoint.Text.ToString()); if (strError == "1") { Response.Redirect("Paper.aspx"); } else lblTest1.Text = strError; }
protected void btnSubmit_Click(object sender, EventArgs e) { Questions.Questions question = new Questions.Questions(); string strTest= question.AddExam(Convert.ToInt32(ddlPap.SelectedValue), txtDes.Text); if (strTest == "1") { GridView1.DataBind(); ddlActive.DataBind(); panelNew.Visible = false; } else lblTest.Text = strTest; }
protected void btnDeletePaper_Click(object sender, EventArgs e) { //删除试卷 Questions.Questions myQuestion = new Questions.Questions(); for (int index = 0; index < GridView3.Rows.Count; index++) { CheckBox checkSelect = GridView3.Rows[index].Cells[0].FindControl("checkSelect") as CheckBox; if (checkSelect.Checked) { string strError = myQuestion.DelPaper(Convert.ToInt32(GridView3.DataKeys[index].Value.ToString())); if (strError == "1") Response.Write("<script>alert('删除试卷成功!');location='Paper.aspx'</script>"); } } }
protected void btnDeleteExam_Click(object sender, EventArgs e) { //删除试卷 Questions.Questions myQuestion = new Questions.Questions(); //SqlCommand objcmd = new SqlCommand(" select UsrPassword from UserInfo where UsrID='" + h_UserID + "'", objconn); //String m = objcmd.ExecuteScalar().ToString(); // m = m.Trim(); //SqlDataReader dr = objcmd.ExecuteReader(CommandBehavior.CloseConnection); for (int index = 0; index < GridView1.Rows.Count; index++) { CheckBox checkSelect = GridView1.Rows[index].Cells[0].FindControl("checkSelect") as CheckBox; if (checkSelect.Checked) { string strError = myQuestion.DelExam(Convert.ToInt32(GridView1.DataKeys[index].Value.ToString())); if (strError == "1") Response.Write("<script>alert('删除试卷成功!');location='Exam.aspx'</script>"); } } }
protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e) { panelAdd.Visible = true; Label1.Text = "修改试题"; PanelView.Visible = false; Questions.Questions question = new Questions.Questions(); JudgeQuestionDetail myQestion = question.GetJudgeQuestion(Convert.ToInt32(GridView1.SelectedDataKey.Value)); txtDes.Text = myQestion.QesDescription; rblKey.SelectedValue = GridView1.SelectedRow.Cells[2].Text.ToString(); //rblAnswer.SelectedValue = judgeproblem.Answer.ToString(); // rblKey.SelectedValue = Convert.ToBoolean(myQestion.QesKey); }
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { Questions.Questions myQuestion = new Questions.Questions(); for (int index = 0; index < GridView1.Rows.Count; index++) { CheckBox checkSelect = GridView1.Rows[index].Cells[0].FindControl("checkSelect") as CheckBox; if (checkSelect.Checked) { string h_PapID = Request.Cookies["papID"].Value.ToString(); SqlConnection objconn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); objconn.Open(); SqlCommand objcmd = new SqlCommand(" select MultiSelectPapPnt from Paper where papID='" + h_PapID + "'", objconn); int point = Convert.ToInt32(objcmd.ExecuteScalar()); string strError = myQuestion.AddMultiSelectQuestionTopaper(Convert.ToInt32(Request.Cookies["papID"].Value), Convert.ToInt32(GridView1.DataKeys[index].Value.ToString()), Convert.ToInt32(point)); lblTest.Text = strError; } GridView2.DataBind(); } }
protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e) { panelAdd.Visible = true; Label1.Text = "修改试题"; PanelView.Visible = false; Questions.Questions question = new Questions.Questions(); QuestionDetail myQestion = question.GetQuestion(Convert.ToInt32( GridView1.SelectedDataKey.Value)); txtDes.Text = myQestion.QesDescription; txtAnswser1.Text = myQestion.QesAnswer1; txtAnswser2.Text = myQestion.QesAnswer2; txtAnswser3.Text = myQestion.QesAnswer3; txtAnswser4.Text = myQestion.QesAnswer4; rblKey.SelectedValue = GridView1.SelectedRow.Cells[2].Text.ToString(); }
protected void btnNow_Click(object sender, EventArgs e) { Questions.Questions question = new Questions.Questions(); question.SetExamActive(Convert.ToInt32(ddlActive.SelectedValue)); FormView1.DataBind(); }