<% ' Save URL of calling page as needed SetURLCallHIW %> How This Page Works

Behind the Scenes at Exploration Air


"> Return to Exploration Air Benefits " TITLE="Return to Exploration Air Benefits"> B  A  C  K 

V I E W   S O U R C E

How The Employee Profile Page Works


The Big Picture

This page is used to enter employee information such as address, phone number, etc. It also has a button that will take you to the page for adding a dependent.

Functional Overview

As on most other pages in the Benefits application, a few standard tasks are done at the top of the page. The first is that VBScript is declared the default scripting language for the page. Next, "TRANSACTION=REQUIRED" is specified to cause Microsoft Transaction Server to wrap the actions of the page in a transaction. Then, "Option Explicit" is specified so that an error will generate unless all the variables on the page are explicitly declared. This protects against errors caused by misspelling a variable name and having the server treat the misspelled variable name as a new variable declaration.

Next, libAuthenticate.inc checks whether the user has a Session variable containing the EmployeeId. If not, then the request is redirected to Benefits/Default.asp to ensure that the application is properly initialized for the user.

Next, page variables are initialized, then the subprocedure GetValuesFromDatabase is called to get the current employee profile information from the database by calling the component method Employee.GetForID.

The subprocedure BuildGenderList is called to create a select list of the available Genders from the database by calling the component method BenefitList.GenderList

A table of dependent records for the employee are created by the subprocedure ListDependents, which retrieves records from the database by calling Employee.GetDependents.

The page is sent to the client browser for entry of the dependent information. A client-side script is run to validate the data entered, then the data is sent to the server. The server runs a subprocedure to get the data into the appropriate fields, then calls the function "UpdateDatabase". The UpdateDatabase function calls the component method Employee.Update to update the employee records.

The UpdateDatabase function calls the component method Employee.UpdateDependent to update dependent records.

The UpdateDatabase function then calls the component method Employee.RemoveDependent to remove any dependents who are marked for removal from the employee records.

If the Add Dependent button is clicked, the page will redirect to DependentAdd.asp after updating the employee tables.

Data Model

You can view a diagram of the database.

Components Used

This pages uses methods in the BenefitList class of the Benefit component.
Employee.GetForID
BenefitList.GenderList
Employee.GetDependents
Employee.Update
Employee.UpdateDependent
Employee.RemoveDependent



©1997 Microsoft Corporation. All rights reserved. Terms of Use.

<% ' ' SetURLCallHIW saves the name of the page in the application that called HIW page ' Sub SetURLCallHIW ' Extract the last directory from path Dim strPathInfo, strLastChar, intLocation, ShortString, strLastDir strPathInfo = Request.ServerVariables("HTTP_REFERER") ' now str has a value like: "http://servername/exair/benefits/Default.asp" ' we need to extract "benefits" strLastChar = "" ShortString = strPathInfo intLocation = 0 If Len(ShortString) > 0 Then ' Get position of beginning of file name Do Until strLastChar = "/" strLastChar = right(ShortString, 1) ShortString = left(ShortString, len(ShortString)-1) intLocation = intLocation + 1 Loop ' Now get position of beginning of last directory name strLastChar = "" Do Until strLastChar = "/" strLastChar = right(ShortString, 1) ShortString = left(ShortString, len(ShortString)-1) intLocation = intLocation + 1 Loop strLastDir = mid(strPathInfo, len(strPathInfo) - (intLocation - 2), 10) ' If last directory not 'HowItWorks', then save the calling URL If strLastDir <> "HowItWorks" Then Session("URLCallHIW") = strPathInfo End If End If End Sub %>