示例#1
0
        public GeoResultDTO GetLocation(GeoDTO geoDTO)
        {
            string errorString;
            var    result = this.GeoModel.GetLocation(geoDTO, out errorString);

            if (result != null)
            {
                return(result);
            }

            if (!string.IsNullOrWhiteSpace(geoDTO.country))
            {
                result = this.GeoModel.GetLocation(new GeoDTO {
                    country = geoDTO.country
                }, out errorString);
            }

            if (result == null)
            {
                var error = new Error(Errors.CODE_ERRORTYPE_GENERIC_ERROR, "Location Server Error", errorString);
                this.LogError("Lookup.GetLocation", error);
                throw new FaultException <Error>(error, error.errorMessage);
            }

            return(result);
        }
示例#2
0
        /// <summary>
        /// The get nominatim result.
        /// </summary>
        /// <param name="geoDTO">
        /// The geo dto.
        /// </param>
        /// <param name="error">
        /// The error.
        /// </param>
        /// <returns>
        /// The <see cref="GeoResultDTO"/>.
        /// </returns>
        public GeoResultDTO GetLocation(GeoDTO geoDTO, out string error)
        {
            GeoResultDTO result = null;

            error = null;
            NameValueCollection geoNameValue = geoDTO.GetNameValueCollection();

            if (geoNameValue != null)
            {
                result = this.ParseNominatimResult(geoNameValue, out error);
            }

            return(result);
        }