public static List <CustomShippingMethodViewModel> GetCustomShippingMethods(string memberId, ShippingAddress_V01 address, string locale) { try { var country = locale.Substring(3); var shippingProvider = ShippingProvider.GetShippingProvider(locale.Substring(3)); if (shippingProvider == null) { return(null); } var deliveryOptions = shippingProvider.GetDeliveryOptionsListForMobileShipping(country, locale, address, memberId); if (null == deliveryOptions || !deliveryOptions.Any()) { return(null); } var customShippingModels = deliveryOptions.Select(option => new CustomShippingMethodViewModel { Code = option.FreightCode, Title = option.Description, OrderTypes = "RSO" }).ToList(); return(customShippingModels); } catch (Exception ex) { LoggerHelper.Exception("General", ex, "Failed while getting mobile GetCustomShippingMethods"); return(null); } }
private bool LookupCounties(string state, string city) { bool lookedUp = false; dnlDistrict.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetStreetsForCity(ProductsBase.CountryCode, state, city); if (lookupResults != null && lookupResults.Count > 0) { foreach (var district in lookupResults) { string[] item = district.Split('-'); dnlDistrict.Items.Add(new ListItem(item[1], item[0])); } dnlDistrict.Items.Insert(0, new ListItem(GetLocalResourceObject("Select") as string, string.Empty)); dnlDistrict.SelectedIndex = 0; lookedUp = true; } else { dnlCity.Focus(); } } return(lookedUp); }
private bool LookupPostal(string state, string city, string county) { bool lookedUp = false; dnlPostalCode.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetZipsForCounty(ProductsBase.CountryCode, state, city, county); if (lookupResults != null && lookupResults.Count > 0) { foreach (var zip in lookupResults) { dnlPostalCode.Items.Add(new ListItem(zip)); } if (dnlPostalCode.Items.Count != 1) { dnlPostalCode.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, string.Empty)); dnlPostalCode.SelectedIndex = 0; } lookedUp = true; } else { dnlCounty.Focus(); } } return(lookedUp); }
private void LookupCities(string state, bool autoDefault = false) { if (ShippingProvider != null) { var lookupResults = ShippingProvider.GetCitiesForState(ProductsBase.CountryCode, state); if (lookupResults != null && lookupResults.Count > 0) { foreach (var city in lookupResults) { string[] item = city.Split('-'); ddlCity.Items.Add(new ListItem(item[1], item[0])); } ddlCity.Items.Insert(0, new ListItem(GetLocalResourceObject("Select") as string, string.Empty)); ddlCity.SelectedIndex = (autoDefault && (ddlCity.Items.Count > 0)) ? 1 : 0; if (ddlCity.SelectedIndex > 0) { LookupOther(ddlState.SelectedItem.Value, ddlCity.SelectedItem.Value, autoDefault); } } else { ddlState.Focus(); } } }
/// <summary> /// Get the states from provider. /// </summary> /// <returns>Success flag.</returns> private bool LookupStates() { bool lookedUp = false; dnlState.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetStatesForCountry(ProductsBase.CountryCode); if (lookupResults != null && lookupResults.Count > 0) { var items = (from s in lookupResults select new ListItem { Text = s, Value = s }).ToArray(); dnlState.Items.AddRange(items); dnlState.Items.Insert( 0, new ListItem(GetLocalResourceObject("Select") as string, string.Empty)); dnlState.SelectedIndex = 0; lookedUp = true; } } return(lookedUp); }
private bool LookupProvince() { bool lookedUp = false; dnlProvince.Items.Clear(); dnlSuburb.Items.Clear(); dnlSuburb.Text = string.Empty; dnlPostalCode.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetStatesForCountry(ProductsBase.CountryCode); if (lookupResults != null && lookupResults.Any()) { foreach (var province in lookupResults) { dnlProvince.Items.Add(new ListItem(province)); } dnlProvince.Items.Insert(0, new ListItem(GetLocalResourceObject("Select") as string, string.Empty)); dnlProvince.SelectedIndex = 0; lookedUp = true; } } return(lookedUp); }
private bool LookupZones(string state, string county) { bool lookedUp = false; dnlZone.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider == null) { return(lookedUp); } var lookupResults = provider.GetCountiesForCity(ProductsBase.CountryCode, state, county); if (lookupResults != null && lookupResults.Count > 0) { foreach (var zone in lookupResults) { if (!String.IsNullOrEmpty(zone)) { dnlZone.Items.Add(new ListItem(zone, zone)); } } lookedUp = true; } dnlZone.Items.Insert(0, new ListItem(GetLocalResourceObject("Select") as string, string.Empty)); dnlZone.SelectedIndex = 0; return(lookedUp); }
private bool LookupVillages(string state, string city) { bool lookedUp = false; dnlVillage.Items.Clear(); var provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetCountiesForCity(ProductsBase.CountryCode, state, city); if (lookupResults != null && lookupResults.Count > 0) { foreach (var village in lookupResults) { if (string.IsNullOrWhiteSpace(village)) { continue; } dnlVillage.Items.Add(new ListItem(village, village)); } dnlVillage.Items.Insert(0, new ListItem(GetLocalResourceObject("Select") as string, string.Empty)); dnlVillage.SelectedIndex = 0; lookedUp = true; } } return(lookedUp); }
private bool LookupCity(string state, string county) { IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider == null) { return(false); } string city = provider.GetAddressField(new AddressFieldForCountryRequest_V01() { AddressField = AddressPart.CITY, Country = ProductsBase.CountryCode, State = state, County = county }).FirstOrDefault(); if (city != null) { txtCity.Text = city; return(true); } else { return(false); } }
private bool LookupStates() { bool lookedUp = false; dnlCity.Items.Clear(); dnlSuburb.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetStatesForCountry(ProductsBase.CountryCode); if (lookupResults != null && lookupResults.Count > 0) { //TR compatibility with old and new version of data. lookupResults.Remove("-"); foreach (var city in lookupResults) { dnlCity.Items.Add(new ListItem(city)); } dnlCity.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, string.Empty)); dnlCity.SelectedIndex = 0; lookedUp = true; } } return(lookedUp); }
private bool LookupPostalCodes(string state, string city, string district) { bool lookedUp = false; dnlPostalCode.Items.Clear(); var provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { List <string> lookupResults = provider.GetZipsForStreet(ProductsBase.CountryCode, state, city, district); if (lookupResults != null && lookupResults.Count > 0) { foreach (var street in lookupResults) { dnlPostalCode.Items.Add(new ListItem(street)); } dnlPostalCode.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, string.Empty)); dnlPostalCode.SelectedIndex = 0; lookedUp = true; } } return(lookedUp); }
private bool LookupCities(string postCode) { bool lookedUp = false; dnlCity.Items.Clear(); var provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.LookupCitiesByZip(ProductsBase.CountryCode, txtPostCode.Text); if (null != lookupResults && lookupResults.Count > 0) { for (int i = 0; i < lookupResults.Count; i++) { dnlCity.Items.Insert(i, new ListItem(lookupResults[i].City)); } dnlCity.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, string.Empty)); dnlCity.SelectedIndex = 0; lookedUp = true; } else { txtPostCode.Focus(); } } return(lookedUp); }
private bool AVSAddressValidationCheck(out string errorCode, out ServiceProvider.AddressValidationSvc.Address avsAddress) { errorCode = string.Empty; avsAddress = null; if (ProductsBase.CountryCode.Equals("US")) { IShippingProvider provider = ShippingProvider.GetShippingProvider("US"); if (provider != null) { return(provider.ValidateAddress(_shippingAddr, out errorCode, out avsAddress)); } } else if (ProductsBase.CountryCode.Equals("PR")) { IShippingProvider provider = ShippingProvider.GetShippingProvider("PR"); if (provider != null) { return(provider.ValidateAddress(_shippingAddr, out errorCode, out avsAddress)); } } return(true); }
public int Save(ref AddressViewModel address, string memberId, string locale) { var shippingProvider = ShippingProvider.GetShippingProvider(locale.Substring(3)); if (shippingProvider != null) { //check if the address exist var addressToSave = ModelConverter.ConvertAddressViewModelToShippingAddress(address); if (locale == "zh-CN") { addressToSave.Address.Line3 = string.Empty; addressToSave.Address.Line4 = string.Empty; } var existing = shippingProvider.GetShippingAddressFromAddressGuidOrId(address.CloudId, 0); if (null != existing) { addressToSave.ID = existing.ID; } var shippingAddressId = shippingProvider.SaveShippingAddress(memberId, locale, addressToSave, false, true, false); if (shippingAddressId > 0) { var savedAddress = shippingProvider.GetShippingAddressFromAddressGuidOrId(address.CloudId, 0); address.LastUpdatedDate = savedAddress.Created; address = ModelConverter.ConvertShippingAddressToAddressViewModel(savedAddress); address.CustomShippingMethods = ModelConverter.GetCustomShippingMethods(memberId, savedAddress, locale); } return(shippingAddressId); } return(0); }
public static ShippingInfo_V01 GetShippingInfoFromCart(MyHLShoppingCart cart) { var shipping = new ShippingInfo_V01(); var deliveryInfo = cart.DeliveryInfo; if (deliveryInfo == null) { shipping.FreightVariant = HLConfigManager.Configurations.DOConfiguration.IsChina ? "EXP" : ShippingProvider.GetShippingProvider(cart.CountryCode).GetFreightVariant(null); shipping.ShippingMethodID = HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultFreightCode; shipping.WarehouseCode = HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultWarehouse; } else { shipping.FreightVariant = HLConfigManager.Configurations.DOConfiguration.IsChina ? deliveryInfo.AddressType : deliveryInfo.FreightVariant; shipping.ShippingMethodID = deliveryInfo.FreightCode; shipping.WarehouseCode = deliveryInfo.WarehouseCode; } shipping.Address = addressNotValid(deliveryInfo) ? CreateDefaultAddress() : ObjectMappingHelper.Instance.GetToOrder(deliveryInfo.Address.Address); var provider = ShippingProvider.GetShippingProvider(null); if (provider != null) { provider.GetDistributorShippingInfoForHMS(cart, shipping); } return(shipping); }
private void UninstallShippingProvider(ShippingProvider provider) { string path = HttpContext.Current.Server.MapPath("~/"); DeleteAllDllsFromBin(provider.DllFiles); // DeleteShippingProvider(provider.ShippingProviderID, _userName, _cultureName); }
private bool LookupCities(string state) { bool lookedUp = false; ddlCity.Items.Clear(); IShippingProvider provider = ShippingProvider. GetShippingProvider(_countryCode); if (provider != null) { if (!state.Equals(string.Empty)) { List <string> lookupResults = provider.GetCitiesForState(_countryCode, state); if (null != lookupResults && lookupResults.Count > 0) { for (int i = 0; i < lookupResults.Count; i++) { ddlCity.Items.Insert(i, new ListItem(lookupResults[i])); } ddlCity.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, string.Empty)); ddlCity.SelectedIndex = 0; lookedUp = true; } } } return(lookedUp); }
/// <summary> /// Gets the cities from service. /// </summary> /// <returns>Success flag.</returns> private bool LookupCities(string state) { dnlCity.Items.Clear(); dnlRegion.Items.Clear(); dnlPostalCode.Items.Clear(); var provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { //var lookupResults = provider.GetStreets(ProductsBase.CountryCode, state, district); var lookupResults = provider.GetCitiesForState(ProductsBase.CountryCode, state); if (lookupResults != null && lookupResults.Count > 0) { var items = (from s in lookupResults select new ListItem { Text = s, Value = s }).ToArray(); dnlCity.Items.AddRange(items); dnlCity.Items.Insert(0, new ListItem(GetLocalResourceObject("Select") as string, string.Empty)); dnlCity.SelectedIndex = 0; return(true); } } return(false); }
/// <summary> /// Return a list of shipping methods that use a ShippingProvider that implements /// the GetFilteredRates(Collection<ShippingGroup> g, ShippingMethod m) method. /// </summary> private ListItem[] GetShippingMethods() { List <ListItem> methods = new List <ListItem>(); methods.Add(new ListItem("-n/a-", "")); foreach (ShippingMethod method in ShippingMethod.FindAll()) { if (String.Compare(method.Bvin, ((BVShippingModule)NamingContainer).ShippingMethod.Bvin, true) == 0) { continue; } ShippingProvider provider = AvailableProviders.FindProviderById(method.ShippingProviderId); if (provider == null || !provider.ProviderId.Equals(method.ShippingProviderId, StringComparison.InvariantCultureIgnoreCase)) { continue; } if (hiddenOrderProviders.IsMatch(provider.ProviderId)) { continue; } methods.Add(new ListItem(method.Name, method.Bvin)); } return(methods.ToArray()); }
/// <summary> /// Gets postal codes /// </summary> /// <param name="state"></param> /// <param name="district"></param> /// <param name="city"></param> /// <returns></returns> private bool LookupPostalCodes(string state, string district, string city) { dnlPostalCode.Items.Clear(); var provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetZipCodes(ProductsBase.CountryCode, state, district, city); if (lookupResults != null && lookupResults.Count > 0) { var items = (from s in lookupResults select new ListItem { Text = s, Value = s }).ToArray(); dnlPostalCode.Items.AddRange(items); dnlPostalCode.SelectedIndex = 0; if (dnlPostalCode.Items.Count == 1) { dnlPostalCode.SelectedIndex = 0; } else { dnlPostalCode.Items.Insert(0, new ListItem(GetLocalResourceObject("Select") as string, string.Empty)); dnlPostalCode.SelectedIndex = 0; } return(true); } } return(false); }
private bool LookupAddress(string Zipcode) { if (!string.IsNullOrEmpty(Zipcode)) { IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var Address = ShippingProvider_JP.GetAddressByPostalCode(ProductsBase.CountryCode, Zipcode); if (Address != null && Address.AddressDetails != null && Address.AddressDetails.Count > 0) { string CityTown = Address.AddressDetails[0].City.ToString(); List <string> words = Regex.Split(CityTown, @"\W+").ToList(); txtCity.Text = words[0].ToString(); if (words.Count > 1) { txtTown.Text = words[1].ToString(); txtStreet.Text = Address.AddressDetails[0].Street.ToString(); } else { txtTown.Text = Address.AddressDetails[0].Street.ToString(); } txtPrefecture.Text = Address.AddressDetails[0].State.ToString(); return(true); } else { return(false); } } } return(false); }
/// <scess flag.ummary> /// Gets the localities for a city from service. /// </summary> /// <param name="city">City name.</param> /// <returns>Succes flag.</returns> private bool LookupLocalities(string city) { bool lookedUp = false; dnlLocality.Items.Clear(); dnlStreetType.Items.Clear(); dnlStreet.Items.Clear(); dnlStreet.Text = string.Empty; dnlPostCode.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { // We use the city field from service to store the locality info var lookupResults = provider.GetCitiesForState(ProductsBase.CountryCode, city); if (lookupResults != null && lookupResults.Count > 0) { foreach (var locality in lookupResults) { dnlLocality.Items.Add(new ListItem(locality)); } dnlLocality.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, string.Empty)); dnlLocality.SelectedIndex = 0; lookedUp = true; } else { dnlCity.Focus(); } } return(lookedUp); }
/* * private bool LookupProvince(string zipCode) * { * bool lookedUp = false; * dnlState.Items.Clear(); * if (!string.IsNullOrEmpty(zipCode)) * { * IShippingProvider provider = ShippingProvider.GetShippingProvider( * ProductsBase.CountryCode); * if (provider != null) * { * var lookupResults = provider.LookupCitiesByZip(ProductsBase.CountryCode, zipCode); * if (lookupResults != null && lookupResults.Count > 0) * { * foreach (var province in lookupResults) * { * string[] state = province.State.Split('-'); * dnlState.Items.Add(new ListItem(state[0], state[1])); * } * * if (lookupResults.Count > 1) * { * dnlState.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, "0")); * } * dnlState.SelectedIndex = 0; * lookedUp = true; * } * } * } * return lookedUp; * } */ /* protected void txtPostCode_TextChanged(object sender, EventArgs e) * { * dnlState.Items.Clear(); * if (!string.IsNullOrEmpty(dnlPostCode.SelectedItem.Text)) * { * LookupProvince(txtPostCode.Text); * } * }*/ private bool LookupStates() { bool lookedUp = false; dnlState.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetStatesForCountry(ProductsBase.CountryCode); if (lookupResults != null && lookupResults.Count > 0) { foreach (var province in lookupResults) { string[] state = province.Split('-'); dnlState.Items.Add(new ListItem(state[0], state[1])); //dnlState.Items.Add(new ListItem(province)); } dnlState.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, string.Empty)); dnlState.SelectedIndex = 0; lookedUp = true; } } return(lookedUp); }
private bool LookupCities(String zipCode) { bool lookedUp = false; dnlCity.Items.Clear(); var provider = ShippingProvider.GetShippingProvider(_countryCode); if (provider != null) { var lookupResults = provider.LookupCitiesByZip(_countryCode, zipCode); if (null != lookupResults && lookupResults.Count > 0) { for (int i = 0; i < lookupResults.Count; i++) { dnlCity.Items.Insert(i, new ListItem(lookupResults[i].City)); } dnlCity.Items.Insert(0, new ListItem(string.Empty, string.Empty)); dnlCity.SelectedIndex = 0; lookedUp = true; } else { txtPostCode.Focus(); //blErrors.Items.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidZipCode")); } } return(lookedUp); }
private bool LookupState(string zipCode) { dnlState.Items.Clear(); if (!string.IsNullOrEmpty(zipCode) && zipCode.Trim().Length > 3) { IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.LookupCitiesByZip(ProductsBase.CountryCode, zipCode.Substring(0, 3)); if (lookupResults != null && lookupResults.Count > 0) { var items = (from s in lookupResults select new ListItem { Text = s.State, Value = s.State }).ToArray(); this.dnlState.Items.AddRange(items); if (lookupResults.Count > 1) { this.dnlState.Items.Insert(0, new ListItem(this.GetLocalResourceObject("Select") as string, string.Empty)); this.dnlState.SelectedIndex = 0; dnlState.Focus(); } else { txtArea.Focus(); } this.dnlState.SelectedIndex = 0; return(true); } } } return(false); }
private bool LookupCountySuburb(string state, string city) { bool lookedUp = false; dnlCounty.Items.Clear(); var provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetCountiesForCity(ProductsBase.CountryCode, state, city); if (lookupResults != null && lookupResults.Count > 0) { lookupResults.ForEach(x => dnlCounty.Items.Add(new ListItem(x))); dnlCounty.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, string.Empty)); dnlCounty.SelectedIndex = 0; lookedUp = true; } else { dnlCity.Focus(); } } return(lookedUp); }
/// <summary> /// Gets the cities from service. /// </summary> /// <returns>Success flag.</returns> private bool LookupCities() { dnlCity.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { // For Serbia, state code is same as country code in db var lookupResults = provider.GetCitiesForState(ProductsBase.CountryCode, ProductsBase.CountryCode); if (lookupResults != null && lookupResults.Count > 0) { foreach (var cityZip in lookupResults) { // value is postal code, text is city name dnlCity.Items.Add(new RadComboBoxItem(cityZip.Split(',')[1], cityZip.Split(',')[0])); } dnlCity.Items.Insert(0, new RadComboBoxItem(GetLocalResourceObject("Select") as string, string.Empty)); dnlCity.SelectedIndex = 0; return(true); } } return(false); }
private ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason, ShoppingCartRuleResult result) { if (reason == ShoppingCartRuleReason.CartItemsAdded || reason == ShoppingCartRuleReason.CartItemsRemoved || reason == ShoppingCartRuleReason.CartCalculated || reason == ShoppingCartRuleReason.CartCreated || reason == ShoppingCartRuleReason.CartWarehouseCodeChanged || reason == ShoppingCartRuleReason.CartFreightCodeChanging) { if (cart != null) { var myHLCart = cart as MyHLShoppingCart; if (myHLCart != null && myHLCart.DeliveryInfo.Option == ServiceProvider.ShippingSvc.DeliveryOptionType.Shipping) { var shippingProvider = ShippingProvider.GetShippingProvider(Country); //get URB locales GetFreightCodeAndWarehouseFromService var FCandWH = shippingProvider.GetFreightCodeAndWarehouse(myHLCart.DeliveryInfo.Address); if (FCandWH != null && FCandWH[0] == "URB") { //User Story 229708 //a.Orders under 500.9999 VP = Remains as URB freight code if (myHLCart.VolumeInCart < URBVP) { myHLCart.DeliveryInfo.FreightCode = myHLCart.FreightCode = "URB"; } //b.Order above 501.0000 VP = System should be redirected and calculate PMS freight code instead of URB. else if ((myHLCart.VolumeInCart >= URBVP)) { myHLCart.DeliveryInfo.FreightCode = myHLCart.FreightCode = "PMS"; } } } } } return(result); }
private bool LookupCities() { bool lookedUp = false; dnlCity.Items.Clear(); IShippingProvider provider = ShippingProvider.GetShippingProvider(ProductsBase.CountryCode); if (provider != null) { var lookupResults = provider.GetCitiesForState( ProductsBase.CountryCode, ProductsBase.CountryCode); if (lookupResults != null && lookupResults.Count > 0) { foreach (var city in lookupResults) { dnlCity.Items.Add(new ListItem(city)); } dnlCity.Items.Insert( 0, new ListItem(GetLocalResourceObject("Select") as string, string.Empty)); dnlCity.SelectedIndex = 0; lookedUp = true; } } return(lookedUp); }
public List <AddressViewModel> Get(GetAddressRequestViewModel request) { var shippingProvider = ShippingProvider.GetShippingProvider(request.Locale.Substring(3)); var result = new List <AddressViewModel>(); if (shippingProvider != null) { var shippingAddresses = shippingProvider.GetShippingAddresses(request.MemberId, request.Locale); //filter the addresses if (request.From != null) { shippingAddresses = shippingAddresses.Where(x => x.Created >= request.From).ToList(); } if (request.To != null) { shippingAddresses = shippingAddresses.Where(x => x.Created <= request.To).ToList(); } if (shippingAddresses != null && shippingAddresses.Any()) { result.AddRange( shippingAddresses.Select( a => ModelConverter.ConvertAddressToViewModel(a, false, request.MemberId, request.Locale))); } } return(result); }