Method PostSearchContractorAppList

Summary

Search Contractor Application List

Remarks

This searches for permit applications that the contractor is attached to.

You can pass in an application year, type, or status to filter the search by.

Use the rows, firstRec, and lastRec to control the records returned for use with paging.

It returns a list of applications, and information for the contractor.

Input Parameters

NameTypeLengthDescription
contractorNumber numeric 7 [Required] Contractor Number
contractorType System.String 2 Contractor Type. B=Building Permit Contractor, O=Occupational License Contractor. Defaults to B.
applicationYear numeric 2 Application Year. Filter by application year. 2 digit year.
applicationType System.String 4 Application Type. Filter by application type. Use the 4 char application type code.
applicationStatus System.String 2 Application Status. Filter by application status. 2 char code. Ex. AP=Approved
contractorNameType System.String 2 Contractor name type. CT=Contractor SC=Subcontractor. Return applications where the contractor is listed as the main contractor, or the subcontractor. Leave empty to return both types.
mode System.String 1 Search mode. F=First records N=Next records. Used for paging through returned applications
rows numeric 4 Number of rows to return. Default=10 Used for paging through returned applications
firstRec numeric 4 first record number to return. Default=0 Used for paging through returned applications
lastRec numeric 4 last record number to return. Default=10 Used for paging through returned applications

Example

POST http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/AppList

Return Values

NameDescription
ApplicationYear Year permit application was submitted
LicenseNum License number
ApplicationNum Application number
ContractorNameType Contractor name type. CT=Contractor SC=Subcontractor.
AppTypeCode Application type code. 4 char code for application type.
AppTypeDesc Application type description. Display name for application type.
AppStatusCode Application status code. 2 char code for application status.
AppStatusDesc Application status description. Display name for application type.
AppAddress Application's address line 1
AppCityStateZip Application's City, State, and Zip
ParcelNo Application Parcel number
ApplicationDate Application Date
AmountDue Amount Due on application
Rows Number of rows returned
FirstRecord Number of first record returned
LastRecord Number of last record returned
MoreRows Returns Y/N to indicate if there are more rows to be returned.
ContractorName Contractor name
AddressLine1 Address line 1 of contractor
AddressLine2 Address line 2 of contractor
AddressLine3 Address line 3 of contractor
CityStateZip City, State, Zip of contractor
PhoneNumber Phone number of contractor
ContractorTypeCode Contractor type code. 4 char code for Contractor type.
ContractorTypeDesc Contractor type description. Display name for Contractor type.
ContractorStatus Contractor status
ErrorCode 0000 if all rows were returned, and there are no more rows. 2004=See error message for search result.
ErrorMessage Message saying if there are more records to search for.

Sample Responses

Sample Code

using System.Net;
using Newtonsoft.Json.Linq;

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/AppList";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("contractorNumber",System.Web.HttpUtility.UrlEncode("1218"));
   postParms.Add("applicationYear",System.Web.HttpUtility.UrlEncode("14"));

   WebClient req = new WebClient();
   wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
   wc.Headers.Set("X-APPID", "YOURID");
   wc.Headers.Set("X-APPKEY", "YOURKEY");

   byte[] responseBytes = wc.UploadValues(new Uri(uri), "POST", postParms);
   string stringResult = Encoding.UTF8.GetString(responseBytes); 
   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 ApplicationYear = row["ApplicationYear"].ToString();
             string LicenseNum = row["LicenseNum"].ToString();
             string RTCLAS = row["RTCLAS"].ToString();
             string RTCLDS = row["RTCLDS"].ToString();
             string RTISDT = row["RTISDT"].ToString();
             string RTLEXD = row["RTLEXD"].ToString();
             string ApplicationNum = row["ApplicationNum"].ToString();
             string ContractorNameType = row["ContractorNameType"].ToString();
             string AppTypeCode = row["AppTypeCode"].ToString();
             string AppTypeDesc = row["AppTypeDesc"].ToString();
             string AppStatusCode = row["AppStatusCode"].ToString();
             string AppStatusDesc = row["AppStatusDesc"].ToString();
             string AppAddress = row["AppAddress"].ToString();
             string AppCityStateZip = row["AppCityStateZip"].ToString();
             string ParcelNo = row["ParcelNo"].ToString();
             string ApplicationDate = row["ApplicationDate"].ToString();
             string AmountDue = row["AmountDue"].ToString();
             // TODO - YOUR CODE HERE
        }
   }
}

C# Razor MVC Sample Code

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 PostSearchContractorAppList
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,7}", ErrorMessage = "Numeric values only. Must be 7 digits or less. ")]
       public string contractorNumber{get; set;}

       [RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
       public string contractorType{get; set;}

       [RegularExpression("[0-9]{0,2}", ErrorMessage = "Numeric values only. Must be 2 digits or less. ")]
       public string applicationYear{get; set;}

       [RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
       public string applicationType{get; set;}

       [RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
       public string applicationStatus{get; set;}

       [RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
       public string contractorNameType{get; set;}

       [RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
       public string mode{get; set;}

       [RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
       public string rows{get; set;}

       [RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
       public string firstRec{get; set;}

       [RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
       public string lastRec{get; set;}

       public PostSearchContractorAppList()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostSearchContractorAppList 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.PostSearchContractorAppList

@{
   ViewBag.Title = "PostSearchContractorAppList";
}

<h2>PostSearchContractorAppList</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostSearchContractorAppList</legend>
       <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>
       <div class="editor-label">
           @Html.LabelFor(model => model.contractorType)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.contractorType)
           @Html.ValidationMessageFor(model => model.contractorType)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.applicationYear)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.applicationYear)
           @Html.ValidationMessageFor(model => model.applicationYear)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.applicationType)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.applicationType)
           @Html.ValidationMessageFor(model => model.applicationType)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.applicationStatus)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.applicationStatus)
           @Html.ValidationMessageFor(model => model.applicationStatus)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.contractorNameType)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.contractorNameType)
           @Html.ValidationMessageFor(model => model.contractorNameType)
       </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/PostSearchContractorAppList
public ActionResult PostSearchContractorAppList()
{
   // Create a new instance of the model to pick up any default values.
   PostSearchContractorAppList model =  new PostSearchContractorAppList();

   // pass model to set to default values
   // NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
   return View("~/Views/MyFolderPath/PostSearchContractorAppList.cshtml", model);
}

// 
// POST: /MyController/PostSearchContractorAppList
[HttpPost]
public ActionResult PostSearchContractorAppList(FormCollection collection)
{
   string url = "v3/Naviline/Permit/Application/Contractor/AppList";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("contractorNumber", collection["contractorNumber"]);
   inputParms.Add("contractorType", collection["contractorType"]);
   inputParms.Add("applicationYear", collection["applicationYear"]);
   inputParms.Add("applicationType", collection["applicationType"]);
   inputParms.Add("applicationStatus", collection["applicationStatus"]);
   inputParms.Add("contractorNameType", collection["contractorNameType"]);
   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.Post(url, inputParms);

       return View("Result", result);
   }
   catch(Exception e)
   {
       HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "PostSearchContractorAppList");
       return View("Error", info);
   }
}