Get list of contractors by name. Allows for paging the amount of info returned
Use rows to set the number of matching rows it returns. Use firstRec and lastRec for paging. Ex. rows=10,firstRec=11,lastRec=20 will do a search, and return rows 11-20.
Name | Type | Length | Description |
---|---|---|---|
contractorName | System.String | 30 | [Required] Contractor name to search for |
mode | System.String | 1 | [Required] Search mode. F=Begins With |
rows | numeric | 4 | [Required] Number of rows to return |
firstRec | numeric | 4 | [Required] First record number returned for paging |
lastRec | numeric | 4 | [Required] Last record number returned for paging |
GET http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/Contractors/{contractorName}/{mode}/{rows}/{firstRec}/{lastRec}
Name | Description |
---|---|
AppType | Application type the contractor is associated with. BP=Building Permits OL=Occupational License |
ContractorNumber | Contractor Number |
ContractorName | Contractor's Name |
AddressLine1 | Address line 1 |
AddressLine2 | Address line 2 |
AddressLine3 | Address line 3 |
City | City |
State | State |
Zip | Zip code |
CityStateZip | City, State Zip formatted together in one line |
AreaCode | Phone area code |
PhoneNumber | Phone number (7-digit) |
FullPhoneNumber | Formatted phone number with area code and number. Ex (111)222-4444 |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/Contractors/PRECISION AIR/F/0010/0000/0010";
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 contractorName = row["ContractorName"].ToString();
string contractorNumber = row["ContractorNumber"].ToString();
// TODO - YOUR CODE HERE
}
}
}
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 GetContractors
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,30}$).*", ErrorMessage = "Must be 30 characters or less. ")]
public string contractorName{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string mode{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
public string rows{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
public string firstRec{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
public string lastRec{get; set;}
public GetContractors()
{
//Set any defaults here
contractorName = DefaultData.Get("contractorName");
mode = DefaultData.Get("mode");
rows = DefaultData.Get("rows");
firstRec = DefaultData.Get("firstRec");
lastRec = DefaultData.Get("lastRec");
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the GetContractors 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.GetContractors
@{
ViewBag.Title = "GetContractors";
string myUrl = "http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/Contractors/" + Model.contractorName + "/" + Model.mode + "/" + Model.rows + "/" + Model.firstRec + "/" + Model.lastRec;
}
<h2>GetContractors</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>GetContractors</legend>
<div class="editor-label">Use the fields below to change the values and resubmit.</div>
<div class="editor-label">
@Html.LabelFor(model => model.contractorName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.contractorName)
@Html.ValidationMessageFor(model => model.contractorName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.mode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.mode)
@Html.ValidationMessageFor(model => model.mode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.rows)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.rows)
@Html.ValidationMessageFor(model => model.rows)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.firstRec)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.firstRec)
@Html.ValidationMessageFor(model => model.firstRec)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.lastRec)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.lastRec)
@Html.ValidationMessageFor(model => model.lastRec)
</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/GetContractors
public ActionResult GetContractors()
{
// Create a new instance of the model to pick up any default values.
GetContractors model = new GetContractors();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/GetContractors.cshtml", model);
}
//
// POST: /MyController/GetContractors
[HttpPost]
public ActionResult GetContractors(FormCollection collection)
{
string url = "v3/Naviline/Permit/Application/Contractor/Contractors/{contractorName}/{mode}/{rows}/{firstRec}/{lastRec}";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("contractorName", collection["contractorName"]);
inputParms.Add("mode", collection["mode"]);
inputParms.Add("rows", collection["rows"]);
inputParms.Add("firstRec", collection["firstRec"]);
inputParms.Add("lastRec", collection["lastRec"]);
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", "GetContractors");
return View("Error", info);
}
}