/// <summary> /// 删除校验 /// <para>作 者:zhiwei.Tang</para> /// <para>创建时间:2018-09-15</para> /// </summary> /// <param name="courseId">课程编号</param> /// <exception cref="BussinessException"> /// 异常ID:3,异常描述:已授权给校区 /// 异常ID:3,异常描述:教室已使用该课程 /// 异常ID:3,异常描述:班级已使用该课程 /// </exception> private void RemoveVerify(long courseId) { //1.已授权给校区 bool schoolIsUse = SchoolCourseService.CourseIsUse(courseId); if (schoolIsUse) { throw new BussinessException(ModelType.Timetable, 3); } //2.教室已使用该课程 bool classRoomIsUse = ClassRoomCourseService.CourseIsUse(courseId); if (classRoomIsUse) { throw new BussinessException(ModelType.Timetable, 3); } //3.班级已使用该课程 bool classIsUse = new TblDatClassRepository().CourseIsUse(courseId).Result; if (classIsUse) { throw new BussinessException(ModelType.Timetable, 3); } }
/// <summary> /// 查询班级详情信息 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间:2018-11-02</para> /// </summary> /// <param name="classId">班级编号</param> /// <param name="companyId">公司编号</param> /// <returns>返回班及详情信息</returns> public static ClassDetailResponse GetClassDetail(long classId, string companyId) { // 获取当前学期下该编辑编码下的班级信息 TblDatClassRepository repository = new TblDatClassRepository(); TblDatClass datClass = repository.Load(classId); return(GetClassInfo(datClass, companyId)); }
/// <summary> /// 描述:根据学期获取老师及所属课程 /// <para>作 者:瞿琦</para> /// <para>创建时间:2018.9.25</para> /// </summary> /// <returns>学期下老师及所属课程列表</returns> public List <ClassCourseSearchTeacherResponse> GetTermIdByTeacherList(long termId) { TblDatClassRepository tblDatClassService = new TblDatClassRepository(); //获取所有的老师 var teacherList = TeachService.GetTeachers(); TermCourseTimetableAuditService auditService = new TermCourseTimetableAuditService(termId); //var termTeacherIdList = new List<string>(); var termTeacherIdList = new List <CourseInfo>(); var courseList = new List <CourseInfo>(); if (auditService.NoPass) //审核中 { //根据学期Id查询审核中的班级信息 TblAutClassRepository tblAutClassRepository = new TblAutClassRepository(); var auditId = auditService.TblAutAudit.AuditId; //获取审核中数据的审核Id courseList = tblAutClassRepository.GetByAuditId(auditId).Result.Select(x => new CourseInfo { TeacherId = x.TeacherId, CourseId = x.CourseId }).ToList(); termTeacherIdList = courseList.Distinct(new TeacherComparer()).ToList(); } else //已生效 { //根据学期Id查询已生效的班级信息 courseList = tblDatClassService.GetTermIdByClass(termId).Select(x => new CourseInfo { TeacherId = x.TeacherId, CourseId = x.CourseId }).ToList(); termTeacherIdList = courseList.Distinct(new TeacherComparer()).ToList(); } var classTeachList = (from x1 in termTeacherIdList join x2 in teacherList on x1.TeacherId equals x2.TeacherId select new ClassCourseSearchTeacherResponse { TeacherNo = x2.TeacherId, TeacherName = x2.TeacherName }).ToList(); //获取老师所属的课程 foreach (var courseItem in classTeachList) { courseItem.TeacherByCourse = courseList.Where(x => x.TeacherId == courseItem.TeacherNo).Select(x => new ClassCourseResponse { CourseId = x.CourseId }).Distinct(new CourseInfoComparer()).ToList(); } return(classTeachList); }
/// <summary> /// 根据班级信息查询班级详情信息 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间:2018-11-02</para> /// </summary> /// <param name="classInfo">班级查询信息</param> /// <returns>返回班级详情信息</returns> public static ClassDetailResponse GetClassDetail(ClassInfo classInfo) { // 获取当前学期下该编辑编码下的班级信息 TblDatClassRepository repository = new TblDatClassRepository(); List <long> termIds = TermService.GetTermByTermTypeId(classInfo.Year, classInfo.TermTypeId, classInfo.SchoolId).Select(t => t.TermId).ToList(); //获取学期类型下的所有学期 // 根据学期编号、班级编号、校区编号获取班级信息 TblDatClass datClass = repository.GetByClassNo(termIds, classInfo.classNo, classInfo.SchoolId); if (datClass == null) { return(null); } return(GetClassInfo(datClass, classInfo.CompanyId)); }
/// <summary> /// 获取已排课时间段 /// <para>作 者:zhiwei.Tang</para> /// <para>创建时间:2018-11-06</para> /// </summary> /// <param name="termId">学期id</param> /// <param name="classRoomId">教室Id</param> /// <returns>上课时间段Id列表</returns> private static List <long> GetAlreadyClassTime(long termId, long classRoomId) { TblDatClassRepository classRepository = new TblDatClassRepository(); TblTimClassTimeRepository classTimeRepository = new TblTimClassTimeRepository(); List <TblDatClass> classs = classRepository.GetTermIdByClass(termId) .Where(x => x.ClassRoomId == classRoomId) .ToList(); List <long> classIds = classs.Select(x => x.ClassId).ToList(); List <TblTimClassTime> classTimes = classTimeRepository.GetByClassId(classIds) .Result .Where(x => classIds.Contains(x.ClassId)) .ToList(); return(classTimes.Select(x => x.SchoolTimeId).Distinct().ToList()); }
/// <summary> /// 根据学期Id获取班级代码 /// <para>作 者:郭伟佳</para> /// <para>创建时间:2018-11-19</para> /// </summary> /// <param name="termId">学期Id</param> /// <returns>班级信息列表</returns> public static List <ClassInfoListResponse> GetClassInfoListByTermId(long termId) { //班级信息 var classInfoList = new TblDatClassRepository().GetTermIdByClass(termId); //课程信息 var courseInfo = new TblDatCourseRepository().GetCoursesAsync().Result; var classCourseInfo = from a in classInfoList join b in courseInfo on a.CourseId equals b.CourseId select new ClassInfoListResponse() { ClassId = a.ClassId, ClassNo = a.ClassNo, ClassName = b.ClassCnName }; return(classCourseInfo.ToList()); }
/// <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); }