Method PostOpenEnrollment

Summary

Open Enrollment

Remarks

Submit open enrollment elections for an employee.

Elections can be submitted for: Additional Pay, Adjustment Before Tax, Deduction, and Benefit.

For each, enter either a fixed amount or a percentage to be paid.

Requires

Input Parameters

NameTypeLengthDescription
action System.String 1 Action. Defaults to A=Add
clearFlag System.String 1 Clear Table. Set to Y on initial call to clear out ALL existing rows in the open enrollment table
employeeKey numneric 11 [Required] Employee ID number
categoryCode System.String 4 [Required] Category code from GetCategoryCodes
addlPayCode System.String 2 Additional Pay Code
addlPayAmount dollar 10 Additional Pay Amount. Example: Send $12.34 as 12.34
addlPayPercent decimal 10 Additional Pay Percent. Example: Send 1.125% as 1.125
abtCode System.String 2 Adjustment Before Tax Code
abtAmount dollar 10 Adjustment Before Tax Amount. Example: Send $12.34 as 12.34
abtPercent decimal 10 Adjustment Before Tax Percent. Example: Send 1.125% as 1.125
dedCode System.String 2 Deduction Code
dedAmount dollar 10 Deduction Amount. Example: Send $12.34 as 12.34
dedPercent decimal 10 Deduction Percent. Example: Send 1.125% as 1.125
benCode System.String 2 Benefit Code
benAmount dollar 10 Benefit Amount. Example: Send $12.34 as 12.34
benPercent decimal 10 Benefit Percent. Example: Send 1.125% as 1.125
flatGTLICoverage decimal 10 Flat GTLI Coverage Amount. Example: Send $12.34 as 12.34

Example

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

Return Values

NameDescription
ErrorCode 0000=Succes

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Payroll/OpenEnrollment";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("clearFlag",System.Web.HttpUtility.UrlEncode(""));
   postParms.Add("employeeKey",System.Web.HttpUtility.UrlEncode("07070525200"));
   postParms.Add("categoryCode",System.Web.HttpUtility.UrlEncode("MED"));
   postParms.Add("addlPayCode",System.Web.HttpUtility.UrlEncode("AS"));
   postParms.Add("addlPayAmount",System.Web.HttpUtility.UrlEncode("12.25"));
   postParms.Add("abtCode",System.Web.HttpUtility.UrlEncode("SG"));
   postParms.Add("abtAmount",System.Web.HttpUtility.UrlEncode("23.31"));
   postParms.Add("dedCode",System.Web.HttpUtility.UrlEncode("BR"));
   postParms.Add("dedAmount",System.Web.HttpUtility.UrlEncode("46.01"));
   postParms.Add("benCode",System.Web.HttpUtility.UrlEncode("AE"));
   postParms.Add("benPercent",System.Web.HttpUtility.UrlEncode("13.000"));

   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
   }
}

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 PostOpenEnrollment
   {
       // 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 clearFlag{get; set;}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@{
   ViewBag.Title = "PostOpenEnrollment";
}

<h2>PostOpenEnrollment</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostOpenEnrollment</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.clearFlag)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.clearFlag)
           @Html.ValidationMessageFor(model => model.clearFlag)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.employeeKey)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.employeeKey)
           @Html.ValidationMessageFor(model => model.employeeKey)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.categoryCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.categoryCode)
           @Html.ValidationMessageFor(model => model.categoryCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.addlPayCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.addlPayCode)
           @Html.ValidationMessageFor(model => model.addlPayCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.addlPayAmount)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.addlPayAmount)
           @Html.ValidationMessageFor(model => model.addlPayAmount)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.addlPayPercent)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.addlPayPercent)
           @Html.ValidationMessageFor(model => model.addlPayPercent)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.abtCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.abtCode)
           @Html.ValidationMessageFor(model => model.abtCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.abtAmount)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.abtAmount)
           @Html.ValidationMessageFor(model => model.abtAmount)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.abtPercent)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.abtPercent)
           @Html.ValidationMessageFor(model => model.abtPercent)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.dedCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.dedCode)
           @Html.ValidationMessageFor(model => model.dedCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.dedAmount)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.dedAmount)
           @Html.ValidationMessageFor(model => model.dedAmount)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.dedPercent)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.dedPercent)
           @Html.ValidationMessageFor(model => model.dedPercent)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.benCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.benCode)
           @Html.ValidationMessageFor(model => model.benCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.benAmount)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.benAmount)
           @Html.ValidationMessageFor(model => model.benAmount)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.benPercent)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.benPercent)
           @Html.ValidationMessageFor(model => model.benPercent)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.flatGTLICoverage)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.flatGTLICoverage)
           @Html.ValidationMessageFor(model => model.flatGTLICoverage)
       </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/PostOpenEnrollment
public ActionResult PostOpenEnrollment()
{
   // Create a new instance of the model to pick up any default values.
   PostOpenEnrollment model =  new PostOpenEnrollment();

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

// 
// POST: /MyController/PostOpenEnrollment
[HttpPost]
public ActionResult PostOpenEnrollment(FormCollection collection)
{
   string url = "v3/Naviline/Payroll/OpenEnrollment";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("action", collection["action"]);
   inputParms.Add("clearFlag", collection["clearFlag"]);
   inputParms.Add("employeeKey", collection["employeeKey"]);
   inputParms.Add("categoryCode", collection["categoryCode"]);
   inputParms.Add("addlPayCode", collection["addlPayCode"]);
   inputParms.Add("addlPayAmount", collection["addlPayAmount"]);
   inputParms.Add("addlPayPercent", collection["addlPayPercent"]);
   inputParms.Add("abtCode", collection["abtCode"]);
   inputParms.Add("abtAmount", collection["abtAmount"]);
   inputParms.Add("abtPercent", collection["abtPercent"]);
   inputParms.Add("dedCode", collection["dedCode"]);
   inputParms.Add("dedAmount", collection["dedAmount"]);
   inputParms.Add("dedPercent", collection["dedPercent"]);
   inputParms.Add("benCode", collection["benCode"]);
   inputParms.Add("benAmount", collection["benAmount"]);
   inputParms.Add("benPercent", collection["benPercent"]);
   inputParms.Add("flatGTLICoverage", collection["flatGTLICoverage"]);

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