public JsonResult CheckTaskIsDone(int taskId) { var taskBookTimus = _bookWorkTaskService.GetTaskBookTiMus(taskId); var allcount = taskBookTimus.Count; var markcount = taskBookTimus.Count(p => p.Timu.Difficult > 0); if (allcount == markcount || _workContext.CurrentCustomer.IsAdmin()) { var text = "提交后无法再进行修改,确认提交吗?"; object result = new { IsDone = true, Text = text }; return(Json(result, JsonRequestBehavior.AllowGet)); } else { var text = "共" + allcount + "题,目前只标定" + markcount + "题,无法提交"; object result = new { IsDone = false, Text = text }; return(Json(result, JsonRequestBehavior.AllowGet)); } }
public JsonResult SignWrong(Guid tmid, BookTiMu.TimuStatus status, int taskId, string errorInfo) { var booktimu = _bookWorkTaskItemService.GetBookTiMuById(tmid); if (booktimu != null) { booktimu.Status = status; } booktimu.ErrorInfo = errorInfo; _bookWorkTaskService.SignTmWrong(booktimu);//标记错题 //标记章节错题状态 var chapterCount = booktimu.TaskItem.TaskBookTiMus.Count(p => p.Status == BookTiMu.TimuStatus.Invalid); booktimu.TaskItem.Status = chapterCount > 0 ? 1 : 0; _bookWorkTaskItemService.UpdateBookWorkTaskItem(booktimu.TaskItem); var task = _bookWorkTaskService.GetBookWorkTask(taskId); //任务 var alltasktimu = _bookWorkTaskService.GetTaskBookTiMus(taskId); //任务包含的题目 var wrongcount = alltasktimu.Count(p => p.Status == BookTiMu.TimuStatus.Invalid); //任务包含标记有误的题目数 var valid = 1; if (wrongcount > 0) { valid = 0; } task.AllTmIsvalid = valid; _bookWorkTaskService.SubmitTask(task); if (status == BookTiMu.TimuStatus.Valid) { object result = new { IsWrong = false, Status = status }; return(Json(result, JsonRequestBehavior.AllowGet)); } else { object result = new { IsWrong = true, Status = status }; return(Json(result, JsonRequestBehavior.AllowGet)); } }