Service Order Update - Update Service Order Status and/or Action Taken and Completion Date.
Name | Type | Length | Description |
---|---|---|---|
issueDate | System.String | 7 | [Required] Issue date in CYYMMDD Format |
workOrderNumber | System.String | 6 | [Required] Work Order Number |
workOrderStatus | System.String | 2 | Work Order Status |
completionAction | System.String | 4 | Completion Action |
completionDate | System.String | 1 | Completion Date in CYYMMDD Format - required if comopletionAction is entered |
POST http://localhost/FusionServices/v3/Naviline/Utilities/SvcOrderUpdate
Name | Description |
---|---|
ErrorCode | 0003 |
ErrorMessage | Status is complete or canceled no action taken. |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/SvcOrderUpdate";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("issueDate",System.Web.HttpUtility.UrlEncode("1140521"));
postParms.Add("workOrderNumber",System.Web.HttpUtility.UrlEncode("1038"));
postParms.Add("completionAction",System.Web.HttpUtility.UrlEncode("REPR"));
postParms.Add("completionDate",System.Web.HttpUtility.UrlEncode("1220510"));
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 PostSvcOrderUpdate
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,7}$).*", ErrorMessage = "Must be 7 characters or less. ")]
public string issueDate{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
public string workOrderNumber{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string workOrderStatus{get; set;}
[RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
public string completionAction{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string completionDate{get; set;}
public PostSvcOrderUpdate()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostSvcOrderUpdate 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.PostSvcOrderUpdate
@{
ViewBag.Title = "PostSvcOrderUpdate";
}
<h2>PostSvcOrderUpdate</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostSvcOrderUpdate</legend>
<div class="editor-label">
@Html.LabelFor(model => model.issueDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.issueDate)
@Html.ValidationMessageFor(model => model.issueDate)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.workOrderNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.workOrderNumber)
@Html.ValidationMessageFor(model => model.workOrderNumber)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.workOrderStatus)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.workOrderStatus)
@Html.ValidationMessageFor(model => model.workOrderStatus)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.completionAction)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.completionAction)
@Html.ValidationMessageFor(model => model.completionAction)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.completionDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.completionDate)
@Html.ValidationMessageFor(model => model.completionDate)
</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/PostSvcOrderUpdate
public ActionResult PostSvcOrderUpdate()
{
// Create a new instance of the model to pick up any default values.
PostSvcOrderUpdate model = new PostSvcOrderUpdate();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostSvcOrderUpdate.cshtml", model);
}
//
// POST: /MyController/PostSvcOrderUpdate
[HttpPost]
public ActionResult PostSvcOrderUpdate(FormCollection collection)
{
string url = "v3/Naviline/Utilities/SvcOrderUpdate";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("issueDate", collection["issueDate"]);
inputParms.Add("workOrderNumber", collection["workOrderNumber"]);
inputParms.Add("workOrderStatus", collection["workOrderStatus"]);
inputParms.Add("completionAction", collection["completionAction"]);
inputParms.Add("completionDate", collection["completionDate"]);
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", "PostSvcOrderUpdate");
return View("Error", info);
}
}