protected void btnSaveAs_Click(object sender, EventArgs e) { int totalScore = 0; string strId = Request.QueryString.Get("id"); IList <PaperStrategySubject> paperStrategySubjects = new List <PaperStrategySubject>(); for (int i = 0; i < Grid1.Rows.Count; i++) { string strPaperStrategySubjectId = ((HiddenField)Grid1.Rows[i].FindControl("hfPaperStrategySubjectId")).Value; string strItemTypeId = ((HiddenField)Grid1.Rows[i].FindControl("hfItemTypeId")).Value; string strSubjectName = ((TextBox)Grid1.Rows[i].FindControl("txtSubjectName")).Text; string strUnitScore = ((TextBox)Grid1.Rows[i].FindControl("txtUnitScore")).Text; string strItemCount = ((TextBox)Grid1.Rows[i].FindControl("txtItemCount")).Text; if (strUnitScore == "") { strUnitScore = "0"; } if (strItemCount == "") { strItemCount = "0"; } totalScore += int.Parse(strUnitScore); PaperStrategySubject paperStrategySubject = new PaperStrategySubject(); paperStrategySubject.PaperStrategySubjectId = int.Parse(strPaperStrategySubjectId); paperStrategySubject.PaperStrategyId = int.Parse(strId); paperStrategySubject.ItemCount = int.Parse(strItemCount); paperStrategySubject.ItemTypeId = int.Parse(strItemTypeId); paperStrategySubject.OrderIndex = 0; paperStrategySubject.Remark = ""; paperStrategySubject.SubjectName = strSubjectName; paperStrategySubject.UnitScore = int.Parse(strUnitScore); paperStrategySubject.TotalScore = int.Parse(strUnitScore); paperStrategySubject.Memo = ""; paperStrategySubjects.Add(paperStrategySubject); } PaperStrategySubjectBLL paperStrategySubjectBLL = new PaperStrategySubjectBLL(); paperStrategySubjectBLL.UpdatePaperStrategySubject(int.Parse(strId), totalScore, paperStrategySubjects); Grid1.DataBind(); }
protected void btnSaveAndNext_Click(object sender, EventArgs e) { string strId = Request.QueryString.Get("id"); string strMode = ViewState["mode"].ToString(); if (strMode != "ReadOnly") { if (Grid1.Rows.Count == 0) { SessionSet.PageMessage = "请选择大题!"; return; } int totalScore = 0; IList <PaperStrategySubject> paperStrategySubjects = new List <PaperStrategySubject>(); for (int i = 0; i < Grid1.Rows.Count; i++) { string strPaperStrategySubjectId = ((HiddenField)Grid1.Rows[i].FindControl("hfPaperStrategySubjectId")).Value; string strItemTypeId = ((HiddenField)Grid1.Rows[i].FindControl("hfItemTypeId")).Value; string strSubjectName = ((TextBox)Grid1.Rows[i].FindControl("txtSubjectName")).Text; string strUnitScore = ((TextBox)Grid1.Rows[i].FindControl("txtUnitScore")).Text; string strItemCount = ((TextBox)Grid1.Rows[i].FindControl("txtItemCount")).Text; if (strUnitScore == "") { strUnitScore = "0"; } if (strItemCount == "") { strItemCount = "0"; } totalScore += int.Parse(strUnitScore); PaperStrategySubject paperStrategySubject = new PaperStrategySubject(); paperStrategySubject.PaperStrategySubjectId = int.Parse(strPaperStrategySubjectId); paperStrategySubject.PaperStrategyId = int.Parse(strId); paperStrategySubject.ItemCount = int.Parse(strItemCount); paperStrategySubject.ItemTypeId = int.Parse(strItemTypeId); paperStrategySubject.OrderIndex = 0; paperStrategySubject.Remark = ""; paperStrategySubject.SubjectName = strSubjectName; paperStrategySubject.UnitScore = int.Parse(strUnitScore); paperStrategySubject.TotalScore = int.Parse(strUnitScore); paperStrategySubject.Memo = ""; paperStrategySubjects.Add(paperStrategySubject); } PaperStrategySubjectBLL paperStrategySubjectBLL = new PaperStrategySubjectBLL(); paperStrategySubjectBLL.UpdatePaperStrategySubject(int.Parse(strId), totalScore, paperStrategySubjects); } PaperStrategyBLL paperStrategyBLL = new PaperStrategyBLL(); RailExam.Model.PaperStrategy paperStrategy = paperStrategyBLL.GetPaperStrategy(int.Parse(strId)); if (paperStrategy.StrategyMode == 2) //按教材 { string strPaperID = Request.QueryString.Get("Paperid"); if (!string.IsNullOrEmpty(strPaperID)) { Response.Redirect("PaperStrategyEditThird.aspx?mode=" + strMode + "&id=" + strId + "&Paperid=" + strPaperID); } else { Response.Redirect("PaperStrategyEditThird.aspx?mode=" + strMode + "&id=" + strId); } } if (paperStrategy.StrategyMode == 3) //按试题辅助分类 { string strPaperID = Request.QueryString.Get("Paperid"); if (!string.IsNullOrEmpty(strPaperID)) { Response.Redirect("PaperStrategyItemThird.aspx?mode=" + strMode + "&id=" + strId + "&Paperid=" + strPaperID); } else { Response.Redirect("PaperStrategyItemThird.aspx?mode=" + strMode + "&id=" + strId); } } }