home *** CD-ROM | disk | FTP | other *** search
- <%@ LANGUAGE="VBSCRIPT" TRANSACTION=REQUIRED %>
- <% Option Explicit %>
- <!--#include file=libAuthenticate.inc-->
-
- <%
-
- Dim m_intRelationship, m_strFirstName, m_strLastName, m_strMiddleName, m_strSSN, _
- m_intGender, m_datBirthdate, m_intReason, m_strMainPrompt, m_Reason, m_ChangeDate
-
- '
- ' This block determines whether to display the page, or attempt to update the
- ' database and then redirect.
- '
-
- If Request.Form("SubmitDependent") <> "" Then
- GetValuesFromForm
- If UpdateDatabase = 0 Then ' database update occurred successfully
- Response.Redirect("EmpProfile.asp?DepAddSuccess=1")
- Response.End
- Else ' database update did not occur successfully so let the user know
-
- End If
- End If
-
- m_strMainPrompt = "Enter the dependent's information, then click Save.<BR> " & _
- "The items listed in <STRONG>bold</STRONG> and marked by a blue bullet are required."
-
- %>
-
- <!--BEGIN HTML-->
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
- <HTML>
- <HEAD>
- <META NAME="DESCRIPTION" Content="Exploration Air's Add Dependent Page">
- <META NAME="KEYWORDS" CONTENT="dependent, add, new, spouse, child">
- <META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev 1.0">
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
- <TITLE>Add Dependent</TITLE>
- </HEAD>
-
- <BODY BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#228B22 LINK=#23238E>
- <BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
-
- <!--Change link color on mouseover
- Only if running Internet Explorer 4.0 or later -->
- <!--#include file=../libHighlight.inc-->
-
- <!--COLOR BANNER_START-->
- <CENTER>
- <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
- <TR>
- <TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
- </TD>
- </TR>
- </TABLE>
- <!--COLOR BANNER_END-->
-
- <!--BEGIN TOP TABLE CONTAINING LOGO AND NAVIGATIONAL LINK-->
- <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
- <TR>
- <TD VALIGN=TOP WIDTH=325>
- <A HREF="../default.asp">
- <IMG SRC="../images/logo_sm.gif" WIDTH=200 HEIGHT=100
- ALT="Return to Exploration Air Home Page" BORDER=0>
- </A>
- <BR>
- <A HREF="default.asp">
- <IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 HSPACE=5
- ALT="Return to Employee Benefit Home Page" BORDER=0>
- </A>
- <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2" ><STRONG>
- <A HREF="default.asp" TITLE="Click to return to Employee Benefit Home Page">
- EMPLOYEE BENEFITS HOME PAGE
- </A>
- </STRONG></FONT>
- <BR>
- <A HREF="EmpProfile.asp">
- <IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 HSPACE=5
- ALT="Return to Employee Profile Page" BORDER=0>
- </A>
- <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2" ><STRONG>
- <A HREF="EmpProfile.asp" TITLE="Click to return to Employee Profile Page">
- EMPLOYEE PROFILE PAGE
- </A>
- </STRONG></FONT>
- </TD>
- <TD VALIGN=MIDDLE WIDTH=200>
- </TD>
- <TD WIDTH=200>
- <FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=5>
- Add Dependent
- </FONT>
- </TD>
- <TD VALIGN=TOP ALIGN=RIGHT>
- <A HREF="../HowItWorks/HIWBenefitsDependentAdd.asp">
- <IMG SRC="../images/btssmall.gif" WIDTH="115" HEIGHT="52"
- ALT="Click here to learn how this page works" BORDER=0>
- </A>
- </TD>
- </TR>
- </TABLE>
- <!--END TABLE CONTAINING LOGO AND NAVIGATIONAL LINK -->
- <BR>
-
- <P>
- <CENTER>
- <%= m_strMainPrompt %>
- </CENTER>
-
- <P>
-
- <!--BEGIN FORM-->
- <FORM NAME="DependentForm" METHOD=POST ACTION="DependentAdd.asp" Language="JavaScript"
- onSubmit="if (!validateForm(document.DependentForm))
- {
- alert ('Please provide all of the required information (listed in bold), then click Save.');
- return false;
- }">
-
- <TABLE BORDER=1>
- <TR>
- <TD BGCOLOR="#C71585" COLSPAN=2>
- <STRONG><FONT COLOR="#FFFFFF"> Dependent Information</FONT></STRONG>
- </TD>
- </TR>
- <TR>
- <TD>
- <IMG SRC="images/bulletb.gif"><STRONG>Relationship</STRONG>
- </TD>
- <TD>
- <% BuildDependentTypeList %>
- </TD>
- </TR>
- <TR>
- <TD WIDTH=110>
- <IMG SRC="images/bulletb.gif"><STRONG>First Name</STRONG>
- </TD>
- <TD COLSPAN=3 WIDTH=190>
- <INPUT SIZE=25 MAXLENGTH=20 NAME="FirstName" VALUE="<%= m_strFirstName %>">
- </TD>
- </TR>
- <TR>
- <TD>
- <IMG SRC="images/bulletb.gif"><STRONG>Last Name</STRONG>
- </TD>
- <TD COLSPAN=3>
- <INPUT SIZE=25 MAXLENGTH=20 NAME="LastName" VALUE="<%= m_strLastName %>">
- </TD>
- </TR>
- <TR>
- <TD>
- Middle Name
- </TD>
- <TD COLSPAN=3>
- <INPUT SIZE=25 MAXLENGTH=20 NAME="MiddleName" VALUE="<%= m_strMiddleName %>">
- </TD>
- </TR>
- <TR>
- <TD>
- <IMG SRC="images/bulletb.gif"><STRONG>SSN</STRONG>
- </TD>
- <TD COLSPAN=3>
- <INPUT SIZE=25 MAXLENGTH=11 NAME="SSN" VALUE="<%= m_strSSN %>">
- </TD>
- </TR>
- <TR>
- <TD>
- <IMG SRC="images/bulletb.gif"><STRONG>Gender</STRONG>
- </TD>
- <TD COLSPAN=3>
- <% BuildGenderList %>
- </TD>
- </TR>
- <TR>
- <TD>
- <IMG SRC="images/bulletb.gif"><STRONG>Birthdate</STRONG>
- </TD>
- <TD COLSPAN=3>
- <INPUT SIZE=25 MAXLENGTH=20 NAME="Birthdate" VALUE="<%= m_datBirthdate %>">
- </TD>
- </TR>
- <TR>
- <TD>
- <IMG SRC="images/bulletb.gif"><STRONG>Reason for Change</STRONG>
- </TD>
- <TD>
- <% BuildChangeQualifierList %>
- </TD>
- </TR>
- <TR>
- <TD>
- <IMG SRC="images/bulletb.gif"><STRONG>Date Event Occured</STRONG>
- </TD>
- <TD COLSPAN=3>
- <INPUT SIZE=25 MAXLENGTH=20 NAME="ChangeDate" VALUE="<%= m_ChangeDate %>">
- </TD>
- </TR>
- </TABLE>
-
- <P>
- </CENTER>
- <P>
- <CENTER>
- <INPUT TYPE="Submit" NAME="SubmitDependent" VALUE="Save">
- </FORM>
-
- </CENTER>
- <!--END FORM-->
-
-
- <P>
- <HR=400>
- <P>
-
- <!--BEGIN LEGAL INFORMATION-->
- <CENTER>
- <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1">
- <A HREF="../legal.htm" TITLE="Click to view Copyright and Legal Information">
- ©1997 Microsoft Corporation. All rights reserved. Terms of Use.
- </A>
- </FONT>
- </CENTER>
- <!--END LEGAL INFORMATION-->
-
- <P>
-
-
- <!--COLOR BANNER_START-->
- <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
- <TR>
- <TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
- </TD>
- </TR>
- </TABLE>
- <!--COLOR BANNER_END-->
-
- </BODY>
- </HTML>
- <!--END HTML-->
-
- <SCRIPT LANGUAGE="JavaScript">
- // Begin client side helper functions
- function validateForm(form)
- {
- if (isEmpty(form.Relationship)) return false;
- if (isEmpty(form.FirstName)) return false;
- if (isEmpty(form.LastName)) return false;
- if (isEmpty(form.SSN)) return false;
- if (isEmpty(form.Gender)) return false;
- if (NotDate(form.Birthdate)) return false;
- if (isEmpty(form.AddReason)) return false;
- if (NotDate(form.ChangeDate)) return false;
-
- return true;
- }
-
- function isEmpty(textcontrol)
- {
- str = textcontrol.value
- for (i = 0; i < str.length; i++)
- {
- chr = str.substring(i, i + 1);
- if (chr != ' ')
- {
- return false;
- }
- }
- return true;
- }
-
- function NotDate(textcontrol)
- {
- myDate = Date.parse(textcontrol.value)
- if (isNaN(myDate))
- {
- return true;
- }
- return false;
- }
-
- </SCRIPT>
-
- <%
- '
- ' Begin server side helper functions
- '
-
- '
- ' Create Select list of Dependent Types
- '
- Sub BuildDependentTypeList
- Dim BenefitList, rstDependentTypeList
- Set BenefitList = Server.CreateObject("Benefit.BenefitList")
- Set rstDependentTypeList = BenefitList.DependentTypeList(Application("DSNBenefits"))
- Response.Write "<SELECT NAME=Relationship >" & Chr(13)
- Do Until rstDependentTypeList.EOF
- ' Don't do for DependentType = "Employee"
- If rstDependentTypeList("DependentTypeRank") <> 1 Then
- Response.Write "<OPTION VALUE="
- ' Don't do for DependentType = "Select Dependent Type"
- If rstDependentTypeList("DependentTypeRank") <> 0 Then
- Response.Write rstDependentTypeList("DependentTypeId")
- End If
- Response.Write ">" & rstDependentTypeList("DependentTypeLabel") & Chr(13)
- End If
- rstDependentTypeList.MoveNext
- Loop
- Response.Write "</SELECT>" & Chr(13)
- End Sub
-
- '
- ' Create Select list of Genders
- '
- Sub BuildGenderList
- Dim BenefitList, rstGenderList
- Set BenefitList = Server.CreateObject("Benefit.BenefitList")
- Set rstGenderList = BenefitList.GenderList(Application("DSNBenefits"))
- Response.Write "<SELECT NAME=Gender >" & Chr(13)
- Do Until rstGenderList.EOF
- Response.Write "<OPTION VALUE="
- ' Don't do for GenderRank 0
- If rstGenderList("GenderRank") <> 0 Then
- Response.Write rstGenderList("GenderId")
- End If
- Response.Write ">" & rstGenderList("GenderLabel") & Chr(13)
- rstGenderList.MoveNext
- Loop
- Response.Write "</SELECT>" & Chr(13)
- End Sub
-
- '
- ' Create Select list of available Change Qualifiers
- '
- Sub BuildChangeQualifierList
- Dim Benefit, rstReasonList, intQualifierClass, intBenefitId
- ' Get the Dependent Add codes
- intQualifierClass = 4
- ' Tell method to disregard BenefitId
- intBenefitId = 0
- Set Benefit = Server.CreateObject("Benefit.BenefitList")
- Set rstReasonList = Benefit.ChangeQualifierList(Application("DSNBenefits"), intBenefitId, _
- intQualifierClass)
- Response.Write "<SELECT NAME=AddReason >" & Chr(13)
- Do Until rstReasonList.EOF
- Response.Write "<OPTION VALUE="
- If rstReasonList("QualifierRank") > 0 Then
- Response.Write rstReasonList("QualifierId") & ">"
- Else
- Response.Write " >"
- End If
- Response.Write rstReasonList("QualifierLabel")
- Response.Write Chr(13)
- rstReasonList.MoveNext
- Loop
- Response.Write "</SELECT>" & Chr(13)
- End Sub
-
- '
- ' Take values from the submitted form and assign to page level variables.
- '
- Sub GetValuesFromForm
- m_intRelationship = CInt(Request.Form("Relationship"))
- m_strFirstName = Trim(Request.Form("FirstName"))
- m_strLastName = Trim(Request.Form("LastName"))
- m_strMiddleName = Trim(Request.Form("MiddleName"))
- m_strSSN = Trim(Request.Form("SSN"))
- m_intGender = CInt(Request.Form("Gender"))
- m_datBirthdate = Trim(Request.Form("Birthdate"))
- If Not IsDate(m_datBirthdate) Then
- m_datBirthdate = Now()
- End If
- m_Reason = Trim(Request.Form("AddReason"))
- m_ChangeDate = Trim(Request.Form("ChangeDate"))
- If Not IsDate(m_ChangeDate) Then
- m_ChangeDate = Now()
- End If
- End Sub
-
- '
- ' Update the database. Return 0 if successful or 1 if an error is encountered.
- '
- Function UpdateDatabase
- On Error Resume Next
- Dim Employee
- Set Employee = Server.CreateObject("Benefit.Employee")
- Employee.AddDependent Application("DSNBenefits"), Session("EmployeeId"), _
- m_intRelationship, m_strFirstName, m_strLastName, _
- m_strMiddleName, m_strSSN, m_intGender, m_datBirthdate
-
- Dim Benefit
- Set Benefit = Server.CreateObject("Benefit.BenefitList")
- Benefit.AddQualifier Application("DSNBenefits"), Session("EmployeeId"), m_Reason, _
- m_ChangeDate
-
- If Err.Number = 0 Then
- UpdateDatabase = 0
- Else
- ContextObject.SetAbort
- UpdateDatabase = 1
- End If
-
- End Function
-
- Sub OnTransactionCommit
-
- End Sub
-
- Sub OnTransactionAbort
- m_strMainPrompt = "A problem occurred while trying to update the database. Please try again later. "
- End Sub
- %>
-