public ActionResult ExamResult(int euId) { var examuser = _examTestManager.GetExamUser(euId); if (examuser.TestTimes > 1000) { examuser.TestTimes = examuser.TestTimes % 1000; } examuser.TestTimes = examuser.TestTimes + 1000; _examTestManager.SaveExamUser(examuser); ViewBag.EuId = euId; return(View()); }
/// <summary> /// 判断是否可以进入考试 /// </summary> /// <param name="euID">考试人员ID</param> /// <param name="type">0:列表进入;1:真正进入</param> /// <returns>为0时,如果可以进入,则直接返回考试信息</returns> public JsonResult IsCanExamTest(int euId, int type = 0) { int leavePageTimes = 0; tbExamSendStudent eu = _examTestManager.GetExamUser(euId); if (eu.RemainingTime == 0) { return(Json(new { result = 0, msg = "您的考试时间已用完,不可进入!" }, JsonRequestBehavior.AllowGet)); } int examTestTimes = 0; //当SourceType不等于0的时候 表示是课程下的考试 if (eu.SourceType == 0) { tbExamination exam = _examinationManager.GetExamination(eu.RelationID); examTestTimes = exam.TestTimes; if (exam.LeavePageTimes < eu.LeavePageTimes) { return(Json(new { result = 0, msg = "您离开页面的总次数已用完,不可进入!" }, JsonRequestBehavior.AllowGet)); } if (eu.TestTimes >= exam.TestTimes) { return(Json(new { result = 0, msg = "进入次数已达到上限,不可进入!" }, JsonRequestBehavior.AllowGet)); } if (exam.ExamEndTime.ToLocalTime() <= DateTime.Now) { return(Json(new { result = 0, msg = "本场考试已经结束,不可进入!" }, JsonRequestBehavior.AllowGet)); } } else if (eu.SourceType == 1) { } //if (type == 1) //{ eu.TestTimes += 1; _examTestManager.SaveExamUser(eu); return(Json(new { result = 1, msg = "开始考试!" }, JsonRequestBehavior.AllowGet)); //} //var exambase = _examTestManager.GetExamBaseInforShow(euId, leavePageTimes); //return Json(new //{ // result = 1, // msg = "参与考试!", // data = new // { // exambase.ExamRuleList, // exambase.ExamEndTime, // exambase.ExamStartTime, // exambase.ExamLength, // exambase.ExamTitle, // exambase.UserRemainingTime // }, // testTimes = eu.TestTimes > 1000 ? 0 : examTestTimes - eu.TestTimes, // examTestTimes = examTestTimes //}, JsonRequestBehavior.AllowGet); }