コード例 #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);
 }
コード例 #2
0
        private void AssertAuthorized(string aUserName, string[] aSecurableNames)
        {
            AuthorizationTypes lAuthType = CheckPoint.Instance.Authorize(aUserName, aSecurableNames);

            if (lAuthType == AuthorizationTypes.AuthorizationSuccessful)
            {
                return;
            }

            if (lAuthType == AuthorizationTypes.UserNotAuthorized)
            {
                throw new AuthorizationException(aUserName, aSecurableNames);
            }

            if (lAuthType == AuthorizationTypes.UserNonExistant)
            {
                // TODO: Capture the first, last, phone and email of new user
                throw new Exception("User does not exist");
            }
        }
コード例 #3
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
            });
        }