Method PostEditDependentInformation

Summary

Edit Employee Dependent Information

Remarks

Adds or edit a new dependent to the employee. Leave D577 blank to add a new dependent.

NOTE: Leave fields blank to remove any previous value.

Address and phone info normally only needs to be added if different from employee's address.

Input Parameters

NameTypeLengthDescription
UserNumber numeric 10 [Required] User Number. May need to be padded left with zeros to make it 10 digits.
UserPIN numeric 10 [Required] User Number. May need to be padded left with zeros to make it 10 digits.
D577 numeric 9 Record ID of dependent record. See GetDependentInformation Leave blank to add a new dependent.
LastName System.String 16 Dependent's Last Name
FirstName System.String 11 Dependent's First Name
MiddleInitial System.String 1 Dependent's Middle Initial
Birthday mmddyyyy 0 Dependent's Date of birth. Format=MMddyyyy
Address1 System.String 25 Address line 1, if different from employee's address
Address2 System.String 25 Address line 2, if different from employee's address
City System.String 20 City, if different from employee's address
State System.String 2 State, if different from employee's address
ZipCode System.String 9 ZipCode, if different from employee's address
PhoneNumber numeric 10 Phone number, including area code. Ex.1112224444
Sex System.String 1 Sex. M=Male, F=Female
Student System.String 1 Student. Y=Yes, N=No
Relationship System.String 2 Relationship code. See GetRelationshipTypes
DependencyDate mmddyyyy 0 Date added as a dependency (if different from date of birth) Format=MMddyyyy
DSTS System.String 1 Status
SSND numeric 9 Dependent's SSN number

Example

POST http://localhost/FusionServices/v2/Naviline/EmployeeSelfService/EditDependentInformation

Return Values

NameDescription
ErrorCode 0000=Success
ErrorMessage Message returned with error code

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v2/Naviline/EmployeeSelfService/EditDependentInformation";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("UserNumber",System.Web.HttpUtility.UrlEncode("245781227"));
   postParms.Add("UserPIN",System.Web.HttpUtility.UrlEncode("245781227"));
   postParms.Add("LastName",System.Web.HttpUtility.UrlEncode("Eklard"));
   postParms.Add("FirstName",System.Web.HttpUtility.UrlEncode("Anakhet"));
   postParms.Add("MiddleInitial",System.Web.HttpUtility.UrlEncode("C"));
   postParms.Add("Birthday",System.Web.HttpUtility.UrlEncode("04272003"));
   postParms.Add("Sex",System.Web.HttpUtility.UrlEncode("F"));
   postParms.Add("Student",System.Web.HttpUtility.UrlEncode("Y"));
   postParms.Add("Relationship",System.Web.HttpUtility.UrlEncode("C"));
   postParms.Add("DependencyDate",System.Web.HttpUtility.UrlEncode("06052017"));
   postParms.Add("SSND",System.Web.HttpUtility.UrlEncode("852439668"));
   postParms.Add("D577",System.Web.HttpUtility.UrlEncode("116000011"));

   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 PostEditDependentInformation
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,10}", ErrorMessage = "Numeric values only. Must be 10 digits or less. ")]
       public string UserNumber{get; set;}

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

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

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

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

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

       [RegularExpression("^(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])(19|20)\\d\\d$", ErrorMessage = "Date values only. Format: MMDDYYYY")]
       public string Birthday{get; set;}

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

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

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

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

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

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

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

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

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

       [RegularExpression("^(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])(19|20)\\d\\d$", ErrorMessage = "Date values only. Format: MMDDYYYY")]
       public string DependencyDate{get; set;}

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

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

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

@{
   ViewBag.Title = "PostEditDependentInformation";
}

<h2>PostEditDependentInformation</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostEditDependentInformation</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.UserNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.UserNumber)
           @Html.ValidationMessageFor(model => model.UserNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.UserPIN)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.UserPIN)
           @Html.ValidationMessageFor(model => model.UserPIN)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.D577)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.D577)
           @Html.ValidationMessageFor(model => model.D577)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.LastName)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.LastName)
           @Html.ValidationMessageFor(model => model.LastName)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.FirstName)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.FirstName)
           @Html.ValidationMessageFor(model => model.FirstName)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.MiddleInitial)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.MiddleInitial)
           @Html.ValidationMessageFor(model => model.MiddleInitial)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.Birthday)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.Birthday)
           @Html.ValidationMessageFor(model => model.Birthday)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.Address1)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.Address1)
           @Html.ValidationMessageFor(model => model.Address1)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.Address2)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.Address2)
           @Html.ValidationMessageFor(model => model.Address2)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.City)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.City)
           @Html.ValidationMessageFor(model => model.City)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.State)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.State)
           @Html.ValidationMessageFor(model => model.State)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.ZipCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.ZipCode)
           @Html.ValidationMessageFor(model => model.ZipCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.PhoneNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.PhoneNumber)
           @Html.ValidationMessageFor(model => model.PhoneNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.Sex)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.Sex)
           @Html.ValidationMessageFor(model => model.Sex)
       </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.Relationship)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.Relationship)
           @Html.ValidationMessageFor(model => model.Relationship)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.DependencyDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.DependencyDate)
           @Html.ValidationMessageFor(model => model.DependencyDate)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.DSTS)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.DSTS)
           @Html.ValidationMessageFor(model => model.DSTS)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.SSND)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.SSND)
           @Html.ValidationMessageFor(model => model.SSND)
       </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/PostEditDependentInformation
public ActionResult PostEditDependentInformation()
{
   // Create a new instance of the model to pick up any default values.
   PostEditDependentInformation model =  new PostEditDependentInformation();

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

// 
// POST: /MyController/PostEditDependentInformation
[HttpPost]
public ActionResult PostEditDependentInformation(FormCollection collection)
{
   string url = "v2/Naviline/EmployeeSelfService/EditDependentInformation";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("UserNumber", collection["UserNumber"]);
   inputParms.Add("UserPIN", collection["UserPIN"]);
   inputParms.Add("D577", collection["D577"]);
   inputParms.Add("LastName", collection["LastName"]);
   inputParms.Add("FirstName", collection["FirstName"]);
   inputParms.Add("MiddleInitial", collection["MiddleInitial"]);
   inputParms.Add("Birthday", collection["Birthday"]);
   inputParms.Add("Address1", collection["Address1"]);
   inputParms.Add("Address2", collection["Address2"]);
   inputParms.Add("City", collection["City"]);
   inputParms.Add("State", collection["State"]);
   inputParms.Add("ZipCode", collection["ZipCode"]);
   inputParms.Add("PhoneNumber", collection["PhoneNumber"]);
   inputParms.Add("Sex", collection["Sex"]);
   inputParms.Add("Student", collection["Student"]);
   inputParms.Add("Relationship", collection["Relationship"]);
   inputParms.Add("DependencyDate", collection["DependencyDate"]);
   inputParms.Add("DSTS", collection["DSTS"]);
   inputParms.Add("SSND", collection["SSND"]);

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