/// <summary> /// 选课中心课程列表包含价格(学生已经绑定校区) /// </summary> private List <DtoSelectCenterResult> GetCourseWithPriceForSelectCenter(Bas_School school, DtoCourseSelectCondition condition, PagingObject paging) { List <DtoSelectCenterResult> results = new List <DtoSelectCenterResult>(); condition.SetSchoolLevel(school.Bsl_Level); condition.SetSchoolId(school.Bsl_Id); List <DtoSelectCenterCourseObject> courseList = CourseRepository.GetCourseWithPrice(condition, paging); if (courseList.Count > 0) { List <DtoSimpleCourse> simpleCourses = courseList.Select( x => new DtoSimpleCourse() { CourseId = x.CourseId, Amount = x.CoursePrice, CourseType = x.CourseType, Grade = x.Grade }) .ToList(); Dictionary <string, decimal> voucherDic = GetVoucherDicForUserCourse(simpleCourses, condition); foreach (DtoSelectCenterCourseObject obj in courseList) { results.Add(CreateSelectCenterResultItem(obj, voucherDic)); } } return(results); }
/// <summary> /// 选课中心课程详情-预览功能 /// </summary> /// <param name="courseId">课程Id</param> /// <param name="studentId">学生Id</param> /// <returns></returns> public DtoSelectCenterCourseDetailResult GetCourseDetailForPreview(int courseId, int studentId) { DtoSelectCenterCourseDetailResult result = new DtoSelectCenterCourseDetailResult(); DtoCourseSelectCondition condition = new DtoCourseSelectCondition(); condition.StudentId = studentId; DtoSelectCenterCourseDetailObject course = null; Dictionary <string, decimal> voucherDic = null; Yw_StudentOrder order = null; DtoStudentApplySchool applyRecord = null; SchoolBll schBll = new SchoolBll(); Bas_School school = schBll.GetSchoolByStudent(condition.StudentId); if (school != null) { condition.SetSchoolLevel(school.Bsl_Level); condition.SetSchoolId(school.Bsl_Id); course = CourseRepository.GetCourseDetailWithPrice(courseId, condition.SchoolLevel, true); if (course != null && course.CourseId > 0) { DtoSimpleCourse simpleCourse = new DtoSimpleCourse() { CourseId = course.CourseId, Amount = course.CoursePrice, CourseType = course.CourseType, Grade = course.Grade }; voucherDic = GetVoucherDicForUserCourse(new List <DtoSimpleCourse>() { simpleCourse }, condition); //查询用户是否已购买此课程 StudentOrderBll studentOrderBll = new StudentOrderBll(); order = studentOrderBll.GetFinishOrder(condition.StudentId, course.CourseId); } } else { course = CourseRepository.GetCourseDetailWithoutPrice(courseId, true); StudentApplyBll studentApplyBll = new StudentApplyBll(); applyRecord = studentApplyBll.GetApplyByStudentId(condition.StudentId); } if (course != null) { Yw_CourseIntroduction introduction = CourseIntroductionRespository.GetCourseIntroduction(course.CourseId); result = CreateSelectCenterCourseDetailResultItem(course, introduction, school, applyRecord, voucherDic, order); } else { throw new AbhsException(ErrorCodeEnum.CourseNotExists, AbhsErrorMsg.ConstCourseNotExists); } return(result); }