Returns location information
Use the Function key to either read a record or search and loop through records.
Name | Type | Length | Description |
---|---|---|---|
Function | System.String | 0 | [Required] READRECORD | STARTNEXT | READNEXT | STARTPRIOR | READPRIOR |
Order | System.String | 0 | [Required] LOCATIONID |
LocationID | numeric | 9 | [Required] Location ID to search on |
POST http://localhost/FusionServices/v2/NaviLine/Land/LocationInquiry
using System.Net;
string uri = "http://localhost/FusionServices/v2/NaviLine/Land/LocationInquiry";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
postParms.Add("Order",System.Web.HttpUtility.UrlEncode("LOCATIONID"));
postParms.Add("Function",System.Web.HttpUtility.UrlEncode("READRECORD"));
postParms.Add("LocationID",System.Web.HttpUtility.UrlEncode("41768"));
using (WebClient req = new WebClient())
{
byte[] responseBytes = wc.UploadValues(new Uri(uri), "POST", postParms);
string stringResult = Encoding.UTF8.GetString(responseBytes);
// TODO
}
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 PostLocationInquiry
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
public string Function{get; set;}
[Required(ErrorMessage = "Required")]
public string Order{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
public string LocationID{get; set;}
public PostLocationInquiry()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostLocationInquiry 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.PostLocationInquiry
@{
ViewBag.Title = "PostLocationInquiry";
}
<h2>PostLocationInquiry</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostLocationInquiry</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Function)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Function)
@Html.ValidationMessageFor(model => model.Function)
</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.LocationID)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.LocationID)
@Html.ValidationMessageFor(model => model.LocationID)
</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/PostLocationInquiry
public ActionResult PostLocationInquiry()
{
// Create a new instance of the model to pick up any default values.
PostLocationInquiry model = new PostLocationInquiry();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostLocationInquiry.cshtml", model);
}
//
// POST: /MyController/PostLocationInquiry
[HttpPost]
public ActionResult PostLocationInquiry(FormCollection collection)
{
string url = "v2/NaviLine/Land/LocationInquiry";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("Function", collection["Function"]);
inputParms.Add("Order", collection["Order"]);
inputParms.Add("LocationID", collection["LocationID"]);
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", "PostLocationInquiry");
return View("Error", info);
}
}