home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / EmpProfile.asp < prev    next >
Text File  |  1997-11-01  |  20KB  |  641 lines

  1. <%@ LANGUAGE="VBSCRIPT" TRANSACTION=REQUIRED %>
  2. <% Option Explicit %>
  3.  
  4. <!--#include file=libAuthenticate.inc-->
  5.  
  6. <%
  7.  
  8.   Dim m_strFirstName, m_strLastName, m_strMiddleName, m_strKnownAs, m_strSSN, _
  9.     m_intGender, m_datBirthdate, m_strAddress1, _
  10.     m_strAddress2, m_strCity, m_strState, m_strPostCode, m_strCountry, m_strHomePhone, _ 
  11.     m_strBusinessPhone, m_strFax, m_strEmail, _
  12.     m_lngExemptions, m_lngEmployeeGeoAreaId, m_intEmployeeStatus, m_strMainPrompt, _
  13.     m_strNTUserName, m_UpdateMessage
  14.  
  15.   '
  16.   ' This block determines whether to display the page, or Update the
  17.   ' database and then redirect.
  18.   '
  19.   m_UpdateMessage = ""
  20.   If Request.Form("SubmitProfile") <> "" Then
  21.     GetValuesFromForm
  22.     If UpdateDatabase = 0 Then ' database update occurred successfully
  23.       If Request.Form("SubmitProfile") = "Add Dependent" Then
  24.         Response.Redirect("DependentAdd.asp")
  25.         Response.End
  26.       Else
  27.         m_UpdateMessage = " Language=JavaScript " & _
  28.           "onLoad=" & Chr(34) & "{ alert ('Your Employee Record was updated.');}" & Chr(34)
  29.       End If
  30.     End If
  31.   Else
  32.     GetValuesFromDatabase
  33.     If Request.QueryString("DepAddSuccess") = 1 Then
  34.       m_UpdateMessage = " Language=JavaScript " & _
  35.         "onLoad=" & Chr(34) & "{ alert ('Your Employee Record was updated.');}" & Chr(34)
  36.     End If
  37.   End If
  38.   
  39.      m_strMainPrompt = "To make changes, fill out the form below.<BR>" & _
  40.       "The items listed in <STRONG>bold</STRONG> and marked by a blue dot are required.<BR>" & _
  41.       "Click <STRONG>Save</STRONG> or <STRONG>Add Dependent</STRONG> when you are finished."
  42. %>
  43.  
  44. <!--BEGIN HTML-->
  45. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  46. <HTML>
  47. <HEAD>
  48. <META NAME="DESCRIPTION" Content="Exploration Air's profile information">
  49. <META NAME="KEYWORDS" CONTENT="profile, join, log on, sign up, club, update">
  50. <META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev 1.0">
  51. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
  52. <TITLE>Manage Your Employee Profile</TITLE>
  53. </HEAD>
  54.  
  55. <BODY BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#228B22 LINK=#23238E
  56.  <%= m_UpdateMessage%> >
  57. <BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
  58.  
  59. <!--Change link color on mouseover
  60.     Only if running Internet Explorer 4.0 or later -->
  61. <!--#include file=../libHighlight.inc-->
  62.  
  63. <!--COLOR BANNER_START-->
  64. <CENTER>
  65. <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
  66.   <TR>
  67.     <TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
  68.     </TD>
  69.   </TR>
  70. </TABLE>
  71. <!--COLOR BANNER_END-->
  72.  
  73. <!--BEGIN TOP TABLE CONTAINING LOGO AND NAVIGATIONAL LINK-->
  74. <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
  75.   <TR>
  76.     <TD VALIGN=TOP WIDTH=325>
  77.       <A HREF="../default.asp">
  78.         <IMG SRC="../images/logo_sm.gif" WIDTH=200 HEIGHT=100 
  79.           ALT="Return to Exploration Air Home Page" BORDER=0>
  80.       </A>
  81. <BR>
  82.       <A HREF="default.asp">
  83.         <IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 HSPACE=5
  84.              ALT="Return to Employee Benefit Home Page" BORDER=0>
  85.       </A>
  86.       <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2" ><STRONG>
  87.         <A HREF="default.asp" TITLE="Click to return to Employee Benefit Home Page">
  88.           EMPLOYEE BENEFITS HOME PAGE
  89.         </A>
  90.       </STRONG></FONT>
  91.     </TD>
  92.     <TD VALIGN=MIDDLE WIDTH=200>
  93.     </TD>
  94.     <TD WIDTH=200>
  95.       <FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=5>
  96.         Manage Your Employee Record
  97.       </FONT>
  98.     </TD>
  99.     <TD VALIGN=TOP ALIGN=RIGHT>
  100.       <A HREF="../HowItWorks/HIWBenefitsEmpProfile.asp">
  101.         <IMG SRC="../images/btssmall.gif" WIDTH="115" HEIGHT="52" 
  102.           ALT="Click here to learn how this page works" BORDER=0>
  103.       </A>
  104.     </TD>
  105.   </TR>
  106. </TABLE>
  107. <!--END TABLE CONTAINING LOGO AND NAVIGATIONAL LINK -->
  108. <BR>
  109.  
  110. <%= m_strMainPrompt %>
  111.  
  112. <BR>
  113.  
  114. <!--BEGIN FORM-->
  115. <FORM NAME="ProfileForm" METHOD=POST ACTION="EmpProfile.asp" Language="JavaScript"
  116.   onSubmit="if (!validateForm(document.ProfileForm))
  117.             {
  118.               alert ('Provide all of the required information (listed in bold), then select Save or Add Dependent.');
  119.               return false;
  120.              }">
  121.  
  122. <TABLE BACKGROUND="images/btsbgflip.gif" COLS=2  TOPMARGIN=0 cellspacing=0 
  123.   WIDTH=600 BORDERCOLOR=#0000000 BORDER=1 CELLPADDING=1>
  124.   <TR>
  125.     <TD VALIGN=TOP>
  126.       <TABLE COLS=4 WIDTH=300 CELLPADDING=1 CELLSPACING=0 BORDER=0> 
  127.         <TR>
  128.           <TD BGCOLOR="#C71585" COLSPAN=4>
  129.             <STRONG><FONT COLOR="#FFFFFF"> Personal Information</FONT></STRONG>
  130.           </TD>
  131.         </TR>
  132.         <TR>
  133.           <TD WIDTH=110>
  134.             <IMG SRC="images/bulletb.gif"><STRONG>First Name</STRONG>
  135.           </TD>
  136.           <TD COLSPAN=3 WIDTH=190>
  137.             <INPUT SIZE=25 MAXLENGTH=20 NAME="FirstName" VALUE="<%= m_strFirstName %>">
  138.           </TD>
  139.         </TR>      
  140.         <TR>
  141.           <TD>
  142.             <IMG SRC="images/bulletb.gif"><STRONG>Last Name</STRONG>
  143.           </TD>
  144.           <TD COLSPAN=3>
  145.             <INPUT SIZE=25 MAXLENGTH=20 NAME="LastName" VALUE="<%= m_strLastName %>">
  146.           </TD>
  147.         </TR>
  148.         <TR>
  149.           <TD>
  150.              Middle
  151.             <BR>
  152.              Name
  153.           </TD>
  154.           <TD COLSPAN=3>
  155.             <INPUT SIZE=25 MAXLENGTH=20 NAME="MiddleName" VALUE="<%= m_strMiddleName %>">
  156.           </TD>
  157.         </TR>
  158.         <TR>
  159.           <TD>
  160.              Known As
  161.           </TD>
  162.           <TD COLSPAN=3>
  163.             <INPUT SIZE=25 MAXLENGTH=20 NAME="KnownAs" VALUE="<%= m_strKnownAs %>">
  164.           </TD>
  165.         </TR>
  166.         <TR>
  167.           <TD>
  168.             <IMG SRC="images/bulletb.gif"><STRONG>SSN</STRONG>
  169.           </TD>
  170.           <TD COLSPAN=3>
  171.             <INPUT SIZE=25 MAXLENGTH=20 NAME="SSN" VALUE="<%= m_strSSN %>">
  172.           </TD>
  173.         </TR>
  174.         <TR>
  175.           <TD>
  176.             <IMG SRC="images/bulletb.gif"><STRONG>Gender</STRONG>
  177.           </TD>
  178.           <TD COLSPAN=3>
  179.             <% BuildGenderList %>
  180.           </TD>
  181.         </TR>
  182.         <TR>
  183.           <TD>
  184.             <IMG SRC="images/bulletb.gif"><STRONG>Birthdate</STRONG>
  185.           </TD>
  186.           <TD COLSPAN=3>
  187.             <INPUT SIZE=25 MAXLENGTH=20 NAME="Birthdate" VALUE="<%= m_datBirthdate %>">
  188.           </TD>
  189.         </TR>
  190.         <TR>
  191.           <TD WIDTH=225>
  192.             <IMG SRC="images/bulletb.gif"><STRONG>Exemptions</STRONG>
  193.           </TD>
  194.           <TD WIDTH=75>
  195.             <INPUT SIZE=25 MAXLENGTH=1 NAME="Exemptions" VALUE="<%= m_lngExemptions %>">
  196.           </TD>
  197.         </TR>
  198.       </TABLE>
  199.     </TD>
  200.     <TD VALIGN=TOP>
  201.       <TABLE COLS=4 WIDTH=300 CELLPADDING=1 CELLSPACING=0 BORDER=0> 
  202.         <TR>
  203.           <TD BGCOLOR="#C71585" COLSPAN=2>
  204.             <STRONG><FONT COLOR="#FFFFFF"> Contact Information</FONT></STRONG>
  205.           </TD>
  206.         </TR>
  207.         <TR>
  208.           <TD>
  209.             <IMG SRC="images/bulletb.gif"><STRONG>Address 1</STRONG>
  210.           </TD>
  211.           <TD COLSPAN=3>
  212.             <INPUT SIZE=25 MAXLENGTH=20 NAME="Address1" VALUE="<%= m_strAddress1 %>">
  213.           </TD>
  214.         </TR>
  215.         <TR>
  216.           <TD>
  217.              Address 2
  218.           </TD>
  219.           <TD COLSPAN=3>
  220.             <INPUT SIZE=25 MAXLENGTH=20 NAME="Address2" VALUE="<%= m_strAddress2 %>">
  221.           </TD>
  222.         </TR>
  223.         <TR>
  224.           <TD>
  225.             <IMG SRC="images/bulletb.gif"><STRONG>City</STRONG>
  226.           </TD>
  227.           <TD COLSPAN=3>
  228.             <INPUT SIZE=25 MAXLENGTH=20 NAME="City" VALUE="<%= m_strCity %>">
  229.           </TD>
  230.         </TR>
  231.         <TR>
  232.           <TD>
  233.             <IMG SRC="images/bulletb.gif"><STRONG>State/Province</STRONG>
  234.           </TD>
  235.           <TD COLSPAN=3>
  236.             <INPUT SIZE=25 MAXLENGTH=20 NAME="State" VALUE="<%= m_strState %>">
  237.           </TD>
  238.         </TR>
  239.         <TR>
  240.           <TD>
  241.             <IMG SRC="images/bulletb.gif"><STRONG>Postal Code</STRONG>
  242.           </TD>
  243.           <TD COLSPAN=3>
  244.             <INPUT SIZE=25 MAXLENGTH=20 NAME="PostCode" VALUE="<%= m_strPostCode %>">
  245.           </TD>
  246.         </TR>
  247.         <TR>
  248.           <TD>
  249.             <IMG SRC="images/bulletb.gif"><STRONG>Country</STRONG>
  250.           </TD>
  251.           <TD COLSPAN=3>
  252.             <INPUT SIZE=25 MAXLENGTH=20 NAME="Country" VALUE="<%= m_strCountry %>">
  253.           </TD>
  254.         </TR>
  255.         <TR>
  256.           <TD WIDTH=225>
  257.              Home
  258.             <BR>
  259.              Phone 
  260.           </TD>
  261.           <TD WIDTH=75>
  262.             <INPUT SIZE=25 MAXLENGTH=20 NAME="HomePhone" VALUE="<%= m_strHomePhone %>">
  263.           </TD>
  264.         </TR>
  265.         <TR>
  266.           <TD WIDTH=225>
  267.              Business
  268.             <BR>
  269.              Phone
  270.           </TD>
  271.           <TD WIDTH=75>
  272.             <INPUT SIZE=25 MAXLENGTH=20 NAME="BusinessPhone" VALUE="<%= m_strBusinessPhone %>">
  273.           </TD>
  274.         </TR>
  275.         <TR>
  276.           <TD WIDTH=225>
  277.              Fax
  278.           </TD>
  279.           <TD WIDTH=75>
  280.             <INPUT SIZE=25 MAXLENGTH=20 NAME="Fax" VALUE="<%= m_strFax %>">
  281.           </TD>
  282.         </TR>
  283.         <TR>
  284.           <TD WIDTH=225>
  285.              E-mail
  286.             <BR>
  287.              Address
  288.           </TD>
  289.           <TD WIDTH=75>
  290.             <INPUT SIZE=25 MAXLENGTH=40 NAME="Email" VALUE="<%= m_strEmail %>">
  291.           </TD>
  292.         </TR>
  293.       </TABLE>
  294.     </TD>
  295.   </TR>
  296. </TABLE>
  297.  
  298. <P>
  299. <P>
  300. <CENTER> To add a dependent, click <STRONG>Add Dependent</STRONG>.
  301. <BR>To remove a dependent, check the check box on the appropriate line and then click 
  302. <STRONG>Save</STRONG>.
  303.  
  304. <P>If a record has an incorrect relationship or name, select the 
  305. check box next to the name and click <STRONG>Save</STRONG> to remove that record, then 
  306. click <STRONG>Add Dependent</STRONG> to create a new dependent record with correct information.
  307.  
  308. <P>
  309.  
  310. <TABLE BACKGROUND="images/btsbgflip.gif" COLS=6  TOPMARGIN=0 cellspacing=0 
  311.   WIDTH=650 BORDERCOLOR=#0000000 BORDER=1 CELLPADDING=1>
  312.   <TR>
  313.     <TD BGCOLOR="#C71585" COLSPAN=6>
  314.       <STRONG><FONT COLOR="#FFFFFF"> Dependent Information</FONT></STRONG>
  315.     </TD>
  316.   </TR>
  317.   <TR>
  318.     <TH ALIGN="CENTER">
  319.       Remove
  320.     </TH>
  321.     <TH>
  322.       Relationship 
  323.     </TH>
  324.     <TH>
  325.       Name
  326.     </TH>
  327.     <TH>
  328.       SSN
  329.     </TH>
  330.     <TH>
  331.       Gender
  332.     </TH>
  333.     <TH>
  334.       Birthdate
  335.     </TH>
  336.   </TR>
  337.  
  338. <% ListDependents %>
  339.  
  340. </TABLE>
  341.  
  342. <P>
  343. </CENTER>
  344. <P>
  345. <CENTER>
  346. <INPUT TYPE="Submit" NAME="SubmitProfile" VALUE="Save">
  347. <INPUT TYPE="Submit" NAME="SubmitProfile" VALUE="Add Dependent">
  348. </FORM>
  349. </CENTER>
  350. <!--END FORM-->
  351.  
  352.  
  353. <P> 
  354. <HR=400>
  355. <P>
  356.  
  357. <!--BEGIN LEGAL INFORMATION-->
  358. <CENTER>
  359. <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1">
  360. <A HREF="../legal.htm" TITLE="Click to view Copyright and Legal Information">
  361.   ©1997 Microsoft Corporation. All rights reserved. Terms of Use.
  362. </A>
  363. </FONT>
  364. </CENTER>
  365. <!--END LEGAL INFORMATION-->
  366.  
  367. <P>
  368.  
  369. <!--COLOR BANNER_START-->
  370. <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
  371.   <TR>
  372.     <TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
  373.     </TD>
  374.   </TR>
  375. </TABLE>
  376. <!--COLOR BANNER_END-->
  377.  
  378. </BODY>
  379. </HTML>
  380. <!--END HTML-->
  381.  
  382. <SCRIPT LANGUAGE="JavaScript">
  383. // Begin client side helper functions
  384.   function validateForm(form)
  385.   {
  386.     if (isEmpty(form.FirstName)) return false;
  387.     if (isEmpty(form.LastName)) return false;
  388.     if (isEmpty(form.Address1)) return false;
  389.     if (isEmpty(form.City)) return false;
  390.     if (isEmpty(form.State)) return false;
  391.     if (isEmpty(form.SSN)) return false;
  392.     if (isEmpty(form.Gender)) return false;
  393.     if (NotDate(form.Birthdate)) return false;
  394.     if (notNumber(form.Exemptions)) return false;
  395.     if (isEmpty(form.PostCode)) return false;
  396.     if (isEmpty(form.Country)) return false;
  397.   
  398.     return true;
  399.   }
  400.  
  401.   function isEmpty(textcontrol)
  402.   {
  403.     str = textcontrol.value
  404.     for (i = 0; i < str.length; i++)
  405.     {
  406.       chr = str.substring(i, i + 1);
  407.       if (chr != ' ')
  408.       {
  409.         return false;
  410.       }
  411.     }
  412.     return true;
  413.   }
  414.  
  415.   function NotDate(textcontrol)
  416.   {
  417.     myDate = Date.parse(textcontrol.value)
  418.     if (isNaN(myDate))
  419.     {
  420.       return true;
  421.     }
  422.     return false;
  423.   }
  424.  
  425.   function notNumber(textcontrol)
  426.   {
  427.     num = parseInt(textcontrol.value)
  428.     if (isNaN(num))
  429.     {
  430.       return true;
  431.     }
  432.     return false;
  433.   }
  434.  
  435. </SCRIPT>
  436.  
  437. <%
  438.   '
  439.   ' Begin server side helper functions
  440.   '
  441.  
  442.   '
  443.   ' Create Select list of Genders
  444.   '
  445.   Sub BuildGenderList
  446.     Dim BenefitList, rstGenderList
  447.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  448.     Set rstGenderList = BenefitList.GenderList(Application("DSNBenefits"))
  449.     Response.Write "<SELECT NAME=Gender >" & Chr(13)
  450.     Do Until rstGenderList.EOF
  451.       Response.Write "<OPTION VALUE=" 
  452.       ' Don't do for GenderRank 0
  453.       If rstGenderList("GenderRank") <> 0 Then
  454.         Response.Write rstGenderList("GenderId")
  455.       End If
  456.       If rstGenderList("GenderId") = CInt(m_intGender) Then
  457.         Response.Write " SELECTED "
  458.       End If
  459.       Response.Write ">" & rstGenderList("GenderLabel") & Chr(13)
  460.       rstGenderList.MoveNext
  461.     Loop
  462.     Response.Write "</SELECT>" & Chr(13)
  463.   End Sub
  464.  
  465.   '
  466.   ' Set page level variables to values retrieved from database
  467.   '
  468.   Sub GetValuesFromDatabase()
  469.     Dim Employee, rstEmployee
  470.     Set Employee = Server.CreateObject("Benefit.Employee")
  471.     rstEmployee = Employee.GetForID(Application("DSNBenefits"), Session("EmployeeID"))
  472.     ' This is the employee's own dependent id
  473.     Session("DependentId") = rstEmployee("DependentId")
  474.     m_strNTUserName = rstEmployee("NTUserName")
  475.     m_strFirstName = rstEmployee("FirstName")
  476.     m_strLastName = rstEmployee("LastName")
  477.     m_strMiddleName = rstEmployee("MiddleName")
  478.     m_strKnownAs = rstEmployee("KnownAs")
  479.     m_strSSN = rstEmployee("DependentSSN")
  480.     m_intGender = rstEmployee("DependentGenderId")
  481.     m_datBirthdate = rstEmployee("DependentBirthdate")
  482.     m_strAddress1 = rstEmployee("Address1")
  483.     m_strAddress2 = rstEmployee("Address2")
  484.     m_strCity = rstEmployee("City")
  485.     m_strState = rstEmployee("State")
  486.     m_strPostCode = rstEmployee("PostCode")
  487.     m_strCountry = rstEmployee("Country")
  488.     m_strHomePhone = rstEmployee("HomePhone")
  489.     m_strBusinessPhone = rstEmployee("BusinessPhone")
  490.     m_strFax = rstEmployee("Fax")
  491.     m_strEmail = rstEmployee("Email")
  492.     m_lngExemptions = rstEmployee("Exemptions")
  493.   End Sub
  494.  
  495.   '
  496.   ' Generate the rows for a table consisting of the Dependent info for this Employee
  497.   '
  498.   Sub ListDependents
  499.     Dim Employee, rstDependents
  500.     Set Employee = Server.CreateObject("Benefit.Employee")
  501.     Set rstDependents = Employee.GetDependents(Application("DSNBenefits"), Session("EmployeeId"))
  502.     If rstDependents.EOF Then
  503.         Response.Write "<TR>" & Chr(13)
  504.         Response.Write "<TD ALIGN=CENTER>  </TD>" & Chr(13)
  505.         Response.Write "<TD> </TD>" & Chr(13)
  506.         Response.Write "<TD> </TD>" & Chr(13)
  507.         Response.Write "<TD> </TD>" & Chr(13)
  508.         Response.Write "<TD> </TD>" & Chr(13)
  509.         Response.Write "<TD> </TD>" & Chr(13)
  510.         Response.Write "</TR>" & Chr(13)
  511.     Else
  512.       Do Until rstDependents.EOF
  513.         Response.Write "<TR>" & Chr(13)
  514.         Response.Write "<TD ALIGN=CENTER> <INPUT TYPE=CHECKBOX NAME=RemoveDep "
  515.         Response.Write "VALUE=" & rstDependents("DependentId") & "> </TD>" & Chr(13)
  516.         
  517.         Response.Write "<TD>" & rstDependents("DependentTypeLabel") & "</TD>" & Chr(13)
  518.         
  519.         Response.Write "<INPUT TYPE=HIDDEN NAME=DependentId VALUE=" & rstDependents("DependentId") & ">"
  520.         
  521.         Response.Write "<TD>" & rstDependents("FirstName") & " " & rstDependents("LastName") & "</TD>" & Chr(13)
  522.         
  523.         Response.Write "<TD>"
  524.         Response.Write "<INPUT TYPE=TEXT NAME=DependentSSN VALUE=" & rstDependents("DependentSSN")
  525.         Response.Write " SIZE=11 MAXLENGTH=11></TD>" & Chr(13)
  526.         
  527.         Response.Write "<TD>"
  528.         BuildDepGenderList rstDependents("DependentGenderId")
  529.         Response.Write "</TD>" & Chr(13)
  530.         
  531.         Response.Write "<TD>"
  532.         Response.Write "<INPUT TYPE=TEXT NAME=DependentBirthdate VALUE=" & rstDependents("DependentBirthdate")
  533.         Response.Write " SIZE=8 MAXLENGTH=8></TD>" & Chr(13)
  534.         
  535.         Response.Write "</TR>" & Chr(13)
  536.         rstDependents.MoveNext
  537.       Loop
  538.     End If
  539.   End Sub
  540.  
  541.   '
  542.   ' Create Select list of Dependent Genders
  543.   '
  544.   Sub BuildDepGenderList (ByVal DependentGenderId)
  545.     Dim BenefitList, rstGenderList
  546.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  547.     Set rstGenderList = BenefitList.GenderList(Application("DSNBenefits"))
  548.     Response.Write "<SELECT NAME=DependentGender >" & Chr(13)
  549.     Do Until rstGenderList.EOF
  550.       If rstGenderList("GenderRank") <> 0 Then
  551.         Response.Write "<OPTION VALUE=" & rstGenderList("GenderId")
  552.         If rstGenderList("GenderId") = DependentGenderId Then
  553.           Response.Write " SELECTED "
  554.         End If
  555.         Response.Write ">" & rstGenderList("GenderLabel") & Chr(13)
  556.       End If
  557.       rstGenderList.MoveNext
  558.     Loop
  559.     Response.Write "</SELECT>" & Chr(13)
  560.   End Sub
  561.  
  562.   ' 
  563.   ' Take values from the submitted form and assign to page level variables.
  564.   ' These variables will in turn be passed to the database. If the database
  565.   ' update fails, the form will be displayed again with these values filled 
  566.   ' into the correct fields.
  567.   '
  568.   Sub GetValuesFromForm
  569.     m_strFirstName = Trim(Request.Form("FirstName"))
  570.     m_strLastName = Trim(Request.Form("LastName"))
  571.     m_strMiddleName = Trim(Request.Form("MiddleName"))
  572.     m_strKnownAs = Trim(Request.Form("KnownAs"))
  573.     m_strSSN = Trim(Request.Form("SSN"))
  574.     m_intGender = Trim(Request.Form("Gender"))
  575.     m_datBirthdate = Trim(Request.Form("Birthdate"))
  576.     If Not IsDate(m_datBirthdate) Then
  577.       m_datBirthdate = Now()
  578.     End If
  579.     m_strAddress1 = Trim(Request.Form("Address1"))
  580.     m_strAddress2 = Trim(Request.Form("Address2"))
  581.     m_strCity = Trim(Request.Form("City"))
  582.     m_strState = Trim(Request.Form("State"))
  583.     m_strPostCode = Trim(Request.Form("PostCode"))
  584.     m_strCountry = Trim(Request.Form("Country"))
  585.     m_strHomePhone = Trim(Request.Form("HomePhone"))
  586.     m_strBusinessPhone = Trim(Request.Form("BusinessPhone"))
  587.     m_strFax = Trim(Request.Form("Fax"))
  588.     m_strEmail = Trim(Request.Form("Email"))
  589.     m_lngExemptions = Trim(Request.Form("Exemptions"))
  590.     If Not IsNumeric(m_lngExemptions) Then
  591.       m_lngExemptions = 1
  592.     End If
  593.   End Sub
  594.  
  595.   ' 
  596.   ' Update the database. Return 0 if successful or 1 if an error is encountered.
  597.   '
  598.   Function UpdateDatabase
  599.     
  600.     On Error Resume Next
  601.     
  602.     Dim Employee, i
  603.     Set Employee = Server.CreateObject("Benefit.Employee")
  604.     Employee.Update Application("DSNBenefits"), Session("EmployeeId"), Session("DependentId"), _
  605.       m_strFirstName, m_strLastName, _ 
  606.       m_strMiddleName, m_strKnownAs, m_strSSN, _
  607.       m_intGender, m_datBirthdate, m_strAddress1, m_strAddress2, _
  608.       m_strCity, m_strState, m_strPostCode, m_strCountry, m_strHomePhone, _
  609.       m_strBusinessPhone, m_strFax, m_strEmail, m_lngExemptions
  610.     
  611.     ' Save Dependent records
  612.     For i = 1 to Request.Form("DependentId").Count
  613.       Employee.UpdateDependent Application("DSNBenefits"), Request.Form("DependentId")(i), _
  614.         Request.Form("DependentSSN")(i), Request.Form("DependentGender")(i), _
  615.         Request.Form("DependentBirthdate")(i)
  616.     Next
  617.     
  618.     ' Process any Dependents marked for Removal (Change status to 2 for inactive )
  619.     For i = 1 to Request.Form("RemoveDep").Count
  620.       Employee.RemoveDependent Application("DSNBenefits"), Session("EmployeeId"), _
  621.         Request.Form("RemoveDep")(i)
  622.     Next
  623.     
  624.     If Err.Number = 0 Then
  625.       UpdateDatabase = 0
  626.     Else
  627.       ContextObject.SetAbort
  628.       UpdateDatabase = 1
  629.     End If
  630.     
  631.   End Function
  632.  
  633.   Sub OnTransactionCommit
  634.   
  635.   End Sub
  636.  
  637.   Sub OnTransactionAbort    
  638.         m_strMainPrompt = "A problem occurred while trying to update the database. Please try again later. "
  639.   End Sub
  640. %>
  641.