Update Structure Information
Name | Type | Length | Description |
---|---|---|---|
projectID | System.String | 20 | [Required] Project ID |
structureNumber | System.String | 3 | [Required] Structure Number |
structureSeqNumber | System.String | 3 | [Required] Structure Sequence Number |
structureDesc | System.String | 40 | [Required] Structure Description |
powerOnDate | System.String | 8 | [Required] Power on Date (CCYYMMDD) |
mode | System.String | 1 | [Required] Mode (A-add / C-change) |
itemType | System.String | 1 | [Required] Item type (1-system code / 2-user-defined code) |
itemID | System.String | 4 | [Required] Item ID |
codeData | System.String | 15 | [Required] Result field – Alphabetic |
codeNumber | System.String | 9 | [Required] Result field - Numeric |
POST http://localhost/FusionServices/v3/Naviline/EPR/UpdateStructInfo
Name | Description |
---|---|
ErrorCode | Error Code |
ErrorMessage | Error Message |
Error Code | Error Message |
---|---|
0000 | Success |
0001 | Project number not found |
0002 | Application year and number not found |
0016 | Structure add requested but str nbr/seq already exists |
0017 | Structure add requested but str nbr/seq already exists |
0018 | Invalid power on date |
0019 | Invalid structure line item entry |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/EPR/UpdateStructInfo";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("projectID",System.Web.HttpUtility.UrlEncode("2200198"));
postParms.Add("structureNumber",System.Web.HttpUtility.UrlEncode("000"));
postParms.Add("structureSeqNumber",System.Web.HttpUtility.UrlEncode("100"));
postParms.Add("structureDesc",System.Web.HttpUtility.UrlEncode("Faith Test"));
postParms.Add("powerOnDate",System.Web.HttpUtility.UrlEncode("20221012"));
postParms.Add("mode",System.Web.HttpUtility.UrlEncode("A"));
postParms.Add("itemType",System.Web.HttpUtility.UrlEncode("1"));
postParms.Add("ItemID",System.Web.HttpUtility.UrlEncode("CT"));
postParms.Add("codeData",System.Web.HttpUtility.UrlEncode("10"));
postParms.Add("codeNumber",System.Web.HttpUtility.UrlEncode("0"));
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")
{
// 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 PostUpdateStructInfo
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,20}$).*", ErrorMessage = "Must be 20 characters or less. ")]
public string projectID{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,3}$).*", ErrorMessage = "Must be 3 characters or less. ")]
public string structureNumber{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,3}$).*", ErrorMessage = "Must be 3 characters or less. ")]
public string structureSeqNumber{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,40}$).*", ErrorMessage = "Must be 40 characters or less. ")]
public string structureDesc{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,8}$).*", ErrorMessage = "Must be 8 characters or less. ")]
public string powerOnDate{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string mode{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string itemType{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
public string itemID{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,15}$).*", ErrorMessage = "Must be 15 characters or less. ")]
public string codeData{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string codeNumber{get; set;}
public PostUpdateStructInfo()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostUpdateStructInfo 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.PostUpdateStructInfo
@{
ViewBag.Title = "PostUpdateStructInfo";
}
<h2>PostUpdateStructInfo</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostUpdateStructInfo</legend>
<div class="editor-label">
@Html.LabelFor(model => model.projectID)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.projectID)
@Html.ValidationMessageFor(model => model.projectID)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.structureNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.structureNumber)
@Html.ValidationMessageFor(model => model.structureNumber)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.structureSeqNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.structureSeqNumber)
@Html.ValidationMessageFor(model => model.structureSeqNumber)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.structureDesc)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.structureDesc)
@Html.ValidationMessageFor(model => model.structureDesc)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.powerOnDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.powerOnDate)
@Html.ValidationMessageFor(model => model.powerOnDate)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.mode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.mode)
@Html.ValidationMessageFor(model => model.mode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.itemType)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.itemType)
@Html.ValidationMessageFor(model => model.itemType)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.itemID)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.itemID)
@Html.ValidationMessageFor(model => model.itemID)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.codeData)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.codeData)
@Html.ValidationMessageFor(model => model.codeData)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.codeNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.codeNumber)
@Html.ValidationMessageFor(model => model.codeNumber)
</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/PostUpdateStructInfo
public ActionResult PostUpdateStructInfo()
{
// Create a new instance of the model to pick up any default values.
PostUpdateStructInfo model = new PostUpdateStructInfo();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostUpdateStructInfo.cshtml", model);
}
//
// POST: /MyController/PostUpdateStructInfo
[HttpPost]
public ActionResult PostUpdateStructInfo(FormCollection collection)
{
string url = "v3/Naviline/EPR/UpdateStructInfo";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("projectID", collection["projectID"]);
inputParms.Add("structureNumber", collection["structureNumber"]);
inputParms.Add("structureSeqNumber", collection["structureSeqNumber"]);
inputParms.Add("structureDesc", collection["structureDesc"]);
inputParms.Add("powerOnDate", collection["powerOnDate"]);
inputParms.Add("mode", collection["mode"]);
inputParms.Add("itemType", collection["itemType"]);
inputParms.Add("itemID", collection["itemID"]);
inputParms.Add("codeData", collection["codeData"]);
inputParms.Add("codeNumber", collection["codeNumber"]);
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", "PostUpdateStructInfo");
return View("Error", info);
}
}