示例#1
0
 private void SavePrice(int courseId, decimal price, int level, int currentUser)
 {
     if (price >= 0)
     {
         bool exist  = false;
         var  result = CoursePriceRepository.GetEntity(courseId, level);
         if (result == null)
         {
             result = new Yw_CoursePrice
             {
                 Yce_CourseId      = courseId,
                 Yce_SchoolLevelId = level,
                 Yce_CreateTime    = Clock.Now,
                 Yce_Creator       = currentUser
             };
         }
         else
         {
             exist = true;
             result.EnableAudit();
         }
         result.Yce_Price      = price;
         result.Yce_UpdateTime = Clock.Now;
         result.Yce_Editor     = currentUser;
         if (exist)
         {
             CoursePriceRepository.Update(result);
         }
         else
         {
             CoursePriceRepository.Insert(result);
         }
     }
 }
示例#2
0
        /// <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;
        }