/// <summary> /// 学员下订单 /// </summary> public int MakeOrder(int studentId, int courseId) { CourseBll courseBll = new CourseBll(); SchoolBll schoolBll = new SchoolBll(); Yw_Course course = courseBll.GetCourse(courseId); if (course == null || course.Ycs_Status != (int)CourseStatusEnum.已上架) { throw new AbhsException(ErrorCodeEnum.CourseCanNotBuy, AbhsErrorMsg.ConstCourseCanNotBuy); } Bas_School school = schoolBll.GetSchoolByStudent(studentId); if (school == null) { throw new AbhsException(ErrorCodeEnum.StudentNotBindSchool, AbhsErrorMsg.ConstStudentNotBindSchool); } Yw_CoursePrice price = courseBll.GetCoursePrice(courseId, school.Bsl_Level); Yw_StudentOrder order = new Yw_StudentOrder(); order.Yod_CourseId = courseId; order.Yod_OrderNo = GenerateOrderNo(courseId, studentId); order.Yod_OrderTime = DateTime.Now; order.Yod_OrderType = (int)OrderTypeEnum.订单; order.Yod_PayBatchId = 0; order.Yod_ReferOrderId = 0; order.Yod_PayTime = new DateTime(1900, 1, 1); order.Yod_Status = (int)StudentOrderStatus.待支付; order.Yod_StudentId = studentId; order.Yod_UpdateTime = DateTime.Now; order.Yod_Amount = price.Yce_Price; OrderService.Add(order); return order.Yod_Id; }
/// <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); }
/// <summary> /// 选课中心课程列表(不再使用) /// </summary> public List <DtoSelectCenterResult> GetCourseForSelectCenter(DtoCourseSelectCondition condition, PagingObject paging) { SchoolBll schBll = new SchoolBll(); Bas_School school = schBll.GetSchoolByStudent(condition.StudentId); if (school != null) { return(GetCourseWithPriceForSelectCenter(school, condition, paging)); } else { return(GetCourseWithoutPriceForSelectCenter(condition, paging)); } }