/// <summary> /// 未跟家长确认的排课 /// <para>作 者:zhiwei.Tang</para> /// <para>创建时间:2018-11-02</para> /// </summary> /// <param name="orderItem">报名订单课程明细项</param> /// <param name="unconfirmedMakeLesson">未确认排课集合</param> /// <remarks>排课列表</remarks> private List <MakeLessonItemListResponse> UnconfirmedMakeLesson( TblOdrEnrollOrderItem orderItem, IEnumerable <TblTimMakeLesson> unconfirmedMakeLesson) { List <MakeLessonItemListResponse> res = new List <MakeLessonItemListResponse>(); foreach (var item in unconfirmedMakeLesson) { //班级代码 string classNo = _courseBasicData.Classs.FirstOrDefault(x => x.ClassId.Equals(item.ClassId))?.ClassNo ?? string.Empty; //学期名称 string termName = (from a in _courseBasicData.Classs join b in _courseBasicData.Terms on a.TermId equals b.TermId where a.ClassId == item.ClassId select b.TermName).FirstOrDefault() ?? string.Empty; //课程简称 string shortName = (from a in _courseBasicData.Classs join c in _courseBasicData.Courses on a.CourseId equals c.CourseId where a.ClassId == item.ClassId select c.ShortName).FirstOrDefault() ?? string.Empty; //课程等级名称 string levelName = (from a in _courseBasicData.Classs join d in _courseBasicData.CourseLvs on a.CourseLeveId equals d.CourseLevelId where a.ClassId == item.ClassId select d.LevelCnName).FirstOrDefault() ?? string.Empty; //老师名称 var teacherName = (from a in _courseBasicData.Classs join f in _courseBasicData.Teachers on a.TeacherId equals f.TeacherId where a.ClassId == item.ClassId select f.TeacherName).FirstOrDefault() ?? string.Empty; res.Add(new MakeLessonItemListResponse { TermTypeName = TermTypeService.GetTermTypeName(orderItem.TermTypeId), ClassTimes = orderItem.ClassTimes, ClassTimesUse = item.ClassTimes, EnrollOrderItemId = orderItem.EnrollOrderItemId, ShortName = shortName, LevelName = levelName, ClassNo = classNo, TeacherName = teacherName, TermName = termName, Status = 1, }); } return(res); }
/// <summary> /// 未排课 /// <para>作 者:zhiwei.Tang</para> /// <para>创建时间:2018-11-02</para> /// </summary> /// <param name="orderItem">报名订单课程明细</param> /// <returns>排课项</returns> private MakeLessonItemListResponse NotMakeLesson(TblOdrEnrollOrderItem orderItem) { MakeLessonItemListResponse res = new MakeLessonItemListResponse { TermTypeName = TermTypeService.GetTermTypeName(orderItem.TermTypeId), ClassTimes = orderItem.ClassTimes, EnrollOrderItemId = orderItem.EnrollOrderItemId, ClassTimesUse = 0, ShortName = string.Empty, ClassNo = string.Empty, TeacherName = string.Empty, TermName = string.Empty, LevelName = string.Empty, Status = 0, }; return(res); }
/// <summary> /// 获取的排课详情 /// <para>作 者:zhiwei.Tang</para> /// <para>创建时间:2018-11-06</para> /// </summary> /// <param name="enrollOrderItemId">报名课程订单Id</param> /// <returns>学生报名一个课程的排课详细信息</returns> public MakeLessonDetailResponse GetMakeLessonDetail(long enrollOrderItemId) { MakeLessonDetailResponse res = new MakeLessonDetailResponse { CourseInfos = new List <CourseInformation>() }; TblOdrEnrollOrderItem enrollOrderItem = _enrollOrderItemRepository.Load(enrollOrderItemId); TblOdrEnrollOrder enrollOrder = _enrollOrderRepository.Load(enrollOrderItem.EnrollOrderId); TblDatCourse course = CourseService.GetByCourseId(enrollOrderItem.CourseId); res.RegisterInfo = new RegisterInformation() { ClassTimes = enrollOrderItem.ClassTimes, ClassTimesUse = enrollOrderItem.ClassTimesUse, CourseName = string.Empty, LevelName = CourseLevelService.GetById(enrollOrderItem.CourseLevelId)?.LevelCnName ?? string.Empty, Year = enrollOrderItem.Year, CourseType = CourseType.Elective, TermTypeId = enrollOrderItem.TermTypeId, TermTypeName = TermTypeService.GetTermTypeName(enrollOrderItem.TermTypeId), EnrollDate = enrollOrder.CreateTime }; if (course != null) { res.RegisterInfo.CourseName = course.ShortName; res.RegisterInfo.CourseType = CourseType.Compulsory; } List <TblTimMakeLesson> makeLessons = _makeLessonRepository.GetUnconfirmedMakeLessonList(enrollOrderItem.EnrollOrderItemId); if (makeLessons.Any()) { List <long> classIds = makeLessons.Select(x => x.ClassId).ToList(); List <TblDatClass> classes = DefaultClassService.GetClassByClassIdAsync(classIds).Result; List <ViewRoomCourse> classRooms = ClassRoomService.GetClassRoomBySchoolId(enrollOrder.SchoolId); //老师 var teacherList = TeachService.GetTeachers(); foreach (var makeLesson in makeLessons) { var classInfo = classes.FirstOrDefault(x => x.ClassId == makeLesson.ClassId); var classSchoolTimes = new DefaultClassService(classInfo.ClassId).ClassSchoolTimes; //老师信息 var teacher = teacherList.FirstOrDefault(x => x.TeacherId == classInfo.TeacherId); CourseInformation courseInformation = new CourseInformation { ClassId = classInfo.ClassId, Year = enrollOrderItem.Year, ClassNo = classInfo.ClassNo, ClassTimesUse = makeLesson.ClassTimes, CourseName = course?.ShortName ?? string.Empty, FirstClassTime = makeLesson.FirstClassTime, RoomNo = classRooms.FirstOrDefault(x => x.ClassRoomId == classInfo.ClassRoomId)?.RoomNo ?? string.Empty, LevelName = CourseLevelService.GetById(classInfo.CourseLeveId)?.LevelCnName ?? string.Empty, TeacherName = teacher?.TeacherName ?? string.Empty, TermName = TermService.GetTermByTermId(classInfo.TermId)?.TermName ?? string.Empty, Week = classSchoolTimes.Select(x => x.WeekDay) .Distinct() .OrderBy(x => x) .Select(x => WeekDayConvert.IntToString(x)) .ToList(), PeriodTime = new List <string>() }; foreach (var item in classSchoolTimes) { string time = item.BeginTime + "-" + item.EndTime; if (courseInformation.PeriodTime.Any(x => x == time)) { continue; } courseInformation.PeriodTime.Add(time); } res.CourseInfos.Add(courseInformation); } } return(res); }