SWS AddInsurance Method
Adds a site’s insurance coverage to a rental item, including the premium amount. Use the GetInsuranceProviders SWS method to retrieve the site’s list of available coverage group policies.
Parameters
Name | DataType | Is Required |
---|---|---|
AcctID | Long | Required |
Description | The account’s ID number. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method. | |
InsuranceOptionID | Long | Required |
Description | The insurance coverage group policy’s ID number. This ID number can be found in the response from the GetInsuranceProviders SWS method. | |
OrgID | Long | Required |
Description | The organization’s ID number. | |
RentalID | Long | Required |
Description | The rental item’s ID number. This is returned when using the MakeReservation method or can be searched for using the SearchBy method. | |
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. |
Returns
Name | DataType |
---|---|
Succeeded | Boolean |
Description | Indicates success (“True”) or failure (“False”). |
Example
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project. At this point we need to our objects. We’ll need the standard service object, an AddInsurance request object and an AddInsurance response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.AddInsurance_Request request = new SWS.AddInsurance_Request();
SWS.AddInsurance_Response response = new SWS.AddInsurance_Response();
Now we set up the parameters for our request.
//Add insurance request object
request.OrgID = 123456;
request.SiteID = 123456;
request.AcctID = 123456;
request.RentalID = 123456;
request.InsuranceOptionID = 123456;
Finally we can call the method and pass across the login object and the request object to perform adding the insurance. It’s a good idea to do this in a Try Catch block.
try
{
// Call the method that will load the response object
response = service.AddInsurance(user_request, request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.
For a full list of methods see SWS Methods.