Touchstone 11.0 API Reference
GetLocations Method
Example 


Air.Services.Proxy Assembly > (Global) Namespace > ExposureManagementServiceClient Class : GetLocations Method
Contains a GetLocationsRequest that identifies the Touchstone-generated Business Unit Sequential Identifier (SID), SQL Instance SID, Contract SID, Exposure Set, and Exposure View SID associated with the list of Locations that you want to retrieve, along with the desired Paging Info and whether to filter the Locations by the Exposure View that you have specified.
Retrieves a list of all existing Touchstone® Locations for a given Contract within a specific Business Unit and SQL Server Instance.
Syntax
Public Function GetLocations( _
   ByVal request As GetLocationsRequest _
) As GetLocationsResponse
Dim instance As ExposureManagementServiceClient
Dim request As GetLocationsRequest
Dim value As GetLocationsResponse
 
value = instance.GetLocations(request)

Parameters

request
Contains a GetLocationsRequest that identifies the Touchstone-generated Business Unit Sequential Identifier (SID), SQL Instance SID, Contract SID, Exposure Set, and Exposure View SID associated with the list of Locations that you want to retrieve, along with the desired Paging Info and whether to filter the Locations by the Exposure View that you have specified.

Return Value

A GetLocationsResponse containing a list of Locations in the specified Contract within the specified SQL Server Instance and Business Unit, as well as information describing the actual paging layout of the returned Locations. Further, this list of Locations contains only the Locations within the specified Exposure View (if you have applied the Use Exposure View Filter). The information returned for each Location includes any associated Location Terms.
Remarks
To find the Business Unit SID to pass into this method, call the GetBusinessUnits() method.

To find the SQL Instance SID to pass into this method, call the GetSqlInstances() method.

To find the Exposure Set to pass into this method, call the GetExposureSets() method. (To find the Data Source SID to pass into the GetExposureSets() method, call the GetDataSources() method.)

To find the Exposure View SID to pass into this method, call the GetExposureViews() method. (To find the Project SID to pass into the GetExposureViews() method, call the GetProjects() method.)

To find the Contract SID to pass into this method, call the GetContracts() method.

Example
The following example shows how to retrieve a list of all Touchstone Locations for a given Contract within a specific Business Unit and SQL Server Instance using the GetLocations() method:
using System;
using AIR.Services.Common.Data;
using AIR.Services.ExposureManagement.Api;
using AIR.Services.Common.Exposure.Data;
using AIR.Services.DataSourceManagement.Api;
            
class SnippetGetLocationsRequest
{
    private static void GetLocations(int businessUnitSid, int sqlInstanceSid, int dataSourceSid, ExposureSet exposureSet, int contractSid, int exposureViewSid)
    {
        ExposureManagementServiceClient exposureManagementClient = new ExposureManagementServiceClient();
        GetLocationsRequest getLocationsRequest = new GetLocationsRequest();
        getLocationsRequest.BusinessUnitSid = businessUnitSid;
        getLocationsRequest.SqlInstanceSid = sqlInstanceSid;
                   
        getLocationsRequest.ExposureSet = exposureSet;
        getLocationsRequest.ContractSid = contractSid;
            
        getLocationsRequest.ExposureViewSid = exposureViewSid;
        getLocationsRequest.UseExposureViewFilter = true;
            
        //Implement your logic to loop through all the records.
        int page = 1; int pageSize = 20;
        getLocationsRequest.PagingInfo = new PagingInfo { PageNumber = page, PageSize = pageSize };
            
        GetLocationsResponse getLocationsResponse = exposureManagementClient.GetLocations(getLocationsRequest);
            
        if (getLocationsResponse.Status.Code == StatusCode.Success)
        {
            foreach (Location location in getLocationsResponse.Locations)
            {
                Console.WriteLine("------------------   Location SID: " + location.Sid + "  -----------------------");
                Console.WriteLine("ID: " + location.ID);
                Console.WriteLine("Name: " + location.Name);
                Console.WriteLine("Address: " + location.Address);
                Console.WriteLine("Total Replacement Value: " + location.TotalReplacementValue);
                foreach (LocationTerm term in location.Terms)
                {
                    Console.WriteLine("            -------------                    ");
                    Console.WriteLine("Term SID: " + term.Sid);
                    Console.WriteLine("Term Perils: " + term.Perils);
            
                    //Do something similar for each type of Deductible.
                    if (term.Deductible.GetType() == typeof(LocationPercentOfLossDeductible))
                    {
                        Console.WriteLine("Term Building Deductible: " + (term.Deductible as LocationPercentOfLossDeductible).DeductibleBuilding);
                        Console.WriteLine("Term Contents Deductible: " + (term.Deductible as LocationPercentOfLossDeductible).DeductibleContents);
                        Console.WriteLine("Term Business Interruption Deductible: " + (term.Deductible as LocationPercentOfLossDeductible).DeductibleBusinessInterruption);
                    }
                    else if (term.Deductible.GetType() == typeof(LocationAnnualAmountDeductible))
                    {
                        Console.WriteLine("Term Hurricane Deductible: " + (term.Deductible as LocationAnnualAmountDeductible).DeductibleHurricane);
                        Console.WriteLine("Term Other Perils Deductible: " + (term.Deductible as LocationAnnualAmountDeductible).DeductibleOtherPerils);
                    }
            
                }
            }
        }
    }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ExposureManagementServiceClient Class
ExposureManagementServiceClient Members