Set License Review Comments
Name | Type | Length | Description |
---|---|---|---|
inspectionNumber | numeric | 9 | [Required] Inspection Number |
reviewDate | mmddyy | 6 | Inspection Date. Format=MMddyy Defaults to current date. |
appCode | System.String | 1 | Result code. A=Approved, D=Disapproved, W=Waived, H=OnHold, Blank=LeaveOpen |
comment | System.String | 6000 | Comment text. |
POST http://localhost/FusionServices/v2/Naviline/OccupationalLicense/LicenseReviewComments
Name | Description |
---|---|
ErrorCode | 0000=Success |
ErrorMessage | Message returned with error code |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v2/Naviline/OccupationalLicense/LicenseReviewComments";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("inspectionNumber",System.Web.HttpUtility.UrlEncode("256"));
postParms.Add("appCode",System.Web.HttpUtility.UrlEncode("A"));
postParms.Add("comment",System.Web.HttpUtility.UrlEncode("Enter the comment text for the inspection. It can be up to 6000 chars, treated as a text stream. "));
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 PostLicenseReviewComments
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
public string inspectionNumber{get; set;}
[RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
public string reviewDate{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string appCode{get; set;}
[RegularExpression("^(?=.{0,6000}$).*", ErrorMessage = "Must be 6000 characters or less. ")]
public string comment{get; set;}
public PostLicenseReviewComments()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostLicenseReviewComments 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.PostLicenseReviewComments
@{
ViewBag.Title = "PostLicenseReviewComments";
}
<h2>PostLicenseReviewComments</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostLicenseReviewComments</legend>
<div class="editor-label">
@Html.LabelFor(model => model.inspectionNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.inspectionNumber)
@Html.ValidationMessageFor(model => model.inspectionNumber)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.reviewDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.reviewDate)
@Html.ValidationMessageFor(model => model.reviewDate)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.appCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.appCode)
@Html.ValidationMessageFor(model => model.appCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.comment)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.comment)
@Html.ValidationMessageFor(model => model.comment)
</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/PostLicenseReviewComments
public ActionResult PostLicenseReviewComments()
{
// Create a new instance of the model to pick up any default values.
PostLicenseReviewComments model = new PostLicenseReviewComments();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostLicenseReviewComments.cshtml", model);
}
//
// POST: /MyController/PostLicenseReviewComments
[HttpPost]
public ActionResult PostLicenseReviewComments(FormCollection collection)
{
string url = "v2/Naviline/OccupationalLicense/LicenseReviewComments";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("inspectionNumber", collection["inspectionNumber"]);
inputParms.Add("reviewDate", collection["reviewDate"]);
inputParms.Add("appCode", collection["appCode"]);
inputParms.Add("comment", collection["comment"]);
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", "PostLicenseReviewComments");
return View("Error", info);
}
}