Search 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 |
mode | System.String | 1 | [Required] Mode:A – Add new structure;C – Change existing structure |
POST http://localhost/FusionServices/v3/Naviline/EPR/SearchStructInfo
Name | Description |
---|---|
ErrorCode | Error Code |
ErrorMessage | Error Message |
STRDSC | Structure Description |
PWRODTE | Power On Date |
PWROREQ | Power On Date Required |
Error Code | Error Message |
---|---|
0000 | Success |
0001 | Project number not found |
0012 | Structure / Sequence not found |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/EPR/SearchStructInfo";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("projectID",System.Web.HttpUtility.UrlEncode("12345"));
postParms.Add("structureNumber",System.Web.HttpUtility.UrlEncode("000"));
postParms.Add("structureSeqNumber",System.Web.HttpUtility.UrlEncode("100"));
postParms.Add("mode",System.Web.HttpUtility.UrlEncode("A"));
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 ITEMTYPE = row["ITEMTYPE"].ToString();
string ITEMCODE = row["ITEMCODE"].ToString();
string ITEMREQ = row["ITEMREQ"].ToString();
string ITEMDESC = row["ITEMDESC"].ToString();
string ITEMFLDTYP = row["ITEMFLDTYP"].ToString();
string ITEMALPHA = row["ITEMALPHA"].ToString();
string ITEMNUM = row["ITEMNUM"].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 PostSearchStructInfo
{
// 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,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string mode{get; set;}
public PostSearchStructInfo()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostSearchStructInfo 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.PostSearchStructInfo
@{
ViewBag.Title = "PostSearchStructInfo";
}
<h2>PostSearchStructInfo</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostSearchStructInfo</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.mode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.mode)
@Html.ValidationMessageFor(model => model.mode)
</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/PostSearchStructInfo
public ActionResult PostSearchStructInfo()
{
// Create a new instance of the model to pick up any default values.
PostSearchStructInfo model = new PostSearchStructInfo();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostSearchStructInfo.cshtml", model);
}
//
// POST: /MyController/PostSearchStructInfo
[HttpPost]
public ActionResult PostSearchStructInfo(FormCollection collection)
{
string url = "v3/Naviline/EPR/SearchStructInfo";
// 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("mode", collection["mode"]);
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", "PostSearchStructInfo");
return View("Error", info);
}
}