Пример #1
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);
        }
Пример #2
0
        /// <summary>
        /// 学生个人信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DtoStudentInfo GetStudentInfo(int id)
        {
            StudentBll      studentBll      = new StudentBll();
            StudentApplyBll studentApplyBll = new StudentApplyBll();
            var             studentInfo     = studentBll.StudentRepository.GetStudentInfoById(id);

            if (studentInfo.Bst_SchoolId > 0)
            {
                return(studentInfo);
            }
            DtoStudentApplySchool studentApplySchool = studentApplyBll.GetApplyByStudentId(id);

            if (studentApplySchool != null)
            {
                studentInfo.ApplyStatus     = studentApplySchool.Yay_Status;
                studentInfo.ApplySchoolName = studentApplySchool.SchoolName;
            }
            return(studentInfo);
        }
Пример #3
0
        /// <summary>
        /// 更新学生申请状态
        /// </summary>
        /// <param name="yayId"></param>
        /// <param name="toStatus"></param>
        /// <param name="oper"></param>
        /// <returns></returns>
        public bool UpdateApplyStatus(int yayId, int toStatus, int fromStatus, int oper)
        {
            bool result = false;
            DtoStudentApplySchool model = StudentApplySchoolRepository.GetById(yayId);

            if (model == null)
            {
                return(false);
            }
            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    var updateApply   = StudentApplySchoolRepository.UpdateApplyStatus(yayId, toStatus, fromStatus, oper);
                    var updateStudent = true;
                    if (updateApply && toStatus == (int)ApplyStatusEnum.意)
                    {
                        updateStudent = StudentBll.UpdateSchool(model.Yay_StudentId, model.Yay_SchoolId);
                    }
                    if (updateApply && updateStudent)
                    {
                        scope.Complete();
                        result = true;
                    }
                    else
                    {
                        RollbackTran();
                    }
                }
                catch (Exception ex)
                {
                    RollbackTran();
                    throw;
                }
            }
            return(result);
        }
Пример #4
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);
        }