/// <summary> /// 添加试卷题目 /// </summary> /// <param name="Type">类型</param> /// <param name="gv">GridView</param> /// <param name="PapersID">PapersID</param> private void AddgvPapersTitleList(string Type, GridView gv, int PapersID) { BLL.PapersTitleList bll = new BLL.PapersTitleList(); Model.PapersTitleList model = new Model.PapersTitleList(); int Count = gv.Rows.Count; for (int i = 0; i < Count; i++) { HtmlInputCheckBox cbx = (HtmlInputCheckBox)gv.Rows[i].FindControl("checkbox"); if (cbx.Checked == true) { model.Title = ((Label)gv.Rows[i].FindControl("lb_Title")).Text; model.T_F = ((Label)gv.Rows[i].FindControl("lb_T_F")).Text; model.Analysis = ((Label)gv.Rows[i].FindControl("lb_Analysis")).Text; model.ID = int.Parse(((Label)gv.Rows[i].FindControl("lb_ID")).Text); string score = ((HtmlInputText)gv.Rows[i].FindControl("textfield")).Value; if (score == "") { model.Score = 0; } else { model.Score = int.Parse(score); } model.CourseID = int.Parse(lb_CourseID.Text); model.Type = Type; model.PapersID = PapersID; if (bll.Add(model) > 0) { AddgvPapersOptionsList(model.ID, PapersID, gv); } else { //如果题目添加不成功 } } else { //如果题用户没有勾选 } } }
/// <summary> /// 添加试卷题目 /// </summary> /// <param name="Type">类型</param> /// <param name="gv">GridView</param> /// <param name="PapersID">PapersID</param> private void AddgvPapersTitleList(string Type, int PapersID, string[] arrayTitle, string[] arrayScore, int CourseID) { try { BLL.PapersTitleList bll = new BLL.PapersTitleList(); Model.PapersTitleList model = new Model.PapersTitleList(); int count = 0; foreach (var item in arrayTitle) { BLL.TitleList Tbll = new BLL.TitleList(); List <Model.TitleList> list = Tbll.Details(int.Parse(item)); model.Title = list[0].Title; model.T_F = list[0].T_F; model.Analysis = list[0].Analysis; model.ID = list[0].ID; model.Score = int.Parse(arrayScore[count]); model.CourseID = CourseID; model.Type = Type; model.PapersID = PapersID; model.Status_id = int.Parse(list[0].Status_id.ToString()); count++; if (bll.Add(model) > 0) { AddgvPapersOptionsList(model.ID, PapersID); } else { //如果题目添加不成功 } } } catch (Exception) { throw; } }
/// <summary> /// 添加试卷题目 /// </summary> /// <param name="Type">类型</param> /// <param name="PapersID">PapersID</param> /// <param name="Score">分数</param> /// <param name="md">TitleList</param> private void AddPapersTitleList(string Type, int PapersID, int Score, Model.TitleList md) { BLL.PapersTitleList bll = new BLL.PapersTitleList(); Model.PapersTitleList model = new Model.PapersTitleList(); model.Title = md.Title; model.T_F = md.T_F; model.Analysis = md.Analysis; model.ID = md.ID; model.CourseID = md.CourseID; model.Score = Score; model.Type = Type; model.PapersID = PapersID; if (bll.Add(model) > 0) { AddPapersOptionsList(PapersID, model.ID, model.Score, model.Type); } else { //如果题目添加不成功 } }