Add Address Misc. Information to a location
Name | Type | Length | Description |
---|---|---|---|
LocationID | numeric | 9 | [Required] Location ID |
MiscCode | System.String | 4 | [Required] The 4 char code for the misc inforation. |
MiscCodeAppl | System.String | 2 | [Required] The 2 char application code. |
MiscInfoText | System.String | 40 | The information text to record |
MiscInfoDateMM | numeric | 2 | The month info was entered. Defaults to current month. |
MiscInfoDateDD | numeric | 2 | The day info was entered. Defaults to current day. |
MiscInfoDateYY | numeric | 2 | The year info was entered. Defaults to current year. |
MiscSeqNo | System.String | 4 | Sequence number. Example: 1.00 |
SpecialNote | System.String | 1 | Note type: Blank=No special process, C=Critical, S=Special |
RecordNo | numeric | 9 | Miscellaneous file record number |
POST http://localhost/FusionServices/v2/NaviLine/Land/MiscInfoAddressAdd
using System.Net;
string uri = "http://localhost/FusionServices/v2/NaviLine/Land/MiscInfoAddressAdd";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
postParms.Add("LocationID",System.Web.HttpUtility.UrlEncode("33950"));
postParms.Add("MiscCode",System.Web.HttpUtility.UrlEncode("CRMS"));
postParms.Add("MiscCodeAppl",System.Web.HttpUtility.UrlEncode("OL"));
postParms.Add("MiscInfoText",System.Web.HttpUtility.UrlEncode("Critical License"));
postParms.Add("MiscInfoDateMM",System.Web.HttpUtility.UrlEncode("7"));
postParms.Add("MiscInfoDateDD",System.Web.HttpUtility.UrlEncode("11"));
postParms.Add("MiscInfoDateYY",System.Web.HttpUtility.UrlEncode("14"));
postParms.Add("SpecialNote",System.Web.HttpUtility.UrlEncode("C"));
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 PostMiscInfoAddressAdd
{
// Add property for each input param in order to map a field to it
[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 MiscCode{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string MiscCodeAppl{get; set;}
[RegularExpression("^(?=.{0,40}$).*", ErrorMessage = "Must be 40 characters or less. ")]
public string MiscInfoText{get; set;}
[RegularExpression("[0-9]{0,2}", ErrorMessage = "Numeric values only. Must be 2 digits or less. ")]
public string MiscInfoDateMM{get; set;}
[RegularExpression("[0-9]{0,2}", ErrorMessage = "Numeric values only. Must be 2 digits or less. ")]
public string MiscInfoDateDD{get; set;}
[RegularExpression("[0-9]{0,2}", ErrorMessage = "Numeric values only. Must be 2 digits or less. ")]
public string MiscInfoDateYY{get; set;}
[RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
public string MiscSeqNo{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string SpecialNote{get; set;}
[RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
public string RecordNo{get; set;}
public PostMiscInfoAddressAdd()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostMiscInfoAddressAdd 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.PostMiscInfoAddressAdd
@{
ViewBag.Title = "PostMiscInfoAddressAdd";
}
<h2>PostMiscInfoAddressAdd</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostMiscInfoAddressAdd</legend>
<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.MiscCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.MiscCode)
@Html.ValidationMessageFor(model => model.MiscCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.MiscCodeAppl)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.MiscCodeAppl)
@Html.ValidationMessageFor(model => model.MiscCodeAppl)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.MiscInfoText)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.MiscInfoText)
@Html.ValidationMessageFor(model => model.MiscInfoText)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.MiscInfoDateMM)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.MiscInfoDateMM)
@Html.ValidationMessageFor(model => model.MiscInfoDateMM)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.MiscInfoDateDD)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.MiscInfoDateDD)
@Html.ValidationMessageFor(model => model.MiscInfoDateDD)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.MiscInfoDateYY)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.MiscInfoDateYY)
@Html.ValidationMessageFor(model => model.MiscInfoDateYY)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.MiscSeqNo)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.MiscSeqNo)
@Html.ValidationMessageFor(model => model.MiscSeqNo)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.SpecialNote)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.SpecialNote)
@Html.ValidationMessageFor(model => model.SpecialNote)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.RecordNo)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.RecordNo)
@Html.ValidationMessageFor(model => model.RecordNo)
</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/PostMiscInfoAddressAdd
public ActionResult PostMiscInfoAddressAdd()
{
// Create a new instance of the model to pick up any default values.
PostMiscInfoAddressAdd model = new PostMiscInfoAddressAdd();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostMiscInfoAddressAdd.cshtml", model);
}
//
// POST: /MyController/PostMiscInfoAddressAdd
[HttpPost]
public ActionResult PostMiscInfoAddressAdd(FormCollection collection)
{
string url = "v2/NaviLine/Land/MiscInfoAddressAdd";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("LocationID", collection["LocationID"]);
inputParms.Add("MiscCode", collection["MiscCode"]);
inputParms.Add("MiscCodeAppl", collection["MiscCodeAppl"]);
inputParms.Add("MiscInfoText", collection["MiscInfoText"]);
inputParms.Add("MiscInfoDateMM", collection["MiscInfoDateMM"]);
inputParms.Add("MiscInfoDateDD", collection["MiscInfoDateDD"]);
inputParms.Add("MiscInfoDateYY", collection["MiscInfoDateYY"]);
inputParms.Add("MiscSeqNo", collection["MiscSeqNo"]);
inputParms.Add("SpecialNote", collection["SpecialNote"]);
inputParms.Add("RecordNo", collection["RecordNo"]);
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", "PostMiscInfoAddressAdd");
return View("Error", info);
}
}