예제 #1
0
        public List <PriceView> GetAllPricesForCourseFilterByCustomerTye(
            string courseTC, string customerType, string trackTC)
        {
            var priceTypePart = PriceTypes.GetByCustomerType(
                OrderCustomerType.GetOpposite(customerType));

            return(GetAllPricesForCourse(courseTC, trackTC)
                   .Where(pv => !pv.FixedPriceType.Contains(priceTypePart)).ToList());
        }
예제 #2
0
파일: CartService.cs 프로젝트: dKluev/Site
        public OrderDetail CreateDetail(string courseTC, string trackTC, string priceTypeTC)
        {
            var cityTC       = UserSettingsService.CityTC;
            var customerType = OrderCustomerType.PrivatePerson;

            if (AuthService.CurrentUser != null)
            {
                customerType = OrderCustomerType.GetType(AuthService.CurrentUser.IsCompany);
            }
            var prices = PriceService.GetAllPricesForCourseFilterByCustomerTye(courseTC,
                                                                               customerType, trackTC);

            var price = prices.FirstOrDefault(p => p.PriceType_TC == priceTypeTC);

            if (price == null)
            {
                price = prices.AsQueryable().GetDefault();
            }
            if (price == null)
            {
                return(null);
            }
            var orderDetail =
                new OrderDetail
            {
                Course_TC    = courseTC,
                Track_TC     = trackTC,
                PriceType_TC = price.GetOrDefault(x => x.PriceType_TC),
                Price        = price.GetOrDefault(x => x.Price),
                Duration     = price.GetOrDefault(x => x.StudyMonths),
                Count        = 1,
                City_TC      = cityTC,
            };

            AddObligatoryExtras(orderDetail);
            return(orderDetail);
        }