Exemplo n.º 1
0
        /// <summary>
        /// 补课周补课分页列表
        /// <para>作    者:Huang GaoLiang</para>
        /// <para>创建时间:2019-03-12</para>
        /// </summary>
        /// <param name="request">查询补课周补课列表条件</param>
        /// <returns>返回补课周补课分页数据</returns>
        public PageResult <ReplenishWeekListResponse> GetReplenishWeekList(ReplenishWeekListSearchRequest request)
        {
            // 1、根据条件查询补课周补课列表
            PageResult <ViewReplenishWeek>         replenishWeekList = new ViewReplenishWeekRepository().GetReplenishWeekList(request);
            PageResult <ReplenishWeekListResponse> list = Mapper.Map <PageResult <ViewReplenishWeek>, PageResult <ReplenishWeekListResponse> >(replenishWeekList);

            // 2、获取补课时间
            var classIds = list.Data.Select(m => m.ClassId).ToList();

            // 3、根据上课班级编号获取

            List <ViewTimAdjustLesson> timAdjustLessonList = new ViewTimAdjustLessonRepository().GetTimeLessonClassList(classIds);

            // 3、组合数据
            foreach (var item in list.Data)
            {
                item.MakeUpTimeList = timAdjustLessonList.Where(m => m.ClassId == item.ClassId && m.StudentId == item.StudentId)
                                      .Select(m => new MakeUpTime
                {
                    ClassDate      = m.ClassDate,
                    ClassBeginTime = m.ClassBeginTime,
                    ClassEndTime   = m.ClassEndTime
                })
                                      .OrderBy(m => m.ClassDate)
                                      .ToList();
            }

            return(list);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取学生补课周补课信息
        /// <para>作    者:HuangGaoLiang </para>
        /// <para>创建时间:2019-03-13</para>
        /// </summary>
        /// <param name="classId">班级编号</param>
        /// <param name="studentId">学生编号</param>
        /// <returns>返回学生补课周补课安排信息</returns>
        private List <ReplenishWeekClassTimeListResponse> GetTimAdjustLessonList(long classId, long studentId)
        {
            // 1、根据条件获取学生的补课周补课信息
            List <ViewTimAdjustLesson> timAdjustLessonList = new ViewTimAdjustLessonRepository().GetTimeLessonClassList(new List <long> {
                classId
            }).Where(m => m.StudentId == studentId).ToList();

            // 2、组合数据
            var list = (from t in timAdjustLessonList

                        join r in ClassRoomService.GetClassRoomListBySchoolId(this._schoolId) on t.ClassRoomId equals r.ClassRoomId into cr
                        from room in cr.DefaultIfEmpty()

                        select new ReplenishWeekClassTimeListResponse
            {
                AdjustLessonId = t.AdjustLessonId,
                Data = t.ClassDate,
                StartTime = t.ClassBeginTime,
                EndTime = t.ClassEndTime,
                ClassRoomId = room == null ? 0 : room.ClassRoomId,
                RoomNo = room == null ? "" : room.RoomNo
            }).ToList();

            return(list);
        }