Method PostOpenEnrollmentCategorySetup

Summary

Open Enrollment Category Setup

Requires

Input Parameters

NameTypeLengthDescription
action System.String 1 Action. Defaults to I for inquiry
category System.String 1 Exclude Inactive Categories. Defaults to blank to include. Y=Exclude
code System.String 1 Exclude Inactive Codes. Defaults to blank to include. Y=Exclude

Example

POST http://localhost/FusionServices/v3/Naviline/Payroll/OpenEnrollmentCategorySetup

Return Values

NameDescription
ErrorCode 0000=Succes
CategoryCode Code for category
CategoryDescription Description for category
InactiveCategory Indicates if category is inactive. I=Inactive
CodeType Category code type: ADD=Additional Pay, ABT=Adjustment Before Tax, DED=Deduction, BEN=Benefit
Code Code for category option
CodeDescription Description for category option
InactiveCode Indicates if code is inactive. I=Inactive
Amount Amount taken from paycheck
Percentage Percentage taken from paycheck

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Payroll/OpenEnrollmentCategorySetup";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("action",System.Web.HttpUtility.UrlEncode("I"));
   postParms.Add("category",System.Web.HttpUtility.UrlEncode(""));
   postParms.Add("code",System.Web.HttpUtility.UrlEncode(""));

   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 CategoryCode = row["CategoryCode"].ToString();
             string CategoryDescription = row["CategoryDescription"].ToString();
             string InactiveCategory = row["InactiveCategory"].ToString();
             string CodeType = row["CodeType"].ToString();
             string Code = row["Code"].ToString();
             string CodeDescription = row["CodeDescription"].ToString();
             string InactiveCode = row["InactiveCode"].ToString();
             string Amount = row["Amount"].ToString();
             string Percentage = row["Percentage"].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 PostOpenEnrollmentCategorySetup
   {
       // Add property for each input param in order to map a field to it
       [RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
       public string action{get; set;}

       [RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
       public string category{get; set;}

       [RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
       public string code{get; set;}

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

@{
   ViewBag.Title = "PostOpenEnrollmentCategorySetup";
}

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

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

// 
// POST: /MyController/PostOpenEnrollmentCategorySetup
[HttpPost]
public ActionResult PostOpenEnrollmentCategorySetup(FormCollection collection)
{
   string url = "v3/Naviline/Payroll/OpenEnrollmentCategorySetup";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("action", collection["action"]);
   inputParms.Add("category", collection["category"]);
   inputParms.Add("code", collection["code"]);

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