Пример #1
0
 public bool InsertSubjectList(List <Yw_StudentWrongSubject> list)
 {
     if (list.Select(s => s.Yws_WrongBookId).Distinct().Count() > 1)
     {
         return(false);
     }
     return(StudentWrongSubjectRepository.InsertList(list));
 }
Пример #2
0
        public DtoStudentWrongSubjectInfo GetWrongSubject(int wrongSubjectId, bool getIds = false)
        {
            var dto = StudentWrongSubjectRepository.GetDto(wrongSubjectId);

            if (dto != null && getIds)
            {
                dto.WrongSubjectIds = GetSubjectIdsByBookId(dto.Yws_StudentId, dto.Yws_WrongBookId);
            }
            return(dto);
        }
Пример #3
0
        public Tuple <StudentAnswerBase, Yw_SubjectContent, Yw_Subject, Yw_StudentWrongSubject> GetWorngSubjectVm(int studentId, int wrongSubjectId)
        {
            Yw_StudentWrongSubject wrongSubject = StudentWrongSubjectRepository.Get(wrongSubjectId);

            if (wrongSubject == null || wrongSubject.Yws_StudentId != studentId)
            {
                wrongSubject = null;
            }
            if (wrongSubject != null)
            {
                StudentAnswerBase answer         = (wrongSubject as Yw_StudentWrongSubjectExt).Yws_Answer_Obj;
                Yw_SubjectContent subjectContent = SubjectBll.GetSubjectContent(wrongSubject.Yws_WrongSubjectId);
                Yw_Subject        subject        = SubjectBll.GetSubject(wrongSubject.Yws_WrongSubjectId);
                return(new Tuple <StudentAnswerBase, Yw_SubjectContent, Yw_Subject, Yw_StudentWrongSubject>(answer, subjectContent, subject, wrongSubject));
            }
            return(null);
        }
Пример #4
0
        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);
        }
Пример #5
0
 public List <int> GetSubjectIdsByBookId(int studentId, int bookId)
 {
     return(StudentWrongSubjectRepository.GetIdsByBookId(studentId, bookId));
 }
Пример #6
0
 public List <Yw_StudentWrongSubject> GetSubjectByBookId(int bookId)
 {
     return(StudentWrongSubjectRepository.GetByBookId(bookId));
 }