///// #region 2.0 返回分页数据 +ActionResult GetPageData() /// <summary> /// 2.0 返回分页数据 /// </summary> /// <returns></returns> public ActionResult GetPageData() { //页码 int pageIndex = int.Parse(Request.Params["pageIndex"]); //页容量 int pageSize = int.Parse(Request.Params["pageSize"]); //总页数 int pageCount = 0; //总记录条数 int recordCount = 0; //获取分页数据 List <MODEL.T_Paper> list = OperateContext.Current.BLLSession.IPaperBLL .GetPagedList(pageIndex, pageSize, q => q.IsDel == false, qb => qb.ID).ToList(); //转为DTOModel List <MODEL.DTOModel.T_PaperDTO> listDTO = new List <MODEL.DTOModel.T_PaperDTO>(); foreach (MODEL.T_Paper p in list) { //限制试卷名称长度 //if (p.PaperName.Length > 28) //{ // p.PaperName = p.PaperName.Substring(0, 40) + "..."; //} MODEL.DTOModel.T_PaperDTO pDTO = new MODEL.DTOModel.T_PaperDTO(); pDTO = p.ToDTO(); //查找试卷对应出卷人ID的姓名 //pDTO.PaperProducerName = // OperateContext.Current.BLLSession.ITeacherInfoBLL.GetListBy(ti => ti.ID == pDTO.PaperProducerID) // .Select(ti => ti.Name).FirstOrDefault(); listDTO.Add(pDTO); } //计算总页数和总记录条数 list = OperateContext.Current.BLLSession.IPaperBLL.GetListBy(q => q.IsDel == false).ToList(); recordCount = list.Count; if (recordCount % pageSize == 0) { pageCount = recordCount / pageSize; } else { pageCount = recordCount / pageSize + 1; } //封装为Json数据 MODEL.FormatModel.AjaxPagedModel jsonData = new MODEL.FormatModel.AjaxPagedModel() { Data = listDTO, BackUrl = null, Msg = "ok", Statu = "ok", PageCount = pageCount, RecordCount = recordCount }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
///// #region 2.0 返回分页数据 +ActionResult GetPageData() /// <summary> /// 2.0 返回分页数据 /// </summary> public ActionResult GetPageData() { //页码 int pageIndex = int.Parse(Request.Params["pageIndex"]); //页容量 int pageSize = int.Parse(Request.Params["pageSize"]); //总页数 int pageCount = 0; //总记录条数 int recordCount = 0; //获取分页数据 List <MODEL.T_Question> list = OperateContext.Current.BLLSession.IQuestionBLL .GetPagedList(pageIndex, pageSize, q => q.IsDel == false, qb => qb.ID).ToList(); //转为DTOModel List <MODEL.DTOModel.T_QuestionDTO> listDTO = new List <MODEL.DTOModel.T_QuestionDTO>(); foreach (MODEL.T_Question q in list) { //限制题目内容长度 if (q.QuestionContent.Length > 45) { q.QuestionContent = q.QuestionContent.Substring(0, 45) + "..."; } listDTO.Add(q.ToDTO()); } //计算总页数和总记录条数 list = OperateContext.Current.BLLSession .IQuestionBLL.GetListBy(q => q.IsDel == false).ToList(); recordCount = list.Count; if (recordCount % pageSize == 0) { pageCount = recordCount / pageSize; } else { pageCount = recordCount / pageSize + 1; } //封装为Json数据 MODEL.FormatModel.AjaxPagedModel jsonData = new MODEL.FormatModel.AjaxPagedModel() { Data = listDTO, BackUrl = null, Msg = "ok", Statu = "ok", PageCount = pageCount, RecordCount = recordCount }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 2.0 返回分页数据 /// </summary> public ActionResult GetPageDatatype() { string questioncontent = Request.Params["content"]; if (questioncontent == ",") { questioncontent = ""; } int id; if (Request.Params["typeId"] != "") { id = int.Parse(Request.Params["typeId"]); } else { id = 3; } //页码 int pageIndex = int.Parse(Request.Params["pageIndex"]); //页容量 int pageSize = int.Parse(Request.Params["pageSize"]); //试卷Id int paperId = int.Parse(Request.Params["paperId"]); //总页数 int pageCount = 0; //总记录条数 int recordCount = 0; if (id != 3) { //获取分页数据 List <MODEL.T_Question> list = OperateContext.Current.BLLSession.IQuestionBLL .GetPagedList(pageIndex, pageSize, q => (q.IsDel == false && q.QuestionTypeID == id && q.QuestionContent.Contains(questioncontent)), qb => qb.ID).ToList(); //转为DTOModel List <MODEL.DTOModel.T_QuestionDTO> listDTO = new List <MODEL.DTOModel.T_QuestionDTO>(); foreach (MODEL.T_Question q in list) { //限制题目内容长度 if (q.QuestionContent.Length > 45) { q.QuestionContent = q.QuestionContent.Substring(0, 45) + "..."; } //转为DTOmodel MODEL.DTOModel.T_QuestionDTO qDTO = q.ToDTO(); //判断该题目是否存在于试卷中 if (OperateContext.Current.BLLSession.IPaperQuestionBLL .GetListBy(pq => pq.PaperID == paperId & pq.QuestionID == q.ID) .FirstOrDefault() != null) { qDTO.IsAdded = true; listDTO.Add(qDTO); } else { listDTO.Add(qDTO); } } //计算总页数和总记录条数 list = OperateContext.Current.BLLSession .IQuestionBLL.GetListBy(q => (q.IsDel == false && q.QuestionTypeID == id && q.QuestionContent.Contains(questioncontent))).ToList(); recordCount = list.Count; if (recordCount % pageSize == 0) { pageCount = recordCount / pageSize; } else { pageCount = recordCount / pageSize + 1; } //封装为Json数据 MODEL.FormatModel.AjaxPagedModel jsonData = new MODEL.FormatModel.AjaxPagedModel() { Data = listDTO, BackUrl = null, Msg = "ok", Statu = "ok", PageCount = pageCount, RecordCount = recordCount }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); } else { //获取分页数据 List <MODEL.T_Question> list = OperateContext.Current.BLLSession.IQuestionBLL .GetPagedList(pageIndex, pageSize, q => (q.IsDel == false && q.QuestionContent.Contains(questioncontent)), qb => qb.ID).ToList(); //转为DTOModel List <MODEL.DTOModel.T_QuestionDTO> listDTO = new List <MODEL.DTOModel.T_QuestionDTO>(); foreach (MODEL.T_Question q in list) { //限制题目内容长度 if (q.QuestionContent.Length > 45) { q.QuestionContent = q.QuestionContent.Substring(0, 45) + "..."; } //转为DTOmodel MODEL.DTOModel.T_QuestionDTO qDTO = q.ToDTO(); //判断该题目是否存在于试卷中 if (OperateContext.Current.BLLSession.IPaperQuestionBLL .GetListBy(pq => pq.PaperID == paperId & pq.QuestionID == q.ID) .FirstOrDefault() != null) { qDTO.IsAdded = true; listDTO.Add(qDTO); } else { listDTO.Add(qDTO); } } //计算总页数和总记录条数 list = OperateContext.Current.BLLSession .IQuestionBLL.GetListBy(q => (q.IsDel == false && q.QuestionContent.Contains(questioncontent))).ToList(); recordCount = list.Count; if (recordCount % pageSize == 0) { pageCount = recordCount / pageSize; } else { pageCount = recordCount / pageSize + 1; } //封装为Json数据 MODEL.FormatModel.AjaxPagedModel jsonData = new MODEL.FormatModel.AjaxPagedModel() { Data = listDTO, BackUrl = null, Msg = "ok", Statu = "ok", PageCount = pageCount, RecordCount = recordCount }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 2.0 返回分页数据 /// </summary> /// <returns></returns> public ActionResult GetPageData() { //页码 int pageIndex = int.Parse(Request.Params["pageIndex"]); //页容量 int pageSize = int.Parse(Request.Params["pageSize"]); //总页数 int pageCount = 0; //总记录条数 int recordCount = 0; //获取分页数据 List<MODEL.T_Paper> list = OperateContext.Current.BLLSession.IPaperBLL .GetPagedList(pageIndex, pageSize, q => q.IsDel == false, qb => qb.ID).ToList(); //转为DTOModel List<MODEL.DTOModel.T_PaperDTO> listDTO = new List<MODEL.DTOModel.T_PaperDTO>(); foreach (MODEL.T_Paper p in list) { //限制试卷名称长度 //if (p.PaperName.Length > 28) //{ // p.PaperName = p.PaperName.Substring(0, 40) + "..."; //} MODEL.DTOModel.T_PaperDTO pDTO = new MODEL.DTOModel.T_PaperDTO(); pDTO = p.ToDTO(); //查找试卷对应出卷人ID的姓名 //pDTO.PaperProducerName = // OperateContext.Current.BLLSession.ITeacherInfoBLL.GetListBy(ti => ti.ID == pDTO.PaperProducerID) // .Select(ti => ti.Name).FirstOrDefault(); listDTO.Add(pDTO); } //计算总页数和总记录条数 list = OperateContext.Current.BLLSession.IPaperBLL.GetListBy(q => q.IsDel == false).ToList(); recordCount = list.Count; if (recordCount % pageSize == 0) pageCount = recordCount / pageSize; else pageCount = recordCount / pageSize + 1; //封装为Json数据 MODEL.FormatModel.AjaxPagedModel jsonData = new MODEL.FormatModel.AjaxPagedModel() { Data = listDTO, BackUrl = null, Msg = "ok", Statu = "ok", PageCount = pageCount, RecordCount = recordCount }; return Json(jsonData, JsonRequestBehavior.AllowGet); }
/// <summary> /// 2.0 返回分页数据 /// </summary> public ActionResult GetPageData() { //页码 int pageIndex = int.Parse(Request.Params["pageIndex"]); //页容量 int pageSize = int.Parse(Request.Params["pageSize"]); //试卷Id int paperId = int.Parse(Request.Params["paperId"]); //总页数 int pageCount = 0; //总记录条数 int recordCount = 0; //获取分页数据 List<MODEL.T_Question> list = OperateContext.Current.BLLSession.IQuestionBLL .GetPagedList(pageIndex, pageSize, q => q.IsDel == false, qb => qb.ID).ToList(); //转为DTOModel List<MODEL.DTOModel.T_QuestionDTO> listDTO = new List<MODEL.DTOModel.T_QuestionDTO>(); foreach (MODEL.T_Question q in list) { //限制题目内容长度 if (q.QuestionContent.Length > 45) { q.QuestionContent = q.QuestionContent.Substring(0, 45) + "..."; } //转为DTOmodel MODEL.DTOModel.T_QuestionDTO qDTO = q.ToDTO(); //判断该题目是否存在于试卷中 if (OperateContext.Current.BLLSession.IPaperQuestionBLL .GetListBy(pq => pq.PaperID == paperId & pq.QuestionID == q.ID) .FirstOrDefault() != null) { qDTO.IsAdded = true; listDTO.Add(qDTO); } else listDTO.Add(qDTO); } //计算总页数和总记录条数 list = OperateContext.Current.BLLSession .IQuestionBLL.GetListBy(q => q.IsDel == false).ToList(); recordCount = list.Count; if (recordCount % pageSize == 0) pageCount = recordCount / pageSize; else pageCount = recordCount / pageSize + 1; //封装为Json数据 MODEL.FormatModel.AjaxPagedModel jsonData = new MODEL.FormatModel.AjaxPagedModel() { Data = listDTO, BackUrl = null, Msg = "ok", Statu = "ok", PageCount = pageCount, RecordCount = recordCount }; ViewData["pageIndex"] = pageIndex; ViewData["pageId"] = paperId; return Json(jsonData, JsonRequestBehavior.AllowGet); }
/// <summary> /// 2.0 返回分页数据 /// </summary> public ActionResult GetPageDatatype() { string questioncontent = Request.Params["content"]; if (questioncontent == ",") { questioncontent = ""; } int id; if (Request.Params["typeId"] != "") { id = int.Parse(Request.Params["typeId"]); } else { id = 3; } if (id != 3) { //页码 int pageIndex = int.Parse(Request.Params["pageIndex"]); //页容量 int pageSize = int.Parse(Request.Params["pageSize"]); //总页数 int pageCount = 0; //总记录条数 int recordCount = 0; //获取分页数据 List<MODEL.T_Question> list = OperateContext.Current.BLLSession.IQuestionBLL .GetPagedList(pageIndex, pageSize, q => (q.IsDel == false && q.QuestionTypeID == id && q.QuestionContent.Contains(questioncontent)), qb => qb.ID).ToList(); //转为DTOModel List<MODEL.DTOModel.T_QuestionDTO> listDTO = new List<MODEL.DTOModel.T_QuestionDTO>(); foreach (MODEL.T_Question q in list) { //限制题目内容长度 if (q.QuestionContent.Length > 45) { q.QuestionContent = q.QuestionContent.Substring(0, 45) + "..."; } listDTO.Add(q.ToDTO()); } //计算总页数和总记录条数 list = OperateContext.Current.BLLSession .IQuestionBLL.GetListBy(q => q.IsDel == false && q.QuestionTypeID == id && q.QuestionContent.Contains(questioncontent)).ToList(); recordCount = list.Count; if (recordCount % pageSize == 0) pageCount = recordCount / pageSize; else pageCount = recordCount / pageSize + 1; //封装为Json数据 MODEL.FormatModel.AjaxPagedModel jsonData = new MODEL.FormatModel.AjaxPagedModel() { Data = listDTO, BackUrl = null, Msg = "ok", Statu = "ok", PageCount = pageCount, RecordCount = recordCount }; return Json(jsonData, JsonRequestBehavior.AllowGet); } else { //页码 int pageIndex = int.Parse(Request.Params["pageIndex"]); //页容量 int pageSize = int.Parse(Request.Params["pageSize"]); //总页数 int pageCount = 0; //总记录条数 int recordCount = 0; //获取分页数据 List<MODEL.T_Question> list = OperateContext.Current.BLLSession.IQuestionBLL .GetPagedList(pageIndex, pageSize, q => (q.IsDel == false && q.QuestionContent.Contains(questioncontent)), qb => qb.ID).ToList(); //转为DTOModel List<MODEL.DTOModel.T_QuestionDTO> listDTO = new List<MODEL.DTOModel.T_QuestionDTO>(); foreach (MODEL.T_Question q in list) { //限制题目内容长度 if (q.QuestionContent.Length > 45) { q.QuestionContent = q.QuestionContent.Substring(0, 45) + "..."; } listDTO.Add(q.ToDTO()); } //计算总页数和总记录条数 list = OperateContext.Current.BLLSession .IQuestionBLL.GetListBy(q => q.IsDel == false && q.QuestionContent.Contains(questioncontent)).ToList(); recordCount = list.Count; if (recordCount % pageSize == 0) pageCount = recordCount / pageSize; else pageCount = recordCount / pageSize + 1; //封装为Json数据 MODEL.FormatModel.AjaxPagedModel jsonData = new MODEL.FormatModel.AjaxPagedModel() { Data = listDTO, BackUrl = null, Msg = "ok", Statu = "ok", PageCount = pageCount, RecordCount = recordCount }; return Json(jsonData, JsonRequestBehavior.AllowGet); } }
/// <summary> /// 12.0 获取分页答卷信息 /// </summary> public ActionResult GetInfoRank() { List<MODEL.T_AnswerSheet> list = OperateContext.Current.BLLSession.IAnswerSheetBLL.GetListBy(q => q.ID > 0).OrderBy(q=>q.Score).ToList(); //将答卷转为DTOModel List<MODEL.DTOModel.T_AnswerSheetDTO> listDTO = new List<MODEL.DTOModel.T_AnswerSheetDTO>() { }; foreach (MODEL.T_AnswerSheet a in list) { listDTO.Add(a.ToDTO()); } //根据答卷查找到答卷人的详细信息并计算其得分 foreach (MODEL.DTOModel.T_AnswerSheetDTO aDTO in listDTO) { //答卷人信息 MODEL.T_InterviewerInfo infoModel = OperateContext.Current.BLLSession .IInterviewerInfoBLL.GetListBy(ii => ii.ID == aDTO.InterviewerID).First(); aDTO.InterviewerInfo = infoModel.ToDTO(); //计算选择题得分 aDTO.ChoiceScore = GetChoiceScore(infoModel.ID); //计算简答题得分 aDTO.BriefScore = GetBriefScore(infoModel.ID); //计算总分 aDTO.TotalScore = aDTO.BriefScore + aDTO.ChoiceScore; //检查该答卷是否已经被评判 object oTemp = OperateContext.Current.BLLSession .IAnswerSheetCommentBLL.GetListBy(a => a.AnswerSheetID == aDTO.ID).FirstOrDefault(); if (oTemp != null) { aDTO.IsRated = true; } } //计算总页数和总记录条数 list = OperateContext.Current.BLLSession.IAnswerSheetBLL.GetListBy(q => q.ID > 0).ToList(); List<MODEL.DTOModel.T_AnswerSheetDTO> Data1 = listDTO.ToList(); //答卷DTO转为JsonModel MODEL.FormatModel.AjaxPagedModel jsonModel = new MODEL.FormatModel.AjaxPagedModel() { //Data = listDTO.OrderByDescending(ld=>ld.TotalScore),//按总分排名(分页内) Data = Data1, BackUrl = "", Msg = "ok", Statu = "ok", }; return Json(jsonModel, JsonRequestBehavior.AllowGet); }
/// <summary> /// 2.0 获取分页答卷信息 /// </summary> public ActionResult GetAnswerSheetInfo() { //List<MODEL.T_AnswerSheet> list = // OperateContext.Current.BLLSession.IAnswerSheetBLL.GetListBy(q => q.ID > 0).ToList(); //foreach (MODEL.T_AnswerSheet q in list) //{ // int totalscore = GetChoiceScore(q.InterviewerID) + GetBriefScore(q.InterviewerID); // MODEL.T_AnswerSheet model = OperateContext.Current.BLLSession.IAnswerSheetBLL.GetListBy(a => a.ID == q.ID).First(); // model.Score = totalscore; // OperateContext.Current.BLLSession.IAnswerSheetBLL.Modify(model, "Score"); //} //页码 int pageIndex = int.Parse(Request.Params["pageIndex"]); //页容量 int pageSize = int.Parse(Request.Params["pageSize"]); int count = int.Parse(Request.Params["count"]); //总页数 int pageCount = 0; //总记录条数 int recordCount = 0; //List<MODEL.T_AnswerSheet> list1 = // OperateContext.Current.BLLSession.IAnswerSheetBLL.GetListBy(q => q.ID > 0).ToList(); //foreach (MODEL.T_AnswerSheet q in list1) //{ // int totalscore = GetChoiceScore(q.InterviewerID) + GetBriefScore(q.InterviewerID); // MODEL.T_AnswerSheet model = OperateContext.Current.BLLSession.IAnswerSheetBLL.GetListBy(a => a.ID == q.ID).First(); // model.Score = totalscore; // OperateContext.Current.BLLSession.IAnswerSheetBLL.Modify(model, "Score"); //} int recordCount1 = count; //计算总页数 int pageCount1; if (recordCount % 10 == 0) pageCount1 = recordCount1 / 10; else pageCount1 = recordCount1 / 10 + 1; //获取分页信息 List<MODEL.T_AnswerSheet> list = OperateContext.Current.BLLSession .IAnswerSheetBLL.GetPagedList(pageIndex, pageSize,ref pageCount1, bs => bs.ID > 0, bs => bs.Score,false).ToList(); //将答卷转为DTOModel List<MODEL.DTOModel.T_AnswerSheetDTO> listDTO = new List<MODEL.DTOModel.T_AnswerSheetDTO>() { }; foreach (MODEL.T_AnswerSheet a in list) { listDTO.Add(a.ToDTO()); } //根据答卷查找到答卷人的详细信息并计算其得分 foreach (MODEL.DTOModel.T_AnswerSheetDTO aDTO in listDTO) { //答卷人信息 MODEL.T_InterviewerInfo infoModel = OperateContext.Current.BLLSession .IInterviewerInfoBLL.GetListBy(ii => ii.ID == aDTO.InterviewerID).First(); aDTO.InterviewerInfo = infoModel.ToDTO(); //计算选择题得分 aDTO.ChoiceScore = GetChoiceScore(infoModel.ID); //计算简答题得分 aDTO.BriefScore = GetBriefScore(infoModel.ID); //计算总分 aDTO.TotalScore = aDTO.BriefScore + aDTO.ChoiceScore; //检查该答卷是否已经被评判 //object oTemp = OperateContext.Current.BLLSession // .IAnswerSheetCommentBLL.GetListBy(a => a.AnswerSheetID == aDTO.ID).FirstOrDefault(); //if (oTemp != null) //{ // aDTO.IsRated = true; //} List<MODEL.T_AnswerSheetComment> lista = OperateContext.Current.BLLSession .IAnswerSheetCommentBLL.GetListBy(q => q.AnswerSheetID == aDTO.ID).ToList(); if (lista.Count == 3) { aDTO.IsRated = true; } aDTO.Peoplecount = lista.Count; } ////计算总页数和总记录条数 //list = OperateContext.Current.BLLSession.IAnswerSheetBLL.GetListBy(q => q.ID > 0).ToList(); recordCount = count; if (recordCount % pageSize == 0) pageCount = recordCount / pageSize; else pageCount = recordCount / pageSize + 1; List<MODEL.DTOModel.T_AnswerSheetDTO> Data1 = listDTO.ToList(); //答卷DTO转为JsonModel MODEL.FormatModel.AjaxPagedModel jsonModel = new MODEL.FormatModel.AjaxPagedModel() { //Data = listDTO.OrderByDescending(ld=>ld.TotalScore),//按总分排名(分页内) Data = Data1, BackUrl = "", Msg = "ok", Statu = "ok", PageCount = pageCount, RecordCount = recordCount }; return Json(jsonModel, JsonRequestBehavior.AllowGet); }