/// <summary> /// 得到ExamPaperInfo /// </summary> /// <returns></returns> public Entities.ExamPaperInfo GetExamPaperInfo(long EPID) { Entities.ExamPaperInfo ExamPaperInfo = new ExamPaperInfo(); //取试卷主表实体 ExamPaperInfo.ExamPaper = Dal.ExamPaper.Instance.GetExamPaper(EPID); List <Entities.ExamBigQuestioninfo> ExamBigQuestioninfoList = null; List <Entities.ExamBigQuestion> ExamBigQuestionList = BLL.ExamBigQuestion.Instance.GetExamBigQuestionList(EPID); if (ExamBigQuestionList != null & ExamBigQuestionList.Count > 0) { ExamBigQuestioninfoList = new List <ExamBigQuestioninfo>(); for (int i = 0; i < ExamBigQuestionList.Count; i++) { Entities.ExamBigQuestioninfo ExamBigQuestioninfo = new ExamBigQuestioninfo(); ExamBigQuestioninfo.ExamBigQuestion = ExamBigQuestionList[i]; List <Entities.ExamBSQuestionShip> ExamBSQuestionShipList = null; ExamBSQuestionShipList = BLL.ExamBSQuestionShip.Instance.GetExamBSQuestionShipList(ExamBigQuestionList[i].BQID); ExamBigQuestioninfo.ExamBSQuestionShipList = ExamBSQuestionShipList; ExamBigQuestioninfoList.Add(ExamBigQuestioninfo); } } ExamPaperInfo.ExamBigQuestioninfoList = ExamBigQuestioninfoList; return(ExamPaperInfo); }
public ExamPaperInfo Load(int paperId) { DbModel.ExamPaperInfo paperInfo = InternalLoad(paperId); if (paperInfo == null) { return(null); } ExamPaperInfo result = new ExamPaperInfo(); result.Id = paperInfo.Id; result.Name = paperInfo.ExamName; result.ExamMinute = paperInfo.ExamMinute; result.ExamScore = paperInfo.ExamScore; result.QuestionRank = paperInfo.QuestionNums; result.ExamDateFrom = paperInfo.ExamDateFrom; result.ExamDateTo = paperInfo.ExamDateTo; result.Remark = paperInfo.Remark; result.Questions = QueryQuestion(result.Id).ToList(); result.QuestionIds = new List <int>(); foreach (QuestionInfo question in result.Questions) { result.QuestionIds.Add(question.Id); } return(result); }
public IQueryable <ExamPaperInfo> Query(int pageIndex, out int totalCount, out int totalPage, Expression <Func <DbModel.ExamPaperInfo, bool> > whereBy, Expression <Func <DbModel.ExamPaperInfo, int> > orderBy) { IEnumerable <DbModel.ExamPaperInfo> paperInfos = _repository.Query(pageIndex, out totalCount, out totalPage, whereBy, orderBy); List <ExamPaperInfo> results = new List <ExamPaperInfo>(); foreach (DbModel.ExamPaperInfo paperInfo in paperInfos) { ExamPaperInfo result = new ExamPaperInfo(); result.Id = paperInfo.Id; result.Name = paperInfo.ExamName; result.ExamMinute = paperInfo.ExamMinute; result.ExamScore = paperInfo.ExamScore; result.ExamDateFrom = paperInfo.ExamDateFrom; result.ExamDateTo = paperInfo.ExamDateTo; result.Remark = paperInfo.Remark; result.QuestionRank = paperInfo.QuestionNums; results.Add(result); } foreach (ExamPaperInfo paperInfo in results) { paperInfo.Questions = QueryQuestion(paperInfo.Id).ToList(); paperInfo.QuestionIds = new List <int>(); foreach (QuestionInfo question in paperInfo.Questions) { paperInfo.QuestionIds.Add(question.Id); } paperInfo.QuestionsNum = paperInfo.Questions.Count; } return(results.AsQueryable()); }
//绑定基础数据 private void BindData() { switch (RequestType) { case "0": BindDataByNormalExam(); break; case "1": BindDataByMakeUpExam(); break; default: return; } spanExamPaperName.InnerText = model_paper.Name; spanExamPaperDesc.InnerText = model_paper.ExamDesc; ExamPaperInfo ExamPaperInfo = null; if (EPID != -2) { ExamPaperInfo = BLL.ExamPaper.Instance.GetExamPaperInfo(EPID); this.ExamPaperView1.ExamPaperInfo = ExamPaperInfo; } }
public IActionResult Exam(int paperId) { ExamPaperInfo examPaper = _examPaperApp.Load(paperId); RandomUtil.CanRepeat = true; RandomUtil.RandomCount = (uint)examPaper.QuestionRank; examPaper.Questions = RandomUtil.Draw(examPaper.Questions.ToList()); return(View(examPaper)); }
private DateTime GeneralUseTime(ExamSubmitInfo submitInfo) { string leftTime = submitInfo.leftTime.Replace(':', '.'); double time1 = StringUtil.GetDouble(leftTime); ExamPaperInfo examPaper = _examPaperApp.Load(submitInfo.examId); double time2 = StringUtil.GetDouble(string.Format("{0}.60", examPaper.ExamMinute - 1)) - time1; string[] lt = time2.ToString("N2").Split('.'); return(DateTime.Now.AddMinutes(StringUtil.GetInt(lt[0]) * -1).AddSeconds(StringUtil.GetInt(lt[1]) * -1)); }
private void CheckIsPassed(ExamRecordInfo recordInfo, ExamSubmitInfo submitInfo) { if (recordInfo == null || submitInfo == null) { return; } ExamPaperInfo examPaper = _examPaperApp.Load(submitInfo.examId); double totalScore = examPaper.ExamScore; double passedScore = totalScore * 0.6; recordInfo.IsPassed = recordInfo.ExamScore >= passedScore; }
public bool Remove(ExamPaperInfo paperInfo) { try { RemoveRelation(paperInfo, paperInfo.Questions.ToList()); _repository.Remove(paperInfo.Id); return(true); } catch (Exception ex) { _log.LogError("删除考卷出错:{0}.", ex); return(false); } }
public IQueryable <ExamPaperInfo> Query(Expression <Func <DbModel.ExamPaperInfo, bool> > expression) { IEnumerable <DbModel.ExamPaperInfo> paperInfos = null; if (expression == null) { paperInfos = _repository.All(); } else { paperInfos = _repository.All(expression); } List <ExamPaperInfo> results = new List <ExamPaperInfo>(); foreach (DbModel.ExamPaperInfo paperInfo in paperInfos) { ExamPaperInfo result = new ExamPaperInfo(); result.Id = paperInfo.Id; result.Name = paperInfo.ExamName; result.ExamMinute = paperInfo.ExamMinute; result.ExamScore = paperInfo.ExamScore; result.ExamDateFrom = paperInfo.ExamDateFrom; result.ExamDateTo = paperInfo.ExamDateTo; result.Remark = paperInfo.Remark; result.QuestionRank = paperInfo.QuestionNums; results.Add(result); } foreach (ExamPaperInfo paperInfo in results) { paperInfo.Questions = QueryQuestion(paperInfo.Id).ToList(); paperInfo.QuestionIds = new List <int>(); foreach (QuestionInfo question in paperInfo.Questions) { paperInfo.QuestionIds.Add(question.Id); } paperInfo.QuestionsNum = paperInfo.Questions.Count; } return(results.AsQueryable()); }
public bool Remove(int paperId) { ExamPaperInfo paperInfo = Load(paperId); return(Remove(paperInfo)); }