Touchstone Re 2023 API Reference
UpdateContract Method
Example 


Air.Services.Proxy Assembly > (Global) Namespace > ExposureManagementServiceClient Class : UpdateContract Method
Contains an UpdateContractRequest that identifies the updated properties of the Contract that you want to update, along with the associated Touchstone-generated Business Unit Sequential Identifier (SID) and SQL Instance SID.
Updates an existing Touchstone® Contract.
Syntax
Public Function UpdateContract( _
   ByVal request As UpdateContractRequest _
) As UpdateContractResponse
Dim instance As ExposureManagementServiceClient
Dim request As UpdateContractRequest
Dim value As UpdateContractResponse
 
value = instance.UpdateContract(request)
public UpdateContractResponse UpdateContract( 
   UpdateContractRequest request
)

Parameters

request
Contains an UpdateContractRequest that identifies the updated properties of the Contract that you want to update, along with the associated Touchstone-generated Business Unit Sequential Identifier (SID) and SQL Instance SID.

Return Value

An UpdateContractResponse containing the Contract SID of the updated Contract.
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 update a Contract, perform the following steps:

  1. Get the Contract that you want to update by calling the GetContract() method.
  2. Update the Contract with the desired changes.
  3. Pass the updated Contract object from the previous step as part of the UpdateContractRequest object for the UpdateContract() method.
Example
The following example shows how to update a Touchstone Contract using the UpdateContract() method:
using System;
using AIR.Services.Common.Data;
using AIR.Services.Common.Exposure.Data;
using AIR.Services.ExposureManagement.Api;
            
class SnippetUpdateContractRequest
{
    private static void UpdateContract(int businessUnitSid, int sqlInstanceSid, int contractSid, int exposureSetSid, int datasourceSid)
    {
        ExposureManagementServiceClient exposureManagementClient = new ExposureManagementServiceClient();
        GetContractRequest request = new GetContractRequest();
        request.BusinessUnitSid = businessUnitSid;
        request.SqlInstanceSid = sqlInstanceSid;
        request.ContractSid = contractSid;
        request.ExposureSet = new ExposureSet
        {
            Sid = exposureSetSid,
            DataSourceSid = datasourceSid
        };
        GetContractResponse response = exposureManagementClient.GetContract(request);
            
        if (response.Status.Code == StatusCode.Success)
        {
            Contract contract = response.Contract;
            
            // Set the Contract properties that you want to update.
            contract.Status = ContractStatus.Bound;
            contract.ID = contract.ID + "_" + DateTime.Now.Ticks;
            
            UpdateContractRequest updateRequest = new UpdateContractRequest();
            updateRequest.BusinessUnitSid = businessUnitSid;
            updateRequest.SqlInstanceSid = sqlInstanceSid;
            updateRequest.Contract = contract;
            
            UpdateContractResponse updateResponse = exposureManagementClient.UpdateContract(updateRequest);
            
            if (updateResponse.Status.Code == StatusCode.Success)
            {
                Console.WriteLine("Contract updated successfully.");
            }
        }
    }
}
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