PostUploadMeterRead
Name | Type | Length | Description |
---|---|---|---|
customerId | char | 9 | [Required] 9 digit customer ID |
locationId | char | 9 | [Required] 9 digit Location ID |
serviceCode | char | 2 | [Required] 2 digit service code |
meterNumber | char | 12 | [Required] 12 char meter number |
readYear | char | 2 | [Required] 2 digit year |
readMonth | char | 2 | [Required] 2 digit month |
readDay | char | 2 | [Required] 2 digit day |
meterReaderid | char | 2 | [Required] 2 digit meter reader ID |
readingComponent | char | 4 | [Required] 4 digit reading component |
readerCommentCode | char | 2 | 2 digit reader comment code |
meterSize | char | 4 | [Required] 4 digit meter size |
userID | char | 10 | [Required] 10 char user ID |
meterReading | char | 13 | [Required] 13 char meter reading |
estCode | char | 1 | 1 digit estimate code |
billingPeriod | char | 5 | [Required] 5 digit billing period |
time | char | 6 | [Required] 6 digit time |
readType | char | 1 | [Required] 1 digit Read Type: Regular Read = ‘R’;Final Read = ‘F’;Out Read = ‘O’;Set Read = ‘S’;Initial Read = ‘I’; |
warehouse | char | 2 | 2 digit warehouse code |
serviceSequence | char | 3 | [Required] Service Sequence number |
POST http://localhost/FusionServices/v3/Naviline/Utilities/UploadMeterRead
Name | Description |
---|---|
ErrorCode | 0000=Success |
ErrorMessage | Description of error if any |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/UploadMeterRead";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("customerId",System.Web.HttpUtility.UrlEncode("000008665"));
postParms.Add("locationId",System.Web.HttpUtility.UrlEncode("000035710"));
postParms.Add("serviceCode",System.Web.HttpUtility.UrlEncode("WA"));
postParms.Add("meterNumber",System.Web.HttpUtility.UrlEncode("2730"));
postParms.Add("readYear",System.Web.HttpUtility.UrlEncode("21"));
postParms.Add("readMonth",System.Web.HttpUtility.UrlEncode("02"));
postParms.Add("readDay",System.Web.HttpUtility.UrlEncode("08"));
postParms.Add("meterReaderid",System.Web.HttpUtility.UrlEncode("ED"));
postParms.Add("readingComponent",System.Web.HttpUtility.UrlEncode("TEN"));
postParms.Add("readerCommentCode",System.Web.HttpUtility.UrlEncode(""));
postParms.Add("meterSize",System.Web.HttpUtility.UrlEncode("075"));
postParms.Add("userID",System.Web.HttpUtility.UrlEncode("FAITH"));
postParms.Add("meterReading",System.Web.HttpUtility.UrlEncode("0000000901293"));
postParms.Add("estCode",System.Web.HttpUtility.UrlEncode(""));
postParms.Add("billingPeriod",System.Web.HttpUtility.UrlEncode("12102"));
postParms.Add("time",System.Web.HttpUtility.UrlEncode("100000"));
postParms.Add("readType",System.Web.HttpUtility.UrlEncode("R"));
postParms.Add("serviceSequence", System.Web.HttpUtility.UrlEncode("001"));
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 PostUploadMeterRead
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string customerId{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string locationId{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string serviceCode{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,12}$).*", ErrorMessage = "Must be 12 characters or less. ")]
public string meterNumber{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string readYear{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string readMonth{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string readDay{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string meterReaderid{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
public string readingComponent{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string readerCommentCode{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
public string meterSize{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,10}$).*", ErrorMessage = "Must be 10 characters or less. ")]
public string userID{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,13}$).*", ErrorMessage = "Must be 13 characters or less. ")]
public string meterReading{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string estCode{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,5}$).*", ErrorMessage = "Must be 5 characters or less. ")]
public string billingPeriod{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
public string time{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string readType{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string warehouse{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,3}$).*", ErrorMessage = "Must be 3 characters or less. ")]
public string serviceSequence{get; set;}
public PostUploadMeterRead()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostUploadMeterRead 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.PostUploadMeterRead
@{
ViewBag.Title = "PostUploadMeterRead";
}
<h2>PostUploadMeterRead</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostUploadMeterRead</legend>
<div class="editor-label">
@Html.LabelFor(model => model.customerId)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.customerId)
@Html.ValidationMessageFor(model => model.customerId)
</div>
<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.serviceCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.serviceCode)
@Html.ValidationMessageFor(model => model.serviceCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.meterNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.meterNumber)
@Html.ValidationMessageFor(model => model.meterNumber)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.readYear)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.readYear)
@Html.ValidationMessageFor(model => model.readYear)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.readMonth)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.readMonth)
@Html.ValidationMessageFor(model => model.readMonth)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.readDay)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.readDay)
@Html.ValidationMessageFor(model => model.readDay)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.meterReaderid)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.meterReaderid)
@Html.ValidationMessageFor(model => model.meterReaderid)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.readingComponent)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.readingComponent)
@Html.ValidationMessageFor(model => model.readingComponent)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.readerCommentCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.readerCommentCode)
@Html.ValidationMessageFor(model => model.readerCommentCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.meterSize)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.meterSize)
@Html.ValidationMessageFor(model => model.meterSize)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.userID)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.userID)
@Html.ValidationMessageFor(model => model.userID)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.meterReading)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.meterReading)
@Html.ValidationMessageFor(model => model.meterReading)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.estCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.estCode)
@Html.ValidationMessageFor(model => model.estCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.billingPeriod)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.billingPeriod)
@Html.ValidationMessageFor(model => model.billingPeriod)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.time)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.time)
@Html.ValidationMessageFor(model => model.time)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.readType)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.readType)
@Html.ValidationMessageFor(model => model.readType)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.warehouse)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.warehouse)
@Html.ValidationMessageFor(model => model.warehouse)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.serviceSequence)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.serviceSequence)
@Html.ValidationMessageFor(model => model.serviceSequence)
</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/PostUploadMeterRead
public ActionResult PostUploadMeterRead()
{
// Create a new instance of the model to pick up any default values.
PostUploadMeterRead model = new PostUploadMeterRead();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostUploadMeterRead.cshtml", model);
}
//
// POST: /MyController/PostUploadMeterRead
[HttpPost]
public ActionResult PostUploadMeterRead(FormCollection collection)
{
string url = "v3/Naviline/Utilities/UploadMeterRead";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("customerId", collection["customerId"]);
inputParms.Add("locationId", collection["locationId"]);
inputParms.Add("serviceCode", collection["serviceCode"]);
inputParms.Add("meterNumber", collection["meterNumber"]);
inputParms.Add("readYear", collection["readYear"]);
inputParms.Add("readMonth", collection["readMonth"]);
inputParms.Add("readDay", collection["readDay"]);
inputParms.Add("meterReaderid", collection["meterReaderid"]);
inputParms.Add("readingComponent", collection["readingComponent"]);
inputParms.Add("readerCommentCode", collection["readerCommentCode"]);
inputParms.Add("meterSize", collection["meterSize"]);
inputParms.Add("userID", collection["userID"]);
inputParms.Add("meterReading", collection["meterReading"]);
inputParms.Add("estCode", collection["estCode"]);
inputParms.Add("billingPeriod", collection["billingPeriod"]);
inputParms.Add("time", collection["time"]);
inputParms.Add("readType", collection["readType"]);
inputParms.Add("warehouse", collection["warehouse"]);
inputParms.Add("serviceSequence", collection["serviceSequence"]);
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", "PostUploadMeterRead");
return View("Error", info);
}
}