Пример #1
0
        public ListResultDto <TeacherCourseArrangeListDto> GetArranages(TeacherCourseArrangeInput input)
        {
            var res     = GetArrangesByCondition(input);
            var mapData = res.MapTo <List <TeacherCourseArrangeListDto> >();

            SetOtherExtendData(mapData);
            return(new ListResultDto <TeacherCourseArrangeListDto>(mapData));
        }
Пример #2
0
        public PagedResultDto <TeacherCourseArrangeListDto> GetPagedArranges(TeacherCourseArrangeInput input)
        {
            var query = GetArrangesByCondition(input);
            var count = query.Count();

            input.SkipCount      = (input.PIndex ?? 1 - 1) * input.PSize ?? 10;
            input.MaxResultCount = input.PSize ?? 10;
            var list = query.PageBy(input).ToList();//ABP提供了扩展方法PageBy分页方式

            return(new PagedResultDto <TeacherCourseArrangeListDto>(count, list.MapTo <List <TeacherCourseArrangeListDto> >()));
        }
Пример #3
0
        private IQueryable <TeacherCourseArrange> GetArrangesByCondition(TeacherCourseArrangeInput input)
        {
            //WhereIf 是ABP针对IQueryable<T>的扩展方法 第一个参数为条件,第二个参数为一个Predicate 当条件为true执行后面的条件过滤
            var query = _teacherCourseArrangeRepository.GetAll()
                        .WhereIf(!input.Id.IsNullOrEmpty(), o => o.Id == input.Id)
                        .WhereIf(input.TeacherId > 0, o => o.TeacherId == input.TeacherId)
                        .WhereIf(!input.ClassType.IsNullOrEmpty(), t => t.ClassType == input.Filter)
                        .WhereIf(input.BeginTime != null, o => o.BeginTime.Value > input.BeginTime)
                        .WhereIf(input.BeginTime != null && input.EndTime != null, o => (input.BeginTime <= o.BeginTime.Value && o.EndTime.Value <= input.EndTime))
                        .Where(o => o.IsDeleted == false);

            query = string.IsNullOrEmpty(input.Sorting)
                        ? query.OrderBy(t => t.BeginTime)
                        : query.OrderBy(t => input.Sorting);
            return(query);
        }
Пример #4
0
        public List <TeacherCourseArrange2SignInOutput> GetTeacherCourseArrange2SignIn(TeacherCourseArrangeInput input)
        {
            var res = GetArrangesByCondition(input).ToList();
            List <TeacherCourseArrange> toRemove = new List <TeacherCourseArrange>();

            foreach (var item in res)
            {
                var hasSign = _signInRepository.GetAllList(s => s.CourseArranges == item.Id).Count() > 0;
                if (hasSign)
                {
                    toRemove.Add(item);
                }
            }
            toRemove.ForEach(o =>
            {
                res.Remove(o);
            });

            List <TeacherCourseArrange2SignInOutput> output = new List <TeacherCourseArrange2SignInOutput>();

            foreach (var item in res)
            {
                output.Add(new TeacherCourseArrange2SignInOutput()
                {
                    TimeDuration = string.Format("{0}--{1}", item.BeginTime.Value.ToString("HH:mm"), item.EndTime.Value.ToString("HH:mm")),
                    Id           = item.Id
                });
            }
            return(output);
        }
Пример #5
0
 public TeacherCourseArrange GetArranage(TeacherCourseArrangeInput input)
 {
     return(_teacherCourseArrangeRepository.Get(input.Id));
 }