Пример #1
0
        /// <summary>
        /// 获取班级信息
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间:2018-11-02</para>
        /// </summary>
        /// <param name="datClass">班级信息</param>
        /// <param name="companyId">公司编号</param>
        /// <returns>返回班级详细信息</returns>
        /// <exception cref="BussinessException">
        /// 异常ID:7,数据异常
        /// </exception>
        private static ClassDetailResponse GetClassInfo(TblDatClass datClass, string companyId)
        {
            ClassDetailResponse dto = new ClassDetailResponse
            {
                ClassId      = datClass.ClassId,
                ClassNo      = datClass.ClassNo,
                RoomCourseId = datClass.RoomCourseId,
                ClassRoomId  = datClass.ClassRoomId,
                CourseId     = datClass.CourseId,
                CourseLeveId = datClass.CourseLeveId,
                TermId       = datClass.TermId,
                CourseNum    = datClass.CourseNum,
                StudentsNum  = datClass.StudentsNum,
                SurplusNum   = datClass.StudentsNum,
            };

            if (dto == null)
            {
                throw new BussinessException((byte)ModelType.SignUp, 7);
            }

            //1、课程名称,课程等级
            CourseResponse course = new CourseService(companyId).GetCourseDetailsAsync(dto.CourseId).Result;

            if (course != null)
            {
                dto.CourseName     = course.CourseCnName;
                dto.CourseLeveName = course.CourseLevels.FirstOrDefault(m => m.CourseLevelId == dto.CourseLeveId)
                                     ?.CourseLevelName;
            }

            dto.TeachName = TeachService.GetTeacher(datClass.TeacherId)?.TeacherName;
            dto.TermName  = TermService.GetTermByTermId(dto.TermId)?.TermName;

            //2、门牌号
            dto.ClassRoomName = new ClassRoomService(dto.ClassRoomId).ClassRoomInfo?.RoomNo;

            //、计算出剩余学位数
            dto.SurplusNum = dto.StudentsNum - MakeLessonService.GetClassScheduleNum(dto.ClassId);

            //3、获取上课时间段数据
            dto.SchoolTimeList = GetDatSchoolTimeInfo(dto.ClassId);

            dto.ClassTime = GetSchoolTime(datClass.ClassId);

            return(dto);
        }
Пример #2
0
        /// <summary>
        /// 查询班级列表
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间:2018-11-02</para>
        /// </summary>
        /// <param name="searcher">班级查询条件</param>
        /// <returns>返回班级集合</returns>
        public static List <ClassListResponse> GetClassList(ClassListSearchRequest searcher)
        {
            // 根据条件查询获取此学期的班级信息
            List <TblDatClass> datClassList = new TblDatClassRepository().GetTermIdByClass(searcher.TermId, searcher.CourseId, searcher.CourseLeaveId, searcher.RoomId, ClassType.Default);

            List <ClassListResponse> classListResult = new List <ClassListResponse>();

            // 组合数据
            foreach (TblDatClass datClass in datClassList)
            {
                ClassListResponse classList = new ClassListResponse
                {
                    ClassId    = datClass.ClassId,
                    ClassNo    = datClass.ClassNo,
                    ClassTime  = GetSchoolTime(datClass.ClassId),
                    SurplusNum = datClass.StudentsNum - MakeLessonService.GetClassScheduleNum(datClass.ClassId)
                };
                classListResult.Add(classList);
            }
            return(classListResult);
        }