Method PostEmployeeInquiry

Summary

Employee Inquiry

Remarks

Returns current job position and HR info

Requires

Input Parameters

NameTypeLengthDescription
action System.String 1 Action. Defaults to I for inquiry
ssn System.String 9 Search by employee's social security number
termYear numeric 4 Termination year. All employees with a termination of the given year to recent will be returned. Defaults to last three years.

Example

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

Return Values

NameDescription
ErrorCode Blank=Succes
STATUS Status. A=Active, I=Inactive
EEID Employee ID number
SSN Social Security number
FTPT Full Time / Part Time. F=Full-Time, T=Temp, P=Part-Time
LASTNAME Last name
FIRSTNAME First name
MIDNAME Middle Initial
DOB Date of Birth
GENDER Gender. M/F
MARITALSTATUS Marital Status. D=Divorced, M=Married, S=Single
ADDRESS1 Address line 1
ADDRESS2 Address line 2
ADDRESS2 Address line 2
CITY Address City
STATE Address State
PRZIP Address Zip
PHONE Phone Number
PREMAD Primary Email Address
CONOFFICE
DEPARTMENT Department
JOBTITLE Job Title
SALARY Current Salary
HIREDATE Hire date
POSSTART Current Position start date
BARUNIT
TERMDATE Termination date

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Payroll/EmployeeInquiry";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("action",System.Web.HttpUtility.UrlEncode("I"));
   postParms.Add("ssn",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 STATUS = row["STATUS"].ToString();
             string EEID = row["EEID"].ToString();
             string SSN = row["SSN"].ToString();
             string FTPT = row["FTPT"].ToString();
             string LASTNAME = row["LASTNAME"].ToString();
             string FIRSTNAME = row["FIRSTNAME"].ToString();
             string MIDNAME = row["MIDNAME"].ToString();
             string DOB = row["DOB"].ToString();
             string GENDER = row["GENDER"].ToString();
             string MARITALSTATUS = row["MARITALSTATUS"].ToString();
             string ADDRESS1 = row["ADDRESS1"].ToString();
             string ADDRESS2 = row["ADDRESS2"].ToString();
             string CITY = row["CITY"].ToString();
             string STATE = row["STATE"].ToString();
             string PHONE = row["PHONE"].ToString();
             string PREMAD = row["PREMAD"].ToString();
             string CONOFFICE = row["CONOFFICE"].ToString();
             string DEPARTMENT = row["DEPARTMENT"].ToString();
             string JOBTITLE = row["JOBTITLE"].ToString();
             string SALARY = row["SALARY"].ToString();
             string HIREDATE = row["HIREDATE"].ToString();
             string POSSTART = row["POSSTART"].ToString();
             string BARUNIT = row["BARUNIT"].ToString();
             string TERMDATE = row["TERMDATE"].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 PostEmployeeInquiry
   {
       // 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}$).*", ErrorMessage = "Must be 9 characters or less. ")]
       public string ssn{get; set;}

       [RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
       public string termYear{get; set;}

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

@{
   ViewBag.Title = "PostEmployeeInquiry";
}

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

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

// 
// POST: /MyController/PostEmployeeInquiry
[HttpPost]
public ActionResult PostEmployeeInquiry(FormCollection collection)
{
   string url = "v3/Naviline/Payroll/EmployeeInquiry";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("action", collection["action"]);
   inputParms.Add("ssn", collection["ssn"]);
   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", "PostEmployeeInquiry");
       return View("Error", info);
   }
}