using AIR.Services.Common.Data;
using AIR.Services.Common.Filter.Data;
using AIR.Services.Reinsurance.PortfolioManagement.Api;
using System;
using System.Collections.Generic;
class SnippetPortfolioAPIs
{
private static void CreatePortfolioDynamic(int businessUnitSid, int sqlInstanceSid, string name)
{
ReinsurancePortfolioManagementServiceClient client = new ReinsurancePortfolioManagementServiceClient();
CreatePortfolioDynamicRequest request = new CreatePortfolioDynamicRequest();
//Set the BusinessUnitSid property (required property)
request.BusinessUnitSid = businessUnitSid;
//Set the SqlInstanceSid property (required property)
request.SqlInstanceSid = sqlInstanceSid;
//Set the Name property. (required property)
request.Name = name;
//Set the Description property. (optional property)
request.Description = "Created by API";
request.Filter = GetFilter();
//Submit the request and get response back
CreatePortfolioDynamicResponse response = client.CreatePortfolioDynamic(request);
//Validate the response. Response is valid if Response.Status.Code is equal to StatusCode.Success
if (response.Status.Code == StatusCode.Success)
{
Console.WriteLine("Portfolio created with SID: " + response.PortfolioSid);
}
}
private static Filter GetFilter()
{
//Create the first composite expression
CompositeExpression expression = new CompositeExpression()
{
//Set the FilterExpressions property. FilterExpressions consist of a list of simple or composite expressions
FilterExpressions = new List<FilterExpression>()
{
new SimpleExpression()
{
//Set the AppliedEntity property. Refer to the developers guide for valid options (required property)
AppliedEntity = "ViewReinsuranceTreatyDetails",
//Set the PropertyName property. The property values are based on the AppliedEntity property.
//Refer to the developers guide for valid options (required property)
//https://www.air-worldwide.com/Documentation/APIs/TouchstoneRe/7.1/webframe.html#topic360.html
PropertyName = "CompanyName",
//Set the Operator property. The property values are based on the PropertyName property.
//Refer to the developers guide for valid options (required property)
Operator = FilterOperator.IsNotEqualTo,
//Set the Value property. The data type of the property is based on the PropertyName property.
//Refer to the developers guide for valid options (required property)
Value = "Test"
}
},
LogicalOperator = LogicalOperator.And
};
//Add the filter to a list and return. R1 supports one filter expression in the filters collection
return new Filter() { Expression = expression };
}
}