using System;
using AIR.Services.Common.Data;
using AIR.Services.Common.Exposure.Data;
using AIR.Services.ExposureManagement.Api;
using System.Collections.Generic;
class SnippetCreateLocationRequest
{
private static void CreateLocation(int businessUnitSid, int sqlInstanceSid, string locationId, int contractSid, int exposureSetSid, int dataSourceSid)
{
ExposureManagementServiceClient exposureManagementClient = new ExposureManagementServiceClient();
CreateLocationRequest request = new CreateLocationRequest();
request.BusinessUnitSid = businessUnitSid;
request.SqlInstanceSid = sqlInstanceSid;
request.ContractSid = contractSid;
request.Location = new Location
{
ID = locationId,
Address = "131 Dartmouth Street",
AreaName = "MA",
City = "Boston",
PostalCode = "02116",
CountryName = "US",
CountryCode = "US",
Currency = "USD",
InceptionDate = new DateTime(2014, 1, 1),
ExpirationDate = new DateTime(2014, 12, 31),
ExposureSet = new ExposureSet
{
Sid = exposureSetSid,
DataSourceSid = dataSourceSid
},
ConstructionCode = 101,
OccupancyCode = 300,
YearBuilt = 2012,
Stories = 7,
GrossArea = 10000,
ReplacementValueA = 400000000,
ReplacementValueB = 40000000,
ReplacementValueC = 4000000,
ReplacementValueD = 4000,
LocationFeature = new LocationFeature
{
Wall = Wall.CastInPlaceConcrete,
RoofYearBuilt = 2012
},
Terms = new List<LocationTerm>(){
new LocationTerm(){
Perils = PerilSetCode.TropicalCyclone | PerilSetCode.Earthquake,
Participation = 1,
CededParticipation = 1,
Deductible = new LocationCoverageDeductible{
DeductibleBuilding = 100,
DeductibleBusinessInterruption = 21000,
DeductibleContents = 22000,
DeductibleOther = 5000
},
Limit = new LocationCoverageLimit{
LimitBuilding = 22000,
LimitBusinessInterruption = 32000,
LimitContents = 42000,
}
}
}
};
CreateLocationResponse response = exposureManagementClient.CreateLocation(request);
if (response.Status.Code == StatusCode.Success)
{
Console.WriteLine(" Location: " + locationId + " created with SID: " + response.LocationSid);
}
}
}