Esempio n. 1
0
        private DtoSelectCenterCourseDetailResult CreateSelectCenterCourseDetailResultItem(DtoSelectCenterCourseDetailObject obj, Yw_CourseIntroduction introduction, Bas_School school, DtoStudentApplySchool applySchoolRecord = null, Dictionary <string, decimal> voucherDic = null, Yw_StudentOrder order = null)
        {
            DtoSelectCenterCourseDetailResult result = new DtoSelectCenterCourseDetailResult();

            result.IsBindSchool = (school != null && school.Bsl_Id > 0) ? true : false;

            result.CourseId     = obj.CourseId;
            result.CourseImage  = obj.CourseImage.ToOssPath();
            result.CourseName   = obj.CourseName;
            result.CourseType   = obj.CourseType;
            result.Grade        = obj.Grade;
            result.LessonCount  = obj.LessonCount;
            result.Description  = obj.Description;
            result.Introduction = introduction?.Yci_Introduction;
            result.Arrange      = introduction?.Yci_Arrange;

            if (result.IsBindSchool)
            {
                result.SellCount          = obj.SellCount;
                result.CoursePrice        = obj.CoursePrice;
                result.BaseVoucherPrice   = voucherDic.ContainsKey(obj.CourseId + "_" + 1) ? voucherDic[obj.CourseId + "_" + 1] : 0;
                result.SchoolVoucherPrice = voucherDic.ContainsKey(obj.CourseId + "_" + 2) ? voucherDic[obj.CourseId + "_" + 2] : 0;
            }

            if (applySchoolRecord != null && applySchoolRecord.Yay_Id > 0)
            {
                result.StudentApplySchoolStatus = applySchoolRecord.Yay_Status;
                result.StudentApplySchoolName   = applySchoolRecord.SchoolName;
            }
            if (order != null && order.Yod_Id > 0)
            {
                result.IsHaveThisCourse = true;
            }
            return(result);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        /// <summary>
        /// 课程中心-课程详情-后台预览
        /// </summary>
        /// <param name="id">课程Id</param>
        /// <returns></returns>
        public ActionResult PreviewCourse(int id = 0)
        {
            CourseBll bll       = new CourseBll();
            int       studentId = GetCurrentUser().StudentId;
            DtoSelectCenterCourseDetailResult course = bll.GetCourseDetailForPreview(id, studentId);
            CourseDetailViewModel             model  = course.ConvertTo <CourseDetailViewModel>();

            model.StudentId = studentId;
            if (string.IsNullOrEmpty(model.CourseImage))
            {
                model.CourseImage = defaultCourseImg;
            }
            return(View(model));
        }
Esempio n. 4
0
        /// <summary>
        /// 课程中心-课程详情
        /// </summary>
        /// <param name="id">课程Id</param>
        /// <returns></returns>
        public ActionResult Detail(int id = 0, int aid = 0)
        {
            if (id == 0)
            {
                return(RedirectToAction("Select"));
            }
            CourseBll bll       = new CourseBll();
            int       studentId = GetCurrentUser().StudentId;
            DtoSelectCenterCourseDetailResult course = bll.GetCourseDetailForSelectCenter(id, studentId);
            CourseDetailViewModel             model  = course.ConvertTo <CourseDetailViewModel>();

            if (string.IsNullOrEmpty(model.CourseImage))
            {
                model.CourseImage = defaultCourseImg;
            }
            model.StudentId = studentId;
            model.Ad_Id     = aid;
            return(View(model));
        }