protected void Button3_Click(object sender, EventArgs e) { DalOperationAboutGradeCheck dal = new DalOperationAboutGradeCheck(); UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo(); List<StudentsGradeCheckApply> listStudentsGradeCheckApply = new List<StudentsGradeCheckApply>(); bool isChecked = false; for (int i = 0; i < dlstcourses.Items.Count; i++) { System.Web.UI.WebControls.CheckBox ck = dlstcourses.Items[i].FindControl("select") as System.Web.UI.WebControls.CheckBox; System.Web.UI.WebControls.DropDownList ddl = dlstcourses.Items[i].FindControl("ddlGradeCheckApplyType") as System.Web.UI.WebControls.DropDownList; System.Web.UI.WebControls.DropDownList ddlApplyReason = dlstcourses.Items[i].FindControl("ddlApplyReason") as System.Web.UI.WebControls.DropDownList; System.Web.UI.HtmlControls.HtmlGenericControl ltl = dlstcourses.Items[i].FindControl("courseName") as System.Web.UI.HtmlControls.HtmlGenericControl; System.Web.UI.HtmlControls.HtmlGenericControl ltlCourseNo = dlstcourses.Items[i].FindControl("courseNo") as System.Web.UI.HtmlControls.HtmlGenericControl; System.Web.UI.HtmlControls.HtmlGenericControl ltlClassID = dlstcourses.Items[i].FindControl("ClassID") as System.Web.UI.HtmlControls.HtmlGenericControl; System.Web.UI.HtmlControls.HtmlGenericControl ltlTermTag = dlstcourses.Items[i].FindControl("termTag") as System.Web.UI.HtmlControls.HtmlGenericControl; if (ck != null && ck.Checked) { isChecked = true; listStudentsGradeCheckApply.Add(new StudentsGradeCheckApply { studentNo = UserCookiesInfo.userNo, updateTime = updateTime, applyUpdateTime = DateTime.Now, courseNo = ltlCourseNo.InnerText.Trim(), ClassID = ltlClassID.InnerText.Trim(), termTag = ltlTermTag.InnerText.Trim(), gradeCheckApplyType = ddl.SelectedValue, applyReason = ddlApplyReason.SelectedValue }); } } if (!isChecked) { Javascript.GoHistory(-1, "请选择要进行重修重考的课程:)", Page); return; } //加申请记录唯一性验证 for (int i = 0; i < listStudentsGradeCheckApply.Count; i++) { DataSet _temp = dal.GetStudentGradeCheckApplyByStudentNoAndTermTagCourseNoClassID(listStudentsGradeCheckApply[i].studentNo, listStudentsGradeCheckApply[i].termTag + listStudentsGradeCheckApply[i].courseNo + listStudentsGradeCheckApply[i].ClassID); if (_temp.Tables[0].Rows.Count > 0 && _temp.Tables[0].Rows[0]["applyResult"].ToString().Trim() == "符合") { Javascript.GoHistory(-1, "申请重修重考失败,失败原因:\\n当前已经申请了“" + listStudentsGradeCheckApply[i].couseName + "”的重修重考记录,并且已经审核通过,无须重新申请:(", Page); return; } } using (TransactionScope scope = new TransactionScope()) { try { dal.DeleteStudentGradeCheckApplyByStudentNoAndUpdateTime(UserCookiesInfo.userNo, updateTime); for (int i = 0; i < listStudentsGradeCheckApply.Count; i++) { dal.AddStudentGradeCheckApply(listStudentsGradeCheckApply[i]); } scope.Complete(); Javascript.RefreshParentWindow("修改申请重修重考成功:)", "/Student/MyGradeCheckManage.aspx?fragment=1", Page); } catch (Exception ex) { MongoDBLog.LogRecord(ex); Javascript.GoHistory(-1, "修改申请重修重考失败,请重试:(", Page); } finally { dal.conn.Close(); } } }