Search for a utility account by name
This service searches for a utility account by name. The customer will have to enter their name, or part of their name to search on and the service will return a list of possible account matches for the customer to select their account from. Once selected, you will have the customer and location number that is required for calling the other utility services.
Name | Type | Length | Description |
---|---|---|---|
name | System.String | 30 | [Required] Customer name to search on |
rows | numeric | 3 | Max rows to return. Default is 100 rows. |
POST http://localhost/FusionServices/v2/Naviline/Utilities/Search/ByName
This returns matching names for both residential and commercial customers. It returns the customer number and location number which together make up the account number used by most other services to identify the customer’s account. It also returns additional information, such as the address, so the customer can select which account is theirs in case multiple names match the criteria.
Name | Description |
---|---|
Customer | The customer number for the account. The customer number and location number together make up the account number used by most other services to identify the customer’s account. |
Location | The location number for the account. Location number is the second part of the account number used to identify the customer’s account. |
LocationAddress | Customer’s street address |
CustomerName | The customer’s name. For residential accounts, it should be in the format LAST, FIRST. For commercial accounts, it will be the business name. |
DriverLicenseNumber | Driver’s license associated with the account. |
SSN | Social security number associated with the account. |
Misc1Description | |
Misc1Date | |
Misc1Number | |
Misc1UserDefined | |
Misc2Description | |
Misc2Date | |
Misc2Number | |
Misc2UserDefined | |
Confidential | Indicates if the customer information is restricted and should not be given out or displayed. Y=Yes N=No |
CashOnly | Indicates if the customer is required to make all payments in cash only. Y=Yes N=No |
Status | The status of the account. The account status codes and their descriptions are: A = Active, C = Collections, D = Deleted, F = Finalled, I = Inactive, S = Shutoff, T = Terminated, N = Terminated, non-payment, V = Vacation, W = Writeoff |
ServiceInformation | The types of utility services available to this customer. The format is 2 chars for the service code, then a 20 character description, followed immediately by the next service code and description. |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v2/Naviline/Utilities/Search/ByName";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("name",System.Web.HttpUtility.UrlEncode("WILLIAMS"));
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 Customer = row["Customer"].ToString();
string Location = row["Location"].ToString();
string LocationAddress = row["LocationAddress"].ToString();
string CustomerName = row["CustomerName"].ToString();
string DriverLicenseNumber = row["DriverLicenseNumber"].ToString();
string SSN = row["SSN"].ToString();
string Misc1Description = row["Misc1Description"].ToString();
string Misc1Date = row["Misc1Date"].ToString();
string Misc1Number = row["Misc1Number"].ToString();
string Misc1UserDefined = row["Misc1UserDefined"].ToString();
string Misc2Description = row["Misc2Description"].ToString();
string Misc2Date = row["Misc2Date"].ToString();
string Misc2Number = row["Misc2Number"].ToString();
string Misc2UserDefined = row["Misc2UserDefined"].ToString();
string Confidential = row["Confidential"].ToString();
string CashOnly = row["CashOnly"].ToString();
string Status = row["Status"].ToString();
string ServiceInformation = row["ServiceInformation"].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 PostUtilitiesAccountSearchByName
{
// 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-9]{0,3}", ErrorMessage = "Numeric values only. Must be 3 digits or less. ")]
public string rows{get; set;}
public PostUtilitiesAccountSearchByName()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostUtilitiesAccountSearchByName 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.PostUtilitiesAccountSearchByName
@{
ViewBag.Title = "PostUtilitiesAccountSearchByName";
}
<h2>PostUtilitiesAccountSearchByName</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostUtilitiesAccountSearchByName</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.rows)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.rows)
@Html.ValidationMessageFor(model => model.rows)
</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/PostUtilitiesAccountSearchByName
public ActionResult PostUtilitiesAccountSearchByName()
{
// Create a new instance of the model to pick up any default values.
PostUtilitiesAccountSearchByName model = new PostUtilitiesAccountSearchByName();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostUtilitiesAccountSearchByName.cshtml", model);
}
//
// POST: /MyController/PostUtilitiesAccountSearchByName
[HttpPost]
public ActionResult PostUtilitiesAccountSearchByName(FormCollection collection)
{
string url = "v2/Naviline/Utilities/Search/ByName";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("name", collection["name"]);
inputParms.Add("rows", collection["rows"]);
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", "PostUtilitiesAccountSearchByName");
return View("Error", info);
}
}