Method PostSvcOrderSync

Summary

Service Order Sync - Provides the ability to retrieve CIS (CX) Utilities Active Service Order Information. A full sync or an incremental sync request is provided. The incremental request will send all Add, Change and Delete information since the last sync request.

Remarks

Service order synchronization – Active Service order types:, HL = HELD, HD = HELD FOR DEPOSIT, II = INFORMATION INCOMPLETE, PC = PENDING COMPLETION, PP = PENDING PRINT, PR = PENDING REPRINT

Requires

Input Parameters

NameTypeLengthDescription
syncType System.String 1 [Required] A full sync will require an ‘A’ in the syncType field and an ‘I’ for an incremental sync request.

Example

POST http://localhost/FusionServices/v3/Naviline/Utilities/SvcOrderSync

Return Values

NameDescription
ErrorCode 0090
ErrorMessage Success, no records found
WorkOrderNumber 000557
WorkOrderStatus PC
WorkOrderType CV
IssueDateMonth 10
IssueDateDay 23
IssueDateYear 09
IssueTime 072815
IssueUserID QSRW
CustomerID 000021765
LocationID 000039526
Service WA
SectionCode DOWN
WOSiteCode
WOSiteDescription
WOSchedCode R
MeterSize
RequestDateMonth 10
RequestDateDay 23
RequestDateYear 09
CompletionDateMonth 00
CompletionDateDay 00
CompletionDateYear 00
WOCompletionType WM
WOActionTaken
MiscChargeGenerated
CompletionUserID
ServiceSequence 000
MeterNumber 77170779
WOCrewCode
IssueDateCentury 1
RequestDateCentury 1
CompletionDateCentury 0
WOCommentSequence
WOComments
WONumericComment
WOCommentLocation
WOCommentSequence
WOCommentCode
ChangeType Full
MeterLocation
FutureUse

Sample Responses

Sample Code

using System.Net;
using Newtonsoft.Json.Linq;

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/SvcOrderSync";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("syncType",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 WorkOrderNumber = row["WorkOrderNumber"].ToString();
             string WorkOrderStatus = row["WorkOrderStatus"].ToString();
             string WorkOrderType = row["WorkOrderType"].ToString();
             string IssueDateMonth = row["IssueDateMonth"].ToString();
             string IssueDateDay = row["IssueDateDay"].ToString();
             string IssueDateYear = row["IssueDateYear"].ToString();
             string IssueTime = row["IssueTime"].ToString();
             string IssueUserID = row["IssueUserID"].ToString();
             string CustomerID = row["CustomerID"].ToString();
             string LocationID = row["LocationID"].ToString();
             string Service = row["Service"].ToString();
             string SectionCode = row["SectionCode"].ToString();
             string WOSiteCode = row["WOSiteCode"].ToString();
             string WOSiteDescription = row["WOSiteDescription"].ToString();
             string WOSchedCode = row["WOSchedCode"].ToString();
             string MeterSize = row["MeterSize"].ToString();
             string RequestDateMonth = row["RequestDateMonth"].ToString();
             string RequestDateDay = row["RequestDateDay"].ToString();
             string RequestDateYear = row["RequestDateYear"].ToString();
             string CompletionDateMonth = row["CompletionDateMonth"].ToString();
             string CompletionDateDay = row["CompletionDateDay"].ToString();
             string CompletionDateYear = row["CompletionDateYear"].ToString();
             string WOCompletionType = row["WOCompletionType"].ToString();
             string WOActionTaken = row["WOActionTaken"].ToString();
             string MiscChargeGenerated = row["MiscChargeGenerated"].ToString();
             string CompletionUserID = row["CompletionUserID"].ToString();
             string ServiceSequence = row["ServiceSequence"].ToString();
             string MeterNumber = row["MeterNumber"].ToString();
             string WOCrewCode = row["WOCrewCode"].ToString();
             string IssueDateCentury = row["IssueDateCentury"].ToString();
             string RequestDateCentury = row["RequestDateCentury"].ToString();
             string CompletionDateCentury = row["CompletionDateCentury"].ToString();
             string WOCommentSequence = row["WOCommentSequence"].ToString();
             string WOComments = row["WOComments"].ToString();
             string WONumericComment = row["WONumericComment"].ToString();
             string WOCommentLocation = row["WOCommentLocation"].ToString();
             string WOCommentSequence = row["WOCommentSequence"].ToString();
             string WOCommentCode = row["WOCommentCode"].ToString();
             string ChangeType = row["ChangeType"].ToString();
             string MeterLocation = row["MeterLocation"].ToString();
             string FutureUse = row["FutureUse"].ToString();
             // TODO - YOUR CODE HERE
        }
   }
}

C# Razor MVC Sample Code

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 PostSvcOrderSync
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
       public string syncType{get; set;}

       public PostSvcOrderSync()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostSvcOrderSync 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.PostSvcOrderSync

@{
   ViewBag.Title = "PostSvcOrderSync";
}

<h2>PostSvcOrderSync</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostSvcOrderSync</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.syncType)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.syncType)
           @Html.ValidationMessageFor(model => model.syncType)
       </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/PostSvcOrderSync
public ActionResult PostSvcOrderSync()
{
   // Create a new instance of the model to pick up any default values.
   PostSvcOrderSync model =  new PostSvcOrderSync();

   // pass model to set to default values
   // NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
   return View("~/Views/MyFolderPath/PostSvcOrderSync.cshtml", model);
}

// 
// POST: /MyController/PostSvcOrderSync
[HttpPost]
public ActionResult PostSvcOrderSync(FormCollection collection)
{
   string url = "v3/Naviline/Utilities/SvcOrderSync";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("syncType", collection["syncType"]);

   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", "PostSvcOrderSync");
       return View("Error", info);
   }
}