public static CityZipValidationResult ToCityZipValidationResult(this XElement element, string endPointUri) { var cityZipValidationResult = new CityZipValidationResult(); XNamespace ns = element.GetDefaultNamespace(); cityZipValidationResult.ErrorsOccurred = Convert.ToBoolean(element.Element(ns + "ErrorsOccurred").Value); cityZipValidationResult.CityFound = Convert.ToBoolean(element.Element(ns + "CityFound").Value); cityZipValidationResult.CityInState = Convert.ToBoolean(element.Element(ns + "CityInState").Value); cityZipValidationResult.ZipCodeFound = Convert.ToBoolean(element.Element(ns + "ZipCodeFound").Value); cityZipValidationResult.CityProvidedMatchesCityFound = Convert.ToBoolean(element.Element(ns + "CityProvidedMatchesCityFound").Value); cityZipValidationResult.CityName = element.Element(ns + "CityName").Value; cityZipValidationResult.Message = element.Element(ns + "Message").Value; cityZipValidationResult.EndpointUri = endPointUri; return(cityZipValidationResult); }
public virtual CityZipValidationResult VerifyCityByZip(string city, string state, string zip) { string endpointUri = ""; CityZipValidationResult result = new CityZipValidationResult { CityFound = false, ErrorsOccurred = true, ZipCodeFound = false }; try { endpointUri = BuildVerifyCityByZipEndpointUri(city, state, zip); XElement xml = GetXml(endpointUri); result = xml.ToCityZipValidationResult(endpointUri); } catch (Exception ex) { using (ICERSRepositoryManager repo = ServiceLocator.GetRepositoryManager()) { ICERSSystemServiceManager services = ServiceLocator.GetSystemServiceManager(repo); services.ErrorReporting.Report(StandardizedAddressErrorMessage("AddressServiceProxy::VerifyCityByZip", endpointUri, ex), ex); } } return(result); }