Employee Dependents
Name | Type | Length | Description |
---|---|---|---|
action | System.String | 1 | Action. Defaults to I for inquiry |
oneEmployee | numeric | 9 | Employee ID. Will return all dependents for one employee |
oneDependent | numeric | 9 | Dependent ID. Will return one dependent for an employee |
termYear | numeric | 2 | Termination year. 2-digit year. All employees with a termination of the given year to recent will be returned. Defaults to last three years. |
POST http://localhost/FusionServices/v3/Naviline/Payroll/EmployeeDependents
Name | Description |
---|---|
ErrorCode | Blank=Succes |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Payroll/EmployeeDependents";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("action",System.Web.HttpUtility.UrlEncode("I"));
postParms.Add("oneEmployee",System.Web.HttpUtility.UrlEncode("245781224"));
postParms.Add("oneDependent",System.Web.HttpUtility.UrlEncode(""));
postParms.Add("termYear",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 EmployeeDemographicKey = row["EmployeeDemographicKey"].ToString();
string DependentSocialSecurityNumber = row["DependentSocialSecurityNumber"].ToString();
string LastName = row["LastName"].ToString();
string FirstName = row["FirstName"].ToString();
string MiddleInitial = row["MiddleInitial"].ToString();
string DateOfBirth = row["DateOfBirth"].ToString();
string StreetAddress = row["StreetAddress"].ToString();
string StreetAddressLine2 = row["StreetAddressLine2"].ToString();
string City = row["City"].ToString();
string State = row["State"].ToString();
string ZipCode = row["ZipCode"].ToString();
string AreaCode = row["AreaCode"].ToString();
string PhoneNumber = row["PhoneNumber"].ToString();
string Sex = row["Sex"].ToString();
string FulltimeStudent = row["FulltimeStudent"].ToString();
string UniqueKey = row["UniqueKey"].ToString();
string RelationshipCode = row["RelationshipCode"].ToString();
string Status = row["Status"].ToString();
string SpouseFlag = row["SpouseFlag"].ToString();
string RelationshipCodeDesc = row["RelationshipCodeDesc"].ToString();
string DateofDeath = row["DateofDeath"].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 PostEmployeeDependents
{
// 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-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
public string oneEmployee{get; set;}
[RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
public string oneDependent{get; set;}
[RegularExpression("[0-9]{0,2}", ErrorMessage = "Numeric values only. Must be 2 digits or less. ")]
public string termYear{get; set;}
public PostEmployeeDependents()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostEmployeeDependents 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.PostEmployeeDependents
@{
ViewBag.Title = "PostEmployeeDependents";
}
<h2>PostEmployeeDependents</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostEmployeeDependents</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.oneEmployee)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.oneEmployee)
@Html.ValidationMessageFor(model => model.oneEmployee)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.oneDependent)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.oneDependent)
@Html.ValidationMessageFor(model => model.oneDependent)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.termYear)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.termYear)
@Html.ValidationMessageFor(model => model.termYear)
</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/PostEmployeeDependents
public ActionResult PostEmployeeDependents()
{
// Create a new instance of the model to pick up any default values.
PostEmployeeDependents model = new PostEmployeeDependents();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostEmployeeDependents.cshtml", model);
}
//
// POST: /MyController/PostEmployeeDependents
[HttpPost]
public ActionResult PostEmployeeDependents(FormCollection collection)
{
string url = "v3/Naviline/Payroll/EmployeeDependents";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("action", collection["action"]);
inputParms.Add("oneEmployee", collection["oneEmployee"]);
inputParms.Add("oneDependent", collection["oneDependent"]);
inputParms.Add("termYear", collection["termYear"]);
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", "PostEmployeeDependents");
return View("Error", info);
}
}