Method GetContractorBalDue
Summary
Get Contractor Balance Due
Remarks
This returns the balance due on license or permit fees for the contractor.
- Use PostSearchByContractorName to search for the contractor to link to the customer.
- If AppType from PostSearchByContractorName is 'BP', then pass 'B' as the first character then the contractor number. This indicates a Building Permit contractor is being used.
- If AppType from PostSearchByContractorName is 'OL', then pass 'O' as the first character then the contractor number. This indicates an Occupational License contractor is being used.
Input Parameters
Name | Type | Length | Description |
contractorNumber |
System.String |
8 |
[Required] Contractor Number - with B=BP and O=OL as first char. Ex: B0000037 |
Example
GET http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/BalDue/{contractorNumber}
Return Values
Name | Description |
ContractorNumber |
Contractor Number |
ApplicationYear |
Application Year (4 digits) |
ApplicationNum |
Application Number |
AmountDue |
Amount Due |
ErrorCode |
Error code. 0000 = success |
ErrorMessage |
Error message. Description of error returned. Blank if no error. |
Sample Responses
{
"ServerElapsedTime": "00:00:00.7069901",
"Rows": [
{
"ContractorNum": "0000037",
"ApplicationYear": "2014",
"ApplicationNum": "00012518",
"AmountDue": "44.22"
}
],
"OutputParms": {
"ErrorCode": "0000",
"ErrorMessage": ""
}
}
Sample Code
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/BalDue/B37";
WebClient wc = new WebClient();
wc.Headers.Set("X-APPID", "YOURID");
wc.Headers.Set("X-APPKEY", "YOURKEY");
string stringResult = wc.DownloadString(new Uri(uri));
JObject response = JObject.Parse(stringResult);
string error = response["OutputParms"]["ErrorCode"].ToString();
if (error == "0000")
{
JArray jRows = (JArray)response["Rows"];
foreach (JObject row in jRows)
{
string contractorNumber = row["ContractorNum"].ToString();
string appYear = row["ApplicationYear"].ToString();
string appNum = row["ApplicationNum"].ToString();
string amountDue = row["AmountDue"].ToString();
}
}
}
$.get('http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/BalDue/B37', function(response) {
$('#resultDiv).html(response);
});
C# Razor MVC Sample Code
using System;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Collections.Specialized;
using FusionServiceHelper.Models;
namespace FusionRazor.Models
{
public class GetContractorBalDue
{
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,8}$).*", ErrorMessage = "Must be 8 characters or less. ")]
public string contractorNumber{get; set;}
public GetContractorBalDue()
{
contractorNumber = DefaultData.Get("contractorNumber");
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the GetContractorBalDue class. *@
@* NOTE: Select Edit as the Scaffold template. *@
@* NOTE: Use the @model line that is generated at the top. Replace the rest with the lines below.
@model FusionRazor.Models.GetContractorBalDue
@{
ViewBag.Title = "GetContractorBalDue";
string myUrl = "http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/BalDue/" + Model.contractorNumber;
}
<h2>GetContractorBalDue</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>GetContractorBalDue</legend>
<div class="editor-label">Use the fields below to change the values and resubmit.</div>
<div class="editor-label">
@Html.LabelFor(model => model.contractorNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.contractorNumber)
@Html.ValidationMessageFor(model => model.contractorNumber)
</div>
<p>
<input type="submit" value="Submit"/>
</p>
</fieldset>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
using System;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FusionServiceHelper.Models;
public ActionResult GetContractorBalDue()
{
GetContractorBalDue model = new GetContractorBalDue();
return View("~/Views/MyFolderPath/GetContractorBalDue.cshtml", model);
}
[HttpPost]
public ActionResult GetContractorBalDue(FormCollection collection)
{
string url = "v3/Naviline/Permit/Application/Contractor/BalDue/{contractorNumber}";
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("contractorNumber", collection["contractorNumber"]);
try
{
FusionServiceRequest request = new FusionServiceRequest();
FusionServiceResult result = request.Get(url, inputParms);
return View("Result", result);
}
catch(Exception e)
{
HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "GetContractorBalDue");
return View("Error", info);
}
}