Get Contractor Balance Due
Name | Type | Length | Description |
---|---|---|---|
contractorNumber | System.String | 8 | [Required] Contractor Number - with B=BP and O=OL as first char. Ex: B0000037 |
GET http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/BalDue/{contractorNumber}
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. |
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();
// TODO - YOUR CODE HERE
}
}
}
$.get('http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/BalDue/B37', function(response) {
$('#resultDiv).html(response);
});
using System;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Collections.Specialized;
using FusionServiceHelper.Models;
// NOTE: Use the namespace generated when you add the class, so that it is correct.
namespace FusionRazor.Models
{
public class GetContractorBalDue
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,8}$).*", ErrorMessage = "Must be 8 characters or less. ")]
public string contractorNumber{get; set;}
public GetContractorBalDue()
{
//Set any defaults here
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;
// NOTE: Replace 'MyController' with the name of your controller.
//
// GET: /MyController/GetContractorBalDue
public ActionResult GetContractorBalDue()
{
// Create a new instance of the model to pick up any default values.
GetContractorBalDue model = new GetContractorBalDue();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/GetContractorBalDue.cshtml", model);
}
//
// POST: /MyController/GetContractorBalDue
[HttpPost]
public ActionResult GetContractorBalDue(FormCollection collection)
{
string url = "v3/Naviline/Permit/Application/Contractor/BalDue/{contractorNumber}";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("contractorNumber", collection["contractorNumber"]);
try
{
// Send the request
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);
}
}