public ActionResult ClearWrong(int bookId, int wrongSubjectId, StudyWrongStatusEnum toStatus) { StudentWrongBookBll wrongBookBll = new StudentWrongBookBll(); var res = wrongBookBll.ClearWrongSubject(bookId, wrongSubjectId, toStatus); return(SimpleResult(res)); }
public bool ClearSubject(int wrongSubjectId, StudyWrongStatusEnum toStatus) { if (toStatus == StudyWrongStatusEnum.已消除 || toStatus == StudyWrongStatusEnum.已做对) { string sql = $"UPDATE dbo.Yw_StudentWrongSubject SET Yws_RemoveTryCount=Yws_RemoveTryCount+1,Yws_UpdateTime=GETDATE(),Yws_Status={(int)toStatus} WHERE Yws_Id={wrongSubjectId}"; return(Execute(sql) > 0); } return(true); }
public bool ClearWrongSubject(int bookId, int wrongSubjectId, StudyWrongStatusEnum toStatus) { bool result = false; if (toStatus == StudyWrongStatusEnum.消除中 || toStatus == StudyWrongStatusEnum.已消除 || toStatus == StudyWrongStatusEnum.已做对) { using (TransactionScope scope = new TransactionScope()) { try { bool clearSubject = StudentWrongSubjectRepository.ClearSubject(wrongSubjectId, toStatus); bool clearBook = StudentWrongBookRepository.RefreshStatus(bookId); //if (toStatus == StudyWrongStatusEnum.已消除) //{ // clearBook = StudentWrongBookRepository.RefreshStatus(bookId); //} result = clearSubject && clearBook; if (result) { scope.Complete(); } else { RollbackTran(); } } catch (Exception) { RollbackTran(); throw; } } } else { result = StudentWrongSubjectRepository.IncrementRemoveCount(wrongSubjectId, 1); } return(result); }