Search for Contractor
This does not return an ErrorCode. It returns a ROWS value which is the number of rows returned.
Name | Type | Length | Description |
---|---|---|---|
name | System.String | 30 | [Required] Contractor name to search for |
mode | System.String | 1 | Search mode. Defaults to Blank=Contains. B=Begins With |
rows | numeric | 4 | Row number used for paging |
page | numeric | 5 | Page number used for paging |
POST http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/Search/ByContractorName
Name | Description |
---|---|
AppType | Application type the contractor is associated with |
ContractorNumber | Contractor Number |
ContractorName | Contractor's Name |
ContractorType | Contractor Type code |
LicenseCentury | Century indicator for when contractor was licensed |
LicenseYear | Year contractor was licensed |
LicenseNumber | License Number |
ContractorDesc | Contractor Type description |
RTSELC |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Permit/Application/Contractor/Search/ByContractorName";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("name",System.Web.HttpUtility.UrlEncode("J"));
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 AppType = row["AppType"].ToString();
string ContractorNumber = row["ContractorNumber"].ToString();
string ContractorName = row["ContractorName"].ToString();
string ContractorType = row["ContractorType"].ToString();
string LicenseCentury = row["LicenseCentury"].ToString();
string LicenseYear = row["LicenseYear"].ToString();
string LicenseNumber = row["LicenseNumber"].ToString();
string ContractorDesc = row["ContractorDesc"].ToString();
string RTSELC = row["RTSELC"].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 PostSearchByContractorName
{
// 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 name{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,5}", ErrorMessage = "Numeric values only. Must be 5 digits or less. ")]
public string page{get; set;}
public PostSearchByContractorName()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostSearchByContractorName 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.PostSearchByContractorName
@{
ViewBag.Title = "PostSearchByContractorName";
}
<h2>PostSearchByContractorName</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostSearchByContractorName</legend>
<div class="editor-label">
@Html.LabelFor(model => model.name)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.name)
@Html.ValidationMessageFor(model => model.name)
</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.page)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.page)
@Html.ValidationMessageFor(model => model.page)
</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/PostSearchByContractorName
public ActionResult PostSearchByContractorName()
{
// Create a new instance of the model to pick up any default values.
PostSearchByContractorName model = new PostSearchByContractorName();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostSearchByContractorName.cshtml", model);
}
//
// POST: /MyController/PostSearchByContractorName
[HttpPost]
public ActionResult PostSearchByContractorName(FormCollection collection)
{
string url = "v3/Naviline/Permit/Application/Contractor/Search/ByContractorName";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("name", collection["name"]);
inputParms.Add("mode", collection["mode"]);
inputParms.Add("rows", collection["rows"]);
inputParms.Add("page", collection["page"]);
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", "PostSearchByContractorName");
return View("Error", info);
}
}