public static void Main()
        {
            const int ecadId = 1200003223;
            var autoaddressClient = new AutoaddressClient();
            var request = new Request(ecadId);

            var response = autoaddressClient.GetEcadData(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.EcadId = {0}", response.EcadId);
            Console.WriteLine("response.PostalAddress.English = {0}", string.Join(",", response.PostalAddress.English));
            Console.WriteLine("response.PostalAddress.Irish = {0}", string.Join(",", response.PostalAddress.Irish));
            Console.WriteLine("response.SpatialInfo.Etrs89.Location.Longitude = {0}", response.SpatialInfo.Etrs89.Location.Longitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.Location.Latitude = {0}", response.SpatialInfo.Etrs89.Location.Latitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Min.Longitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Min.Longitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Min.Latitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Min.Latitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Max.Longitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Max.Longitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Max.Latitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Max.Latitude);
            Console.WriteLine("response.SpatialInfo.Ing.Location.Easting = {0}", response.SpatialInfo.Ing.Location.Easting);
            Console.WriteLine("response.SpatialInfo.Ing.Location.Northing = {0}", response.SpatialInfo.Ing.Location.Northing);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Min.Easting = {0}", response.SpatialInfo.Ing.BoundingBox.Min.Easting);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Min.Northing = {0}", response.SpatialInfo.Ing.BoundingBox.Min.Northing);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Max.Easting = {0}", response.SpatialInfo.Ing.BoundingBox.Max.Easting);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Max.Northing = {0}", response.SpatialInfo.Ing.BoundingBox.Max.Northing);
            Console.WriteLine("response.SpatialInfo.Itm.Location.Easting = {0}", response.SpatialInfo.Itm.Location.Easting);
            Console.WriteLine("response.SpatialInfo.Itm.Location.Northing = {0}", response.SpatialInfo.Itm.Location.Northing);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Min.Easting = {0}", response.SpatialInfo.Itm.BoundingBox.Min.Easting);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Min.Northing = {0}", response.SpatialInfo.Itm.BoundingBox.Min.Northing);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Max.Easting = {0}", response.SpatialInfo.Itm.BoundingBox.Max.Easting);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Max.Northing = {0}", response.SpatialInfo.Itm.BoundingBox.Max.Northing);
        }
Пример #2
0
        /// <summary>
        /// Return all the available data from the ECAD for the supplied ECAD Id as an asynchronous operation.
        /// </summary>
        /// <param name="request">GetEcadData request.</param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <example>
        /// The following code example creates an AutoaddressClient and calls GetEcadDataAsync with a request.
        /// <code source="..\src\Autoaddress2.0SDK.Test\Example\AutoaddressClientGetEcadDataAsyncRequestExample1.cs" language="cs" />
        /// </example>
        public async Task <Model.GetEcadData.Response> GetEcadDataAsync(Model.GetEcadData.Request request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            Uri requestUri = GetRequestUri(_licenceKey, request.Txn, _autoaddressConfig.ApiBaseAddress, Version, GetEcadDataMethod, request);
            var response   = await GetResponseAsync <Model.GetEcadData.Response>(request, requestUri);

            return(response);
        }
Пример #3
0
        /// <summary>
        /// Return all the available data from the ECAD for the supplied ECAD Id.
        /// </summary>
        /// <param name="request">GetEcadData request.</param>
        /// <returns>GetEcadData response.</returns>
        /// <example>
        /// The following code example creates an AutoaddressClient and calls GetEcadData with a request.
        /// <code source="..\src\Autoaddress2.0SDK.Test\Example\AutoaddressClientGetEcadDataRequestExample1.cs" language="cs" />
        /// </example>
        public Model.GetEcadData.Response GetEcadData(Model.GetEcadData.Request request)
        {
            try
            {
                return(GetEcadDataAsync(request).Result);
            }
            catch (Exception e)
            {
                if (e.InnerException != null)
                {
                    throw e.InnerException;
                }

                throw;
            }
        }