protected void btnSave_Click(object sender, EventArgs e) { bool IsSucess = false; if (String.IsNullOrEmpty(tb_LftCode.Text.Trim())) { JsHelper.Alert(this.Page, "提示", "请输入文件编号"); return; } if (String.IsNullOrEmpty(tb_RgtCode.Text.Trim())) { JsHelper.Alert(this.Page, "提示", "请输入检查编号"); return; } if (String.IsNullOrEmpty(tb_Year.Text.Trim())) { JsHelper.Alert(this.Page, "提示", "请输入学年"); return; } if (String.IsNullOrEmpty(tb_Week.Text.Trim())) { JsHelper.Alert(this.Page, "提示", "请输入周次"); return; } #region 检测达标率项是否已正确录入 string[] ProfessNames = Request.Form.GetValues("ProfessName"); string[] CourseNames = Request.Form.GetValues("CourseName"); string[] PlanCourseNums = Request.Form.GetValues("PlanCourseNum"); string[] ActualCourseNums = Request.Form.GetValues("ActualCourseNum"); string[] TotalCourseNums = Request.Form.GetValues("TotalCourseNum"); string[] ItemRates = Request.Form.GetValues("ItemRate"); string[] Summarys = Request.Form.GetValues("Summary"); if (!IsInputValidate(ProfessNames, CourseNames, PlanCourseNums, ActualCourseNums, TotalCourseNums, ItemRates, Summarys)) { JsHelper.Alert(this.Page, "提示", "达标项目录入失败,请检查!"); return; } #endregion try { Department department = Department.GetInstance(ddlDepart.SelectedValue); if (department != null) { if (!TeachPlanRate.IsExsit(department, Year, Term)) { TeachPlanRate tpr = new TeachPlanRate(); tpr.LftCode = tb_LftCode.Text; tpr.RgtCode = tb_RgtCode.Text; tpr.CheckedDepart = ddlDepart.SelectedValue; tpr.Year = tb_Year.Text; tpr.Term = Convert.ToInt32(ddlTerm.SelectedValue); tpr.Week = Convert.ToInt32(tb_Week.Text); tpr.Save(); if (ProcessItem(tpr)) { IsSucess = true; } GvDepartDataBind(); } else { JsHelper.Alert(this.Page, "提示", "本学期该部门达标率已审核!"); return; } } else { JsHelper.Alert(this.Page, "提示", "部门查询失败,请联系管理员!"); return; } } catch (Exception ex) { throw ex; } finally { } if (IsSucess) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('添加成功!')</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('添加失败,请检查数据输入!')</script>"); } tb_LftCode.Text = ""; tb_RgtCode.Text = ""; tb_Week.Text = ""; tb_Year.Text = ""; }