Returns Roll Codes
Name | Type | Length | Description |
---|---|---|---|
searchType | numeric | 1 | 1=Geo based, 2=Non-GEO, 3=Motor Vehicle |
rows | numeric | 4 | Number of rows to return. Defaults to return all rows |
pageNumber | numeric | 5 | Page Number. Used for paging |
POST http://localhost/FusionServices/v3/Naviline/Tax/RollCodes
Name | Description |
---|---|
RollCode | Roll Code |
RollCodeDescription | Roll Code Description |
PageNumber | Page number returned. Used with paging. |
Rows | Number of rows returned |
More?YN | More records Y/N |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Tax/RollCodes";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("searchType",System.Web.HttpUtility.UrlEncode("1"));
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 RollCode = row["RollCode"].ToString();
string RollCodeDescription = row["RollCodeDescription"].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 PostRollCodes
{
// Add property for each input param in order to map a field to it
[RegularExpression("[0-9]{0,1}", ErrorMessage = "Numeric values only. Must be 1 digits or less. ")]
public string searchType{get; set;}
[RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
public string rows{get; set;}
[RegularExpression("[0-9]{0,5}", ErrorMessage = "Numeric values only. Must be 5 digits or less. ")]
public string pageNumber{get; set;}
public PostRollCodes()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostRollCodes 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.PostRollCodes
@{
ViewBag.Title = "PostRollCodes";
}
<h2>PostRollCodes</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostRollCodes</legend>
<div class="editor-label">
@Html.LabelFor(model => model.searchType)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.searchType)
@Html.ValidationMessageFor(model => model.searchType)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.rows)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.rows)
@Html.ValidationMessageFor(model => model.rows)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.pageNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.pageNumber)
@Html.ValidationMessageFor(model => model.pageNumber)
</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/PostRollCodes
public ActionResult PostRollCodes()
{
// Create a new instance of the model to pick up any default values.
PostRollCodes model = new PostRollCodes();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostRollCodes.cshtml", model);
}
//
// POST: /MyController/PostRollCodes
[HttpPost]
public ActionResult PostRollCodes(FormCollection collection)
{
string url = "v3/Naviline/Tax/RollCodes";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("searchType", collection["searchType"]);
inputParms.Add("rows", collection["rows"]);
inputParms.Add("pageNumber", collection["pageNumber"]);
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", "PostRollCodes");
return View("Error", info);
}
}