Get Project Names
Name | Type | Length | Description |
---|---|---|---|
projectNumber | numeric | 8 | [Required] Project Number |
projectYear | numeric | 2 | [Required] Two digit Application Year - if a 4 digit year is provided, only the last two digits are used |
order | numeric | 1 | [Required] Sort order. 1=Name, 2=NameType, 3=Address, 4=ZipCode |
rows | numeric | 4 | [Required] Number of rows to return. Used for paging of records |
pageNumber | numeric | 5 | [Required] page number used for paging of records |
GET http://localhost/FusionServices/v3/Naviline/PlanningEngineering/ProjectNames/{projectNumber}/{projectYear}/{order}/{rows}/{pageNumber}
Name | Description |
---|---|
ErrorCode | 0000=Success |
ErrorMessage | Error message describing any error that occurred |
NameType | Association to the project. I.e. Contractor, Engineer, Applicant |
Name | Person's or Company name |
AddressLine1 | Address line 1 |
AddressLine2 | Address line 2 |
AddressLine2 | Address line 3 |
HomePhoneAreaCode | Area Code for Home phone number |
HomePhone | Home phone number |
WorkPhoneAreaCode | Area Code for Work phone number |
WorkPhone | Work phone number |
EmergencyPhoneAreaCode | Area Code for Emergency phone number |
EmergencyPhone | Emergency phone number |
MobilePhoneAreaCode | Area Code for Mobile phone number |
MobilePhone | Mobile phone number |
LocationID | Location ID |
ROWS | Number of rows returned |
MOREYN | More rows to return? Y/N |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/PlanningEngineering/ProjectNames/30000001/16/1/0010/00001";
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 NameType = row["NameType"].ToString();
string Name = row["Name"].ToString();
string AddressLine1 = row["AddressLine1"].ToString();
string AddressLine2 = row["AddressLine2"].ToString();
string AddressLine3 = row["AddressLine3"].ToString();
string HomePhoneAreaCode = row["HomePhoneAreaCode"].ToString();
string HomePhone = row["HomePhone"].ToString();
string WorkPhoneAreaCode = row["WorkPhoneAreaCode"].ToString();
string WorkPhone = row["WorkPhone"].ToString();
string EmergencyPhoneAreaCode = row["EmergencyPhoneAreaCode"].ToString();
string EmergencyPhone = row["EmergencyPhone"].ToString();
string MobilePhoneAreaCode = row["MobilePhoneAreaCode"].ToString();
string MobilePhone = row["MobilePhone"].ToString();
string LocationID = row["LocationID"].ToString();
// TODO - YOUR CODE HERE
}
}
}
$.get('http://localhost/FusionServices/v3/Naviline/PlanningEngineering/ProjectNames/30000001/16/1/0010/00001', 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 GetProjectNames
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,8}", ErrorMessage = "Numeric values only. Must be 8 digits or less. ")]
public string projectNumber{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,2}", ErrorMessage = "Numeric values only. Must be 2 digits or less. ")]
public string projectYear{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,1}", ErrorMessage = "Numeric values only. Must be 1 digits or less. ")]
public string order{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,5}", ErrorMessage = "Numeric values only. Must be 5 digits or less. ")]
public string pageNumber{get; set;}
public GetProjectNames()
{
//Set any defaults here
projectNumber = DefaultData.Get("projectNumber");
projectYear = DefaultData.Get("projectYear");
order = DefaultData.Get("order");
rows = DefaultData.Get("rows");
pageNumber = DefaultData.Get("pageNumber");
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the GetProjectNames 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.GetProjectNames
@{
ViewBag.Title = "GetProjectNames";
string myUrl = "http://localhost/FusionServices/v3/Naviline/PlanningEngineering/ProjectNames/" + Model.projectNumber + "/" + Model.projectYear + "/" + Model.order + "/" + Model.rows + "/" + Model.pageNumber;
}
<h2>GetProjectNames</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>GetProjectNames</legend>
<div class="editor-label">Use the fields below to change the values and resubmit.</div>
<div class="editor-label">
@Html.LabelFor(model => model.projectNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.projectNumber)
@Html.ValidationMessageFor(model => model.projectNumber)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.projectYear)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.projectYear)
@Html.ValidationMessageFor(model => model.projectYear)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.order)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.order)
@Html.ValidationMessageFor(model => model.order)
</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.pageNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.pageNumber)
@Html.ValidationMessageFor(model => model.pageNumber)
</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/GetProjectNames
public ActionResult GetProjectNames()
{
// Create a new instance of the model to pick up any default values.
GetProjectNames model = new GetProjectNames();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/GetProjectNames.cshtml", model);
}
//
// POST: /MyController/GetProjectNames
[HttpPost]
public ActionResult GetProjectNames(FormCollection collection)
{
string url = "v3/Naviline/PlanningEngineering/ProjectNames/{projectNumber}/{projectYear}/{order}/{rows}/{pageNumber}";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("projectNumber", collection["projectNumber"]);
inputParms.Add("projectYear", collection["projectYear"]);
inputParms.Add("order", collection["order"]);
inputParms.Add("rows", collection["rows"]);
inputParms.Add("pageNumber", collection["pageNumber"]);
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", "GetProjectNames");
return View("Error", info);
}
}