Add, Update or Delete Employee Dependent
Name | Type | Length | Description |
---|---|---|---|
action | System.String | 1 | [Required] Action. I=Inquiry, A=Add, C=Change, D=Delete. |
demographicKey | System.String | 9 | [Required] Demographic key. Employee ID |
dependentKey | numeric | 9 | Dependent unique key. Will be generated when added |
depSSN | System.String | 9 | Dependent Social Security Number |
depLast | System.String | 16 | [Required] Dependent last name |
depFirst | System.String | 11 | [Required] Dependent first name |
depMiddle | System.String | 1 | Dependent middle initial |
depBirthDate | yyyymmdd | 0 | [Required] Dependent's birth date. Format=yyyyMMdd |
depAddr | System.String | 25 | Dependent address line 1. If different than employee's address |
depAddr2 | System.String | 25 | Dependent address line 2. If different than employee's address |
depCity | System.String | 20 | Dependent city. If different than employee's address |
depState | System.String | 2 | Dependent state. 2 char abbreviation. If different than employee's address |
depZip | System.String | 9 | Dependent zip code. If different than employee's address |
depPhone | numeric | 10 | 10 digit phone number |
depSex | System.String | 1 | Sex. M\F. Required on Add and Update. |
student | System.String | 1 | Dependent is a Student. Y\N. |
relCode | System.String | 2 | [Required] Relationship code |
dateOfDeath | yyyymmdd | 0 | Dependent's date of death. Format=yyyyMMdd |
status | System.String | 1 | Status. Blank=Active, I=Inactive |
spouseFlag | System.String | 1 | Dependent is employee spouse. Y\N. |
POST http://localhost/FusionServices/v3/Naviline/Payroll/EmployeeDependentUpdate
Name | Description |
---|---|
ErrorCode | 0000=Succes |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Payroll/EmployeeDependentUpdate";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("action",System.Web.HttpUtility.UrlEncode("A"));
postParms.Add("demographicKey",System.Web.HttpUtility.UrlEncode("006562358"));
postParms.Add("dependentKey",System.Web.HttpUtility.UrlEncode(""));
postParms.Add("depFirst",System.Web.HttpUtility.UrlEncode("NEWKID"));
postParms.Add("depLast",System.Web.HttpUtility.UrlEncode("BURBANK"));
postParms.Add("depSex",System.Web.HttpUtility.UrlEncode("F"));
postParms.Add("relCode",System.Web.HttpUtility.UrlEncode("D"));
postParms.Add("depBirthDate",System.Web.HttpUtility.UrlEncode("19910115"));
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
}
}
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 PostEmployeeDependentUpdate
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string action{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string demographicKey{get; set;}
[RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
public string dependentKey{get; set;}
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string depSSN{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,16}$).*", ErrorMessage = "Must be 16 characters or less. ")]
public string depLast{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,11}$).*", ErrorMessage = "Must be 11 characters or less. ")]
public string depFirst{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string depMiddle{get; set;}
[Required(ErrorMessage = "Required")]
public string depBirthDate{get; set;}
[RegularExpression("^(?=.{0,25}$).*", ErrorMessage = "Must be 25 characters or less. ")]
public string depAddr{get; set;}
[RegularExpression("^(?=.{0,25}$).*", ErrorMessage = "Must be 25 characters or less. ")]
public string depAddr2{get; set;}
[RegularExpression("^(?=.{0,20}$).*", ErrorMessage = "Must be 20 characters or less. ")]
public string depCity{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string depState{get; set;}
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string depZip{get; set;}
[RegularExpression("[0-9]{0,10}", ErrorMessage = "Numeric values only. Must be 10 digits or less. ")]
public string depPhone{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string depSex{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string student{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string relCode{get; set;}
public string dateOfDeath{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string status{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string spouseFlag{get; set;}
public PostEmployeeDependentUpdate()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostEmployeeDependentUpdate 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.PostEmployeeDependentUpdate
@{
ViewBag.Title = "PostEmployeeDependentUpdate";
}
<h2>PostEmployeeDependentUpdate</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostEmployeeDependentUpdate</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.demographicKey)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.demographicKey)
@Html.ValidationMessageFor(model => model.demographicKey)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.dependentKey)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.dependentKey)
@Html.ValidationMessageFor(model => model.dependentKey)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depSSN)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depSSN)
@Html.ValidationMessageFor(model => model.depSSN)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depLast)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depLast)
@Html.ValidationMessageFor(model => model.depLast)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depFirst)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depFirst)
@Html.ValidationMessageFor(model => model.depFirst)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depMiddle)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depMiddle)
@Html.ValidationMessageFor(model => model.depMiddle)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depBirthDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depBirthDate)
@Html.ValidationMessageFor(model => model.depBirthDate)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depAddr)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depAddr)
@Html.ValidationMessageFor(model => model.depAddr)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depAddr2)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depAddr2)
@Html.ValidationMessageFor(model => model.depAddr2)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depCity)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depCity)
@Html.ValidationMessageFor(model => model.depCity)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depState)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depState)
@Html.ValidationMessageFor(model => model.depState)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depZip)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depZip)
@Html.ValidationMessageFor(model => model.depZip)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depPhone)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depPhone)
@Html.ValidationMessageFor(model => model.depPhone)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.depSex)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.depSex)
@Html.ValidationMessageFor(model => model.depSex)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.student)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.student)
@Html.ValidationMessageFor(model => model.student)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.relCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.relCode)
@Html.ValidationMessageFor(model => model.relCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.dateOfDeath)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.dateOfDeath)
@Html.ValidationMessageFor(model => model.dateOfDeath)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.status)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.status)
@Html.ValidationMessageFor(model => model.status)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.spouseFlag)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.spouseFlag)
@Html.ValidationMessageFor(model => model.spouseFlag)
</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/PostEmployeeDependentUpdate
public ActionResult PostEmployeeDependentUpdate()
{
// Create a new instance of the model to pick up any default values.
PostEmployeeDependentUpdate model = new PostEmployeeDependentUpdate();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostEmployeeDependentUpdate.cshtml", model);
}
//
// POST: /MyController/PostEmployeeDependentUpdate
[HttpPost]
public ActionResult PostEmployeeDependentUpdate(FormCollection collection)
{
string url = "v3/Naviline/Payroll/EmployeeDependentUpdate";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("action", collection["action"]);
inputParms.Add("demographicKey", collection["demographicKey"]);
inputParms.Add("dependentKey", collection["dependentKey"]);
inputParms.Add("depSSN", collection["depSSN"]);
inputParms.Add("depLast", collection["depLast"]);
inputParms.Add("depFirst", collection["depFirst"]);
inputParms.Add("depMiddle", collection["depMiddle"]);
inputParms.Add("depBirthDate", collection["depBirthDate"]);
inputParms.Add("depAddr", collection["depAddr"]);
inputParms.Add("depAddr2", collection["depAddr2"]);
inputParms.Add("depCity", collection["depCity"]);
inputParms.Add("depState", collection["depState"]);
inputParms.Add("depZip", collection["depZip"]);
inputParms.Add("depPhone", collection["depPhone"]);
inputParms.Add("depSex", collection["depSex"]);
inputParms.Add("student", collection["student"]);
inputParms.Add("relCode", collection["relCode"]);
inputParms.Add("dateOfDeath", collection["dateOfDeath"]);
inputParms.Add("status", collection["status"]);
inputParms.Add("spouseFlag", collection["spouseFlag"]);
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", "PostEmployeeDependentUpdate");
return View("Error", info);
}
}