예제 #1
0
        private IEnumerable <ShippingItem> GetEdostShippingRates()
        {
            var edost = new Edost(_method.Params)
            {
                ShippingId   = _method.ShippingMethodId,
                CityTo       = _cityTo,
                Zip          = _zipTo,
                ShoppingCart = _shoppingCart,
                TotalPrice   = _totalPrice - _totalDiscount,
                PickPointID  = _pickupId
            };

            var edostShippings = edost.GetShippingOptions();

            if (edostShippings == null)
            {
                return(null);
            }


            if (!edostShippings.Any())
            {
                edost.CityTo   = _cityTo + " (" + _regionTo + ")";
                edostShippings = edost.GetShippingOptions();
            }

            if (!edostShippings.Any())
            {
                edost.CityTo   = _regionTo;
                edostShippings = edost.GetShippingOptions();
            }
            if (edostShippings == null)
            {
                return(null);
            }

            if (!edostShippings.Any())
            {
                edost.CityTo   = _countryName;
                edostShippings = edost.GetShippingOptions();
            }

            if (edostShippings == null)
            {
                return(null);
            }

            return(edostShippings.Select(
                       item =>
                       new ShippingItem(_method)
            {
                Id = ++_index,
                Type = ShippingType.eDost,
                MethodNameRate = item.Name,
                Rate = item.Rate,
                DeliveryTime = item.DeliveryTime,
                Ext = GetItemExt(item.Extend),
                ShippingPoints = item.ShippingPoints
            }));
        }
예제 #2
0
        private IEnumerable <ShippingListItem> GetEdostShippingRates()
        {
            var edost = new Edost(_method.Params)
            {
                CityTo       = _cityTo,
                Zip          = _zipTo,
                ShoppingCart = _shoppingCart,
                TotalPrice   = _totalPrice - _totalDiscount,
            };

            var edostShippings = edost.GetShippingOptions();

            if (edostShippings == null || !edostShippings.Any())
            {
                edost.CityTo   = _regionTo;
                edostShippings = edost.GetShippingOptions();
            }
            if (edostShippings == null || !edostShippings.Any())
            {
                edost.CityTo   = _countryName;
                edostShippings = edost.GetShippingOptions();
            }

            return(edostShippings.Select(
                       item =>
                       new ShippingListItem
            {
                Id = ++_index,
                Type = ShippingType.eDost,
                MethodId = _method.ShippingMethodId,
                MethodName = _method.Name,
                MethodNameRate = item.Name,
                Rate = item.Rate,
                DeliveryTime = item.DeliveryTime,
                IconName = _method.IconFileName.PhotoName,
                MethodDescription = _method.Description,
                Ext = GetId(item.Extend)
            }
                       ));
        }