public DictionaryListViewModel(string tableName, IEnumerable <ColumnViewModel> columnView) { _columnView = columnView; using (var service = ServiceClientProvider.GetDictionary()) { _tableName = tableName; var response = service.GetDictionary(_tableName, columnView.Select(x => x.DbName)); var rows = new List <EntityViewModel>(); foreach (var iRow in response) { var cells = new List <CellViewModel>(); var name = string.Empty; foreach (var iColumn in columnView) { var value = iRow.Cells.First(x => x.Key == iColumn.DbName).Value; if (iColumn.DbName == "Name") { name = value; } var cell = new CellViewModel() { ColumnName = iColumn.DbName, Name = iColumn.Name, Value = value }; cells.Add(cell); } int id = int.Parse(iRow.Cells.First(x => x.Key == "Id").Value); var entity = new EntityViewModel(name, cells, id); rows.Add(entity); } Rows = new ObservableCollection <EntityViewModel>(rows); } }
public override int SavePickupLocation(InsertCourierLookupRequest_V01 request) { var retValue = 0; if (request != null || request.CourierStoreNumber > 0 || !string.IsNullOrEmpty(request.CountryCode)) { try { // Call the Shipping service to Insert a new Pickup location var service = ServiceClientProvider.GetShippingServiceProxy(); var response = service.InsertCourierLookup(new InsertCourierLookupRequest1(request)).InsertCourierLookupResult as InsertCourierLookupResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { return(response.ID); } } catch (Exception ex) { LoggerHelper.Error(string.Format("SavePickupLocation error: Country {0}, CourierStoreNumber {1}, error: {2}", request.CountryCode, request.CourierStoreNumber, ex.ToString())); } } return(retValue); }
// ********************************************************************************************** private static List <CardInstallment> LoadInstallmentsConfigurationInfoFromService(string CountryCode, DateTime applicationDate) { if (string.IsNullOrEmpty(CountryCode)) { return(null); } var proxy = ServiceClientProvider.GetOrderServiceProxy(); var response = (RetrieveCardInstallmentsConfigurationResponse_V01) proxy.RetrieveCardInstallmentsConfiguration(new RetrieveCardInstallmentsConfigurationRequest1(new RetrieveCardInstallmentsConfigurationRequest_V01 { CountryCode = CountryCode, ApplicationDate = applicationDate })).RetrieveCardInstallmentsConfigurationResult; if (response != null && response.Status == ServiceResponseStatusType.Success && response.Installments != null) { return(response.Installments); } return(null); }
/// <summary> /// Updates Alert on CustomerExtention table /// </summary> /// <remarks>Used only for China DO System</remarks> /// <param name="distributorId">The distributor identifier.</param> public static bool UpdateAlertCustomerExtention(string distributorId) { var result = false; var proxy = ServiceClientProvider.GetDistributorServiceProxy(); try { var request = new UpdateAlertCustomerExtentionRequest_V01 { DistributorId = distributorId, }; var response = proxy.UpdateAlertCustomerExtention(new UpdateAlertCustomerExtentionRequest1(request)).UpdateAlertCustomerExtentionResult; if (response != null && response.Status == ServiceResponseStatusType.Success) { result = true; } } catch (Exception ex) { ExceptionPolicy.HandleException( new Exception(string.Format("Error in DistributorProvider.UpdateAlertCustomerExtention, for DS id: {0}; error msg: {1}", distributorId, ex)), ProviderPolicies.SYSTEM_EXCEPTION); } finally { ServiceClientFactory.Dispose(proxy); } return(result); }
/// <summary> /// GetSKULimitationInfo /// </summary> /// <returns></returns> public static Dictionary <string, List <SKULimitationInfo> > GetSKULimitationInfo() { string cacheKey = "SKULIMITATION"; var limits = HttpRuntime.Cache[cacheKey] as Dictionary <string, List <SKULimitationInfo> >; if (limits == null) { using (var proxy = ServiceClientProvider.GetOrderServiceProxy()) { try { var rspSKU = proxy.GetSKULimitation(new GetSKULimitationRequest1(new GetSKULimitationRequest())).GetSKULimitationResult as GetSKULimitationResponse; if (rspSKU != null && rspSKU.SKULimitationInfoDict != null) { limits = rspSKU.SKULimitationInfoDict; HttpRuntime.Cache.Insert(cacheKey, rspSKU.SKULimitationInfoDict, null, DateTime.Now.AddMinutes(60 * 24), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null); } } catch (Exception ex) { HL.Common.Utilities.WebUtilities.LogServiceExceptionWithContext(ex, proxy); LoggerHelper.Error(string.Format("GetSKULimitationInfo error, {0}", ex.ToString())); } } } return(limits); }
public static List <FavouriteSKU> LoadFromService(string distributorID, string locale) { List <FavouriteSKU> SKUs = new List <FavouriteSKU>(); GetDistributorFavouriteSKURequest request = new GetDistributorFavouriteSKURequest() { DistributorID = distributorID, Locale = locale }; if (string.IsNullOrEmpty(request.DistributorID)) { return(SKUs); } else { try { var proxy = ServiceClientProvider.GetDistributorServiceProxy(); var response = proxy.GetDistributorFavouriteSKUs(new GetDistributorFavouriteSKUsRequest(request)).GetDistributorFavouriteSKUsResult as GetDistributorFavouriteSKUResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { SKUs = response.FavouriteSKUs; } } catch (Exception ex) { ExceptionPolicy.HandleException(ex, ProviderPolicies.SYSTEM_EXCEPTION); } } return(SKUs); }
public static void GetHAPSettings(DistributorOrderingProfile distributor) { if (!distributor.HAPExpiryDateSpecified || distributor.HAPExpiryDate == null) { using (var proxy = ServiceClientProvider.GetDistributorServiceProxy()) { try { var response = proxy.GetBasicDistributor(new GetBasicDistributorRequest( new GetBasicDistributorRequest_V01() { DistributorID = distributor.Id, CountryCode = distributor.CurrentLoggedInCountry, RequiresTin = false })).GetBasicDistributorResult as GetBasicDistributorResponse_V01; if (response.Status == ServiceResponseStatusType.Success && response.Distributor != null) { distributor.HAPExpiryDateSpecified = response.Distributor.HAPExpiryDateFieldSpecified; distributor.HAPExpiryDate = response.Distributor.HAPExpiryDateField; } } catch (Exception ex) { LoggerHelper.Warn( string.Format("MyHerbalife3.Ordering.Providers.DistributorOrderingProfileProvider.GetHAPSettings - distributorId: {0} - country: {1} - Exception: {2}", distributor.Id, distributor.CurrentLoggedInCountry, ex.Message)); } } } }
public static List <Contact_V02> GetContactsByName(string distributorID, string partialName) { using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { var request = new ListContactsByNameRequest_V01(); request.Name = partialName; request.DistributorID = distributorID; try { var response = proxy.ListContactsByName(new ListContactsByNameRequest(request)).ListContactsByNameResult as ListContactsByNameResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { return(response.Contacts); } else { return(null); } } catch (Exception ex) { Log(ex, proxy); return(null); } } }
public static Contact_V01 GetContactDetail(int contactID, out List <int> assignedLists) { var request = new GetContactRequest_V01 { ContactID = contactID }; using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { try { var response = proxy.GetContact(new GetContactRequest1(request)).GetContactResult as GetContactResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { assignedLists = response.Lists; return(response.Contact as Contact_V01); } else { assignedLists = null; return(null); } } catch (Exception ex) { Log(ex, proxy); assignedLists = null; return(null); } } }
/// <summary> /// Saves the appointment. /// </summary> /// <param name="distributorID">The distributor ID.</param> /// <param name="appointment">The appointment.</param> /// <param name="isNew">if set to <c>true</c> [is new].</param> /// <param name="saveDatesOnly">if set to <c>true</c> [save dates only].</param> /// <param name="bWantEntireResult">if set to true return the entire repsonse</param> /// <returns></returns> public static SaveAppointmentResponse_V01 SaveAppointment(string distributorID, Appointment_V01 appointment, bool isNew, bool saveDatesOnly, bool bWantEntireResult) { using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { try { SaveAppointmentRequest_V01 request01 = new SaveAppointmentRequest_V01() { DistributorID = distributorID, Appointment = appointment, IsNew = isNew, UpdateDatesOnly = saveDatesOnly }; SaveAppointmentResponse_V01 responseV01 = proxy.SaveAppointment(new SaveAppointmentRequest1(request01)).SaveAppointmentResult as SaveAppointmentResponse_V01; //todo: validate response, handle errors. return(responseV01); } catch (Exception ex) { Log(ex, proxy); throw ex; } } }
public static int?GetContactIDByContactDistributorID(string distributorID, string contactDistributorID) { using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { var request = new GetContactByContactDistributorIDRequest_V01(); request.ContactDistributorID = contactDistributorID; request.DistributorID = distributorID; try { var response = proxy.GetContactByContactDistributorID(new GetContactByContactDistributorIDRequest(request)).GetContactByContactDistributorIDResult as GetContactByContactDistributorIDResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { return(response.ContactID); } else { throw new Exception("GetContactByContactDistributorIDResponse status is failure."); } } catch (Exception ex) { Log(ex, proxy); return(null); } } }
public static List <Task_V01> ListTasks(string distributorID) { using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { try { ListTasksRequest_V01 requestV01 = new ListTasksRequest_V01 { DistributorID = distributorID, }; ListTasksResponse_V01 responseV01 = proxy.ListTasks(new ListTasksRequest1(requestV01)).ListTasksResult as ListTasksResponse_V01; //todo: add exception/error handling SortByDueDate(responseV01.Tasks); return(responseV01.Tasks); } catch (Exception ex) { Log(ex, proxy); throw ex; } } }
/// <summary> /// Saves the calendar settings. /// </summary> /// <param name="distributorID">The distributor ID.</param> /// <param name="settings">The settings.</param> /// <param name="isNew">if set to <c>true</c> [is new].</param> /// <returns></returns> public static int SaveCalendarSettings(string distributorID, CalendarSettings_V01 settings, bool isNew) { using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { try { SaveCalendarSettingsRequest_V01 request01 = new SaveCalendarSettingsRequest_V01() { DistributorID = distributorID, CalendarSettings = settings, IsNew = isNew }; SaveCalendarSettingsResponse_V01 response01 = proxy.SaveCalendarSettings(new SaveCalendarSettingsRequest1(request01)).SaveCalendarSettingsResult as SaveCalendarSettingsResponse_V01; return(response01.CalendarSettingsID); } catch (Exception ex) { Log(ex, proxy); throw ex; } } }
/// <summary> /// Deletes the appointments by ID. /// </summary> /// <param name="appointmentIDs">The appointment I ds.</param> /// <returns></returns> public static bool DeleteAppointmentsByID(int[] appointmentIDs) { using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { try { var iList = new List <int>(); iList.AddRange(appointmentIDs); DeleteAppointmentsByIDRequest_V01 request01 = new DeleteAppointmentsByIDRequest_V01() { AppointmentIDs = iList }; DeleteAppointmentsByIDResponse_V01 responseV01 = proxy.DeleteAppointments(new DeleteAppointmentsRequest1(request01)).DeleteAppointmentsResult as DeleteAppointmentsByIDResponse_V01; return(responseV01.Status == ServiceResponseStatusType.Success); } catch (Exception ex) { Log(ex, proxy); throw ex; } } }
public override List <DeliveryOption> GetDeliveryOptionsListForShipping(string Country, string locale, ShippingAddress_V01 address) { var deliveryOptions = HttpRuntime.Cache[ShippingOptionsCacheKey] as List <DeliveryOption>; if (deliveryOptions == null || deliveryOptions.Count == 0) { if (deliveryOptions == null) { deliveryOptions = new List <DeliveryOption>(); } var proxy = ServiceClientProvider.GetShippingServiceProxy(); var request = new DeliveryOptionForCountryRequest_V01 { Country = Country, State = "*", Locale = locale }; var response = proxy.GetDeliveryOptions(new GetDeliveryOptionsRequest(request)).GetDeliveryOptionsResult as ShippingAlternativesResponse_V01; if (response != null && response.DeliveryAlternatives != null) { deliveryOptions.AddRange(response.DeliveryAlternatives.Select(option => new DeliveryOption(option))); } if (deliveryOptions.Any()) { HttpRuntime.Cache.Insert(ShippingOptionsCacheKey, deliveryOptions, null, DateTime.Now.AddMinutes(ShippingOptionsCacheMinutes), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null); } } return(deliveryOptions); }
public static Contact_V01 SaveContact(Contact_V01 contact, string distributorID) { ExpireAllContacts(distributorID); var request = new SaveContactRequest_V01 { Contact = contact, DistributorID = distributorID, IsImport = false }; using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { try { var response = proxy.SaveContact(new SaveContactRequest1(request)).SaveContactResult as SaveContactResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { return(response.Contact as Contact_V01); } return(null); } catch (Exception ex) { Log(ex, proxy); return(null); } } }
private static void SaveMobileQuoteResponse(QuoteResponseViewModel model, int shoppingCartId) { CatalogInterfaceClient proxy = null; using (proxy = ServiceClientProvider.GetCatalogServiceProxy()) { try { var request = new InsertMobileOrderDetailRequest_V01(); MobileOrderDetail mobileOrderDetail = MobileOrderProvider.ModelConverter.ConvertOrderViewModelToMobileOrderDetail(model.Order, shoppingCartId); mobileOrderDetail.AddressId = model.Order.Shipping != null && model.Order.Shipping.Address != null ? model.Order.Shipping.Address.CloudId : Guid.Empty; mobileOrderDetail.CustomerId = model.Order.CustomerId; mobileOrderDetail.OrderStatus = "Quoted"; request.MobileOrderDetail = mobileOrderDetail; InsertMobileOrderDetailResponse response = proxy.InsertMobileOrderDetail(new InsertMobileOrderDetailRequest1(request)).InsertMobileOrderDetailResult; // Check response for error. if (response == null || response.Status != ServiceResponseStatusType.Success) { LoggerHelper.Error(string.Format("SaveMobileQuoteResponse error Order: {0} Message: {1}", model.Order.OrderNumber, response)); } } catch (Exception ex) { LoggerHelper.Error(string.Format("SaveMobileQuoteResponse Exception Order: {0} Message: {1}", model.Order.OrderNumber, ex)); } } }
public static bool DeleteContacts(string distributorID, List <int> contactIDs) { ExpireAllContacts(distributorID); var request = new DeleteContactsByIDRequest_V01 { ContactIDs = contactIDs, DistributorID = distributorID }; using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { try { var response = proxy.DeleteContactsByID(new DeleteContactsByIDRequest(request)); if (response.DeleteContactsByIDResult != null && response.DeleteContactsByIDResult.Status == ServiceResponseStatusType.Success) { return(true); } } catch (Exception ex) { Log(ex, proxy); return(false); } } return(false); }
public static GetBasicDistributorResponse_V01 GetDistributorProfileforEmail(string distributorID, string countryCode) { var response = new GetBasicDistributorResponse_V01(); using (var proxy = ServiceClientProvider.GetDistributorServiceProxy()) { try { response = proxy.GetBasicDistributor(new GetBasicDistributorRequest( new GetBasicDistributorRequest_V01() { DistributorID = distributorID, CountryCode = countryCode, RequiresTin = false })).GetBasicDistributorResult as GetBasicDistributorResponse_V01; if (response.Status == ServiceResponseStatusType.Success && response.Distributor != null) { } } catch (Exception ex) { LoggerHelper.Warn( string.Format("MyHerbalife3.Ordering.Providers.DistributorOrderingProfileProvider - distributorId: {0} - country: {1} - Exception: {2}", distributorID, countryCode, ex.Message)); } } return(response); }
public static List <Contact_V03> GetDistributorByFilter(string distributorID, ContactFilter_V01 contactFilterV01) { var request = new ListContactsByFilterRequest_V01 { ContactFilter = contactFilterV01, DistributorID = distributorID }; using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { try { var response = proxy.ListDistributorByFilter(new ListDistributorByFilterRequest(request)).ListDistributorByFilterResult as ListContactsByOwnerResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { return(response.Contacts); } } catch (Exception ex) { Log(ex, proxy); return(new List <Contact_V03>()); } } return(new List <Contact_V03>()); }
public static Scheme CheckDsLevelType(string distributorID, string countryCode) { //string DsLevel =new LevelGroupType(); //List<DistributorTraining_V01> trainings = new List<DistributorTraining_V01>(); using (var proxy = ServiceClientProvider.GetDistributorServiceProxy()) { try { var response = proxy.GetBasicDistributor(new GetBasicDistributorRequest( new GetBasicDistributorRequest_V01() { DistributorID = distributorID, CountryCode = countryCode, RequiresTin = false })).GetBasicDistributorResult as GetBasicDistributorResponse_V01; if (response.Status == ServiceResponseStatusType.Success && response.Distributor != null) { return(response.Distributor.Scheme); } } catch (Exception ex) { LoggerHelper.Warn( string.Format("MyHerbalife3.Ordering.Providers.DistributorOrderingProfileProvider - distributorId: {0} - Exception: {1}", distributorID, ex.Message)); } } return(Scheme.Distributor); }
public static List <string> AddDistributorsToContacts(string distributorID, List <string> distributorIDs, int importMode) { ExpireAllContacts(distributorID); using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { var request = new AddDistributorsToContactsRequest_V01(); request.DistributorID = distributorID; request.DistributorIDs = distributorIDs; request.ImportMode = importMode; try { var response = proxy.AddDistributorsToContacts(new AddDistributorsToContactsRequest1(request)).AddDistributorsToContactsResult as AddDistributorsToContactsResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { return(response.MissingDistributors); } else { return(null); } } catch (Exception ex) { Log(ex, proxy); return(null); } } }
protected override void GetOrderNumber() { // find a few items stuck in HPS MSMQ that NL DS 28Y0005736 has a space at the end "28Y0005736 " so HPS thrown exception and won't call RBS for IDEAL URL _distributorId = _distributorId.Trim(); var proxy = ServiceClientProvider.GetOrderServiceProxy(); GenerateOrderNumberRequest_V01 request = new GenerateOrderNumberRequest_V01(); request.Amount = _orderAmount; request.ClientName = ClientName; request.Country = _country; request.Currency = _currency; request.DistributorID = _distributorId; request.GenerateHPSID = true; request.PayCode = ("IDEAL-SSL.CreditCard".Contains(_paymentMethod)) ? "BW" : _paymentMethod; request.MerchantCode = _config.MerchantAccountName; GenerateOrderNumberResponse_V01 response = OrderProvider.GenerateOrderNumber(request) as GenerateOrderNumberResponse_V01; if (null != response) { _orderNumber = response.OrderID; _url = response.RedirectUrl; _orderNumber = response.OrderID; string orderData = _context.Session[PaymentGateWayOrder] as string; _context.Session.Remove(PaymentGateWayOrder); int recordId = OrderProvider.InsertPaymentGatewayRecord(_orderNumber, _distributorId, _gatewayName, orderData, _locale); } }
public static int?AddContactsToList(string distributorID, ContactListInfo_V01 list, List <int> contacts) { ExpireAllContacts(distributorID); using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { var request = new AddContactsToListRequest_V01(); request.DistributorID = distributorID; request.ContactIDs = contacts; request.List = list; try { var response = proxy.AddContactsToList(new AddContactsToListRequest1(request)).AddContactsToListResult as AddContactsToListResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { return(response.ListID); } else { return(null); } } catch (Exception ex) { Log(ex, proxy); return(null); } } }
/// <summary> /// JP only : SKU limits /// </summary> /// <param name="distributorID"></param> /// <param name="orderMonth"></param> /// <returns></returns> public static List <PurchaseRestrictionInfo> SKUPurchaseRestrictionInfo(string distributorID, string orderMonth) { string cacheKey = string.Format("JPLIMITS_{0}_{1}", distributorID, orderMonth); var limits = HttpContext.Current.Session[cacheKey] as List <PurchaseRestrictionInfo>; if (limits != null) { return(limits); } using (var proxy = ServiceClientProvider.GetOrderServiceProxy()) { try { var rspSKU = proxy.SKUPurchaseRestriction(new SKUPurchaseRestrictionRequest1(new SKUPurchaseRestrictionRequest_V01 { DistributorID = distributorID, OrderMonth = orderMonth })).SKUPurchaseRestrictionResult as SKUPurchaseRestrictionResponse_V01; if (rspSKU != null && rspSKU.PurchaseRestriction != null) { limits = rspSKU.PurchaseRestriction; HttpContext.Current.Session[cacheKey] = limits; } } catch (Exception ex) { HL.Common.Utilities.WebUtilities.LogServiceExceptionWithContext(ex, proxy); LoggerHelper.Error(string.Format("SKUPurchaseRestrictionInfo error, {0}", ex.ToString())); } } return(limits); }
public static bool DeleteContactList(string distributorID, int contactListID) { ExpireAllContacts(distributorID); // TODO: verify distributor ID is owner? var request = new DeleteContactListRequest_V01 { ContactListID = contactListID }; using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy()) { try { var response = proxy.DeleteContactList(new DeleteContactListRequest1(request)); if (response.DeleteContactListResult != null && response.DeleteContactListResult.Status == ServiceResponseStatusType.Success) { return(true); } else { return(false); } } catch (Exception ex) { Log(ex, proxy); return(false); } } }
public override bool UpdatePrimaryPickupLocationPreference(int pickupLocationId) { if (pickupLocationId == 0) { return(false); } var proxy = ServiceClientProvider.GetShippingServiceProxy(); try { ; var response = proxy.UpdatePickupLocationPreferences(new UpdatePickupLocationPreferencesRequest1( new UpdatePickupLocationPreferencesRequest_V01() { ID = pickupLocationId })).UpdatePickupLocationPreferencesResult as UpdatePickupLocationPreferencesResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { return(pickupLocationId == response.ID); } } catch (Exception ex) { LoggerHelper.Error( string.Format("UpdatePrimaryPickupLocationPreference error: Country: TH, error: {0}", ex.Message)); return(false); } return(true); }
public static List <Contact_V02> GetContactsByContactListIDs(string distributorID, List <int> contactListIDs) { using (var bwService = ServiceClientProvider.GetDistributorCRMServiceProxy()) { var request = new ListContactsByListIDsRequest_V01(); request.DistributorID = distributorID; request.ContactListIDs = contactListIDs; try { var response = bwService.ListContactsByContactListIDs(new ListContactsByContactListIDsRequest(request)).ListContactsByContactListIDsResult as ListContactsByListIDsResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { return(response.Contacts); } else { return(null); } } catch (Exception ex) { Log(ex, bwService); return(null); } } }
public override List <DeliveryOption> GetDeliveryOptionsListForShipping(string Country, string locale, MyHerbalife3.Ordering.ServiceProvider.ShippingSvc.ShippingAddress_V01 address) { if (locale.Equals("en-MX")) { base.GetDeliveryOptionsListForShipping(Country, locale, address); } List <DeliveryOption> deliveryOptions = new List <DeliveryOption>(); var proxy = ServiceClientProvider.GetMexicoShippingServiceProxy(); //Look if there is a postal code provided: if (!string.IsNullOrEmpty(address.Address.PostalCode)) { var shippingAlternativesResponse = proxy.GetShippingAlternativesForPostalCode(new ServiceProvider.ShippingMexicoSvc.GetShippingAlternativesForPostalCodeRequest(new ShippingAlternativesForPostalCodeRequest_V01() { PostalCode = address.Address.PostalCode })).GetShippingAlternativesForPostalCodeResult as MyHerbalife3.Ordering.ServiceProvider.ShippingMexicoSvc.ShippingAlternativesResponse_V01; if (shippingAlternativesResponse != null && shippingAlternativesResponse.DeliveryAlternatives != null) { deliveryOptions.AddRange(from so in shippingAlternativesResponse.DeliveryAlternatives where !so.ShippingSource.Status.ToUpper().Equals("NOGDO") && !so.ShippingSource.Status.ToUpper().Equals("NODISPONIBLE") select new DeliveryOption(ObjectMappingHelper.Instance.GetToShipping(so))); } } return(deliveryOptions); }
/// <summary> /// Gets a list of street types for a locality. /// </summary> /// <param name="country">Country code.</param> /// <param name="city">City name.</param> /// <param name="locality">Locality name.</param> /// <returns>List of street types.</returns> public List <string> GetStreetTypeForCity(string country, string city, string locality) { try { var proxy = ServiceClientProvider.GetShippingServiceProxy(); StreetsForCityRequest_V01 request = new StreetsForCityRequest_V01(); request.Country = country; request.State = city; request.City = locality; StreetsForCityResponse_V01 response = proxy.GetStreetsForCity(new GetStreetsForCityRequest(request)).GetStreetsForCityResult as StreetsForCityResponse_V01; List <string> streetTypes = new List <string>(); foreach (var street in response.Streets) { var info = street.Split('|'); if (info.Length == 2 && !streetTypes.Contains(info[0])) { streetTypes.Add(info[0]); } } return(streetTypes); } catch (Exception ex) { LoggerHelper.Error(string.Format("GetStreetTypeForCity error: Country {0}, error: {1}", country, ex.ToString())); } return(null); }