/// <summary> /// 新增或修改考试 /// </summary> /// <param name="Id"></param> /// <returns></returns> public ActionResult EditExamination(int?Id) { var exam = new tbExamination(); if (Id.HasValue) { exam = _examinationBL.GetExamination(Id.Value); if (exam != null) { exam.ExamBeginTime = exam.ExamBeginTime.ToLocalTime(); exam.ExamEndTime = exam.ExamEndTime.ToLocalTime(); exam.LastUpdateTime = exam.LastUpdateTime.ToLocalTime(); } } string ApprovalUserIds = exam.ApprovalUser == null ? "" : exam.ApprovalUser.Aggregate("", (current, id) => current + (id + ",")); if (!string.IsNullOrEmpty(ApprovalUserIds)) { ApprovalUserIds = ApprovalUserIds.Remove(ApprovalUserIds.Length - 1); } if (exam != null) { tbExampaper paper = _exampaperBL.GetExampaper(exam.PaperID); if (paper != null) { ViewBag.PaperName = paper.ExampaperTitle; } } ViewBag.ApprovalUserIds = ApprovalUserIds; return(View(exam)); }
/// <summary> /// 判断是否可以进入考试 /// </summary> /// <param name="euID">考试人员ID</param> /// <param name="flag">0:列表进入;1:真正进入</param> /// <returns></returns> public JsonResult JudgeCanExamTest(int euID, int flag) { tbExamSendStudent eu = ExamTestBL.GetExamUser(euID); //当SourceType不等于0的时候 表示是课程下的考试 //if (eu.SourceType == 0) //{ if (eu.SourceType == 0) { tbExamination exam = ExaminationBL.GetExamination(eu.RelationID); if (eu.TestTimes >= exam.TestTimes) { return(Json(new { result = 0, message = "进入次数已达到上限!" }, JsonRequestBehavior.AllowGet)); } if (exam.ExamEndTime.ToLocalTime() <= DateTime.Now) { return(Json(new { result = 0, message = "本场考试已经结束,不可进入!" }, JsonRequestBehavior.AllowGet)); } eu.TestTimes += 1; if (flag == 1) { ExamTestBL.SaveExamUser(eu); } } //} else { var coursepaper = ICoCoursePaperBL.GetCo_CourseMainPaper(eu.RelationID); if (eu.TestTimes >= coursepaper.TestTimes) { return(Json(new { result = 0, message = "进入次数已达到上限!" }, JsonRequestBehavior.AllowGet)); } eu.TestTimes += 1; if (flag == 1) { ExamTestBL.SaveExamUser(eu); } //ICoCoursePaperBL.UpdateTestTimes(eu.RelationID); } return(Json(new { result = 1 }, JsonRequestBehavior.AllowGet)); }