Add User Defined Information
Name | Type | Length | Description |
---|---|---|---|
function | System.String | 1 | Function Blank=Write Location ID Key, P=Write Parcel X-Ref Key |
locationID | numeric | 9 | [Required] Location ID |
userDefCode | System.String | 4 | [Required] User defined code |
userDefText | System.String | 40 | User defined text. 40 chars max. |
userDefDate | mmddyy | 6 | User defined date. Format=MMddyy. |
subCode | System.String | 6 | Sub code for user defined code |
userDefNumber | numeric | 13 | User defined number |
POST http://localhost/FusionServices/v3/Naviline/Land/UserDefInfo
Name | Description |
---|---|
ErrorCode | |
ApplicationCode | |
LastChangedMonth | |
LastChangedDay | |
LastChangedYear | |
LastChangedUser |
using System.Net;
string uri = "http://localhost/FusionServices/v3/Naviline/Land/UserDefInfo";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
postParms.Add("function",System.Web.HttpUtility.UrlEncode("P"));
postParms.Add("locationID",System.Web.HttpUtility.UrlEncode("49324"));
postParms.Add("userDefCode",System.Web.HttpUtility.UrlEncode("PCST"));
postParms.Add("userDefText",System.Web.HttpUtility.UrlEncode("PARCEL TEXT"));
postParms.Add("userDefDate",System.Web.HttpUtility.UrlEncode("050417"));
postParms.Add("subCode",System.Web.HttpUtility.UrlEncode("0"));
postParms.Add("userDefNumber",System.Web.HttpUtility.UrlEncode("1500"));
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 PostUserDefInfo
{
// Add property for each input param in order to map a field to it
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string function{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;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
public string userDefCode{get; set;}
[RegularExpression("^(?=.{0,40}$).*", ErrorMessage = "Must be 40 characters or less. ")]
public string userDefText{get; set;}
[RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
public string userDefDate{get; set;}
[RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
public string subCode{get; set;}
[RegularExpression("[0-9]{0,13}", ErrorMessage = "Numeric values only. Must be 13 digits or less. ")]
public string userDefNumber{get; set;}
public PostUserDefInfo()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostUserDefInfo 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.PostUserDefInfo
@{
ViewBag.Title = "PostUserDefInfo";
}
<h2>PostUserDefInfo</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostUserDefInfo</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.locationID)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.locationID)
@Html.ValidationMessageFor(model => model.locationID)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.userDefCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.userDefCode)
@Html.ValidationMessageFor(model => model.userDefCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.userDefText)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.userDefText)
@Html.ValidationMessageFor(model => model.userDefText)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.userDefDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.userDefDate)
@Html.ValidationMessageFor(model => model.userDefDate)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.subCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.subCode)
@Html.ValidationMessageFor(model => model.subCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.userDefNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.userDefNumber)
@Html.ValidationMessageFor(model => model.userDefNumber)
</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/PostUserDefInfo
public ActionResult PostUserDefInfo()
{
// Create a new instance of the model to pick up any default values.
PostUserDefInfo model = new PostUserDefInfo();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostUserDefInfo.cshtml", model);
}
//
// POST: /MyController/PostUserDefInfo
[HttpPost]
public ActionResult PostUserDefInfo(FormCollection collection)
{
string url = "v3/Naviline/Land/UserDefInfo";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("function", collection["function"]);
inputParms.Add("locationID", collection["locationID"]);
inputParms.Add("userDefCode", collection["userDefCode"]);
inputParms.Add("userDefText", collection["userDefText"]);
inputParms.Add("userDefDate", collection["userDefDate"]);
inputParms.Add("subCode", collection["subCode"]);
inputParms.Add("userDefNumber", collection["userDefNumber"]);
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", "PostUserDefInfo");
return View("Error", info);
}
}