Beispiel #1
0
 private Discount GetSecondCourseDiscount(OrderDetail orderDetail)
 {
     if (!orderDetail.Order.IsOrganization && orderDetail.SecondCourse_TC != null &&
         !CourseService.NotSecondCourses().Contains(orderDetail.Course_TC))
     {
         var authTC       = orderDetail.Course.AuthorizationType_TC;
         var percentValue = AuthorizationTypes.GetSecondCourseDiscount(authTC);
         return(new Discount {
             Discount_ID = Discounts.SecondCourseId,
             PercentValue = percentValue
         });
     }
     return(null);
 }
Beispiel #2
0
        public CourseBaseVM.SecondCourseDiscount SecondCourse(string courseTC, CourseLink course)
        {
            if (course == null)
            {
                return(null);
            }
            var price       = PriceService.GetPriceByType(courseTC, PriceTypes.Main, null);
            var secondPrice = PriceService.GetPriceByType(course.CourseTC, PriceTypes.Main, null);

            if (!secondPrice.HasValue || !price.HasValue)
            {
                return(null);
            }
            var authTypeTC              = CourseService.GetValues(course.CourseTC, x => x.AuthorizationType_TC);
            var discountPercent         = AuthorizationTypes.GetSecondCourseDiscount(authTypeTC);
            var secondpriceWithDiscount = OrderDetail.FloorToFifty(secondPrice.Value * (1.0m - discountPercent / 100.0m));

            return(new CourseVM.SecondCourseDiscount {
                SecondCourse = course,
                Discount = (secondPrice.Value - secondpriceWithDiscount),
                SumWithDiscount = secondpriceWithDiscount + price.Value
            });
        }