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

  1. <%
  2.  
  3.   ' Save URL of calling page as needed
  4.   SetURLCallHIW
  5.  
  6. %>
  7.  
  8. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  9. <HTML>
  10. <HEAD>
  11. <!--META TAGS ARE RECOMMENDED FOR THE SEARCH ENGINE-->
  12. <META NAME="DESCRIPTION" CONTENT="How It Works Page">
  13. <META NAME="KEYWORDS" CONTENT="help, code, source code, questions, explanation">
  14. <META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev 1.0">
  15. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
  16. <!--END META TAGS-->
  17.  
  18. <TITLE>How This Page Works</TITLE>
  19. </HEAD>
  20.  
  21. <BODY  BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#808080 LINK=#FFCC00>
  22. <BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
  23.  
  24. <!--Change link color on mouseover
  25.     Only if running Internet Explorer 4.0 or later -->
  26. <!--#include file=../libHighlight.inc-->
  27.  
  28. <!--BEGIN TOP TABLE HOLDING GRAPHIC, NAVIGATIONAL LINK, AND MAIN CONTENT-->
  29. <TABLE WIDTH="100%" HEIGHT="100%" CELLPADDING=0 CELLSPACING=0  BGCOLOR="#000000" BORDER=0>
  30.   <TR>
  31.     <TD BGCOLOR="#000000" ALIGN=CENTER VALIGN=TOP WIDTH=170>
  32.       <BR>
  33.       <IMG SRC="../images/btslarge.jpg" HEIGHT=119 WIDTH=171  
  34.         ALT="Behind the Scenes at Exploration Air" BORDER=0 >
  35.       <BR>
  36.       <BR>
  37.       <BR>
  38.       <!--BACK BUTTON AND VARIABLE TO RETURN TO ORIGINATING PAGE-->
  39.       <A HREF="<%=Session("URLCallHIW")%>">
  40.         <IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 ALT="Return to Exploration Air Benefits"  
  41.           HSPACE=2 BORDER=0>
  42.       </A>
  43.       <FONT SIZE=2 FACE="VERDANA, ARIAL, HELVETICA"><STRONG>
  44.         <A HREF="<%=Session("URLCallHIW")%>" TITLE="Return to Exploration Air Benefits">
  45.           B  A  C  K 
  46.         </A>
  47.       </STRONG></FONT>
  48.       <BR> 
  49.       <BR>
  50.       <!--JAVASCRIPT TO VIEW PAGE'S SOURCE CODE-->
  51.       <FONT SIZE=2 FACE="VERDANA, ARIAL, HELVETICA">
  52.         <A HREF="JavaScript:openWindow('../Benefits/EmpProfile.asp')" 
  53.           TITLE="View the Source for the Employee Profile page">
  54.           V I E W   S O U R C E
  55.         </A>
  56.         <BR>
  57.       </FONT>
  58.     </TD>
  59.     <TD BGCOLOR="#FFFFFF" BACKGROUND="../images/btsbg.gif" VALIGN=top>
  60.       <BR CLEAR=ALL>
  61.       <TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0>   
  62.         <TR>
  63.           <TD VALIGN=top>
  64.             <FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=5>
  65.               How The Employee Profile Page Works
  66.             </FONT>
  67.             <P>
  68.             <HR>
  69.             <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="3">
  70.                         
  71.             <H2>The Big Picture</H2>
  72.  
  73.             This page is used to enter employee information such as address, phone number, etc.
  74.             It also has a button that will take you to the page for adding a dependent.
  75.  
  76.             <H2>Functional Overview</H2>
  77.  
  78.             As on most other pages in the Benefits application, a few standard tasks are
  79.             done at the top of the page. The first is that VBScript is declared the default 
  80.             scripting language for the page. Next, "TRANSACTION=REQUIRED" is specified to cause
  81.             Microsoft Transaction Server to wrap the actions of the page in a transaction.
  82.             Then, "Option Explicit" is specified so that an error will generate unless
  83.             all the variables on the page are explicitly declared. This protects against
  84.             errors caused by misspelling a variable name and having the server treat 
  85.             the misspelled variable name as a new variable declaration.
  86.         
  87.             <P>Next, libAuthenticate.inc checks whether the user has a Session variable containing
  88.             the EmployeeId. If not, then the request is redirected to Benefits/Default.asp 
  89.             to ensure that the application is properly initialized for the user.
  90.              
  91.             <P>Next, page variables are initialized, then the subprocedure GetValuesFromDatabase
  92.             is called to get the current employee profile information from the database
  93.             by calling the component method 
  94.             <STRONG><A HREF=HIWBenefitsComponent.asp#GetForID>
  95.             Employee.GetForID</A></STRONG>. 
  96.             
  97.             <P>The subprocedure BuildGenderList is called to create a select list of 
  98.             the available Genders from the database by calling the component method 
  99.             <STRONG><A HREF=HIWBenefitsComponent.asp#GenderList>
  100.             BenefitList.GenderList</A></STRONG>
  101.  
  102.             <P>A table of dependent records for the employee
  103.             are created by the subprocedure ListDependents, which retrieves records from
  104.             the database by calling <STRONG><A HREF=HIWBenefitsComponent.asp#GetDependents>
  105.             Employee.GetDependents</A></STRONG>. 
  106.             
  107.             <P>The page is sent to the client
  108.             browser for entry of the dependent information. A client-side script is run to validate 
  109.             the data entered, then the data is sent to the server. The server runs a 
  110.             subprocedure to get the data into the appropriate fields, then calls the function
  111.             "UpdateDatabase". The UpdateDatabase function calls
  112.             the component method <STRONG><A HREF=HIWBenefitsComponent.asp#UpdateEmployee>
  113.             Employee.Update</A></STRONG> to update the employee records. 
  114.  
  115.             <P>The UpdateDatabase function calls the component method 
  116.             <STRONG><A HREF=HIWBenefitsComponent.asp#UpdateDependent>Employee.UpdateDependent</A></STRONG>
  117.             to update dependent records.
  118.                         
  119.             <P>The UpdateDatabase function then calls the component method 
  120.             <STRONG><A HREF=HIWBenefitsComponent.asp#RemoveDependent>
  121.             Employee.RemoveDependent</A></STRONG> to remove any dependents who are marked for
  122.             removal from the employee records.
  123.  
  124.             <P>If the <STRONG>Add Dependent</STRONG> button is clicked, the page will redirect to
  125.             <STRONG>DependentAdd.asp</STRONG> after updating the employee tables.
  126.  
  127.             <H2>Data Model</H2>
  128.  
  129.             You can view a diagram of the <STRONG><A HREF="HIWBenefitsSchema.asp">database</A></STRONG>.
  130.  
  131.             <P>
  132.             <H2>Components Used</H2>
  133.  
  134.             This pages uses methods in the BenefitList class of the Benefit component.
  135.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#GetForID>Employee.GetForID</A></STRONG>
  136.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#GenderList>BenefitList.GenderList</A></STRONG>
  137.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#GetDependents>Employee.GetDependents</A></STRONG>
  138.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#UpdateEmployee>Employee.Update</A></STRONG>
  139.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#UpdateDependent>Employee.UpdateDependent</A></STRONG>
  140.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#RemoveDependent>Employee.RemoveDependent</A></STRONG>
  141.             <P>
  142.             </FONT>
  143.           </TD>
  144.         </TR>
  145.       </TABLE>
  146.       <!--END TOP TABLE HOLDING GRAPHIC, NAVIGATIONAL LINK, AND MAIN CONTENT-->
  147.  
  148.       <BR>
  149.       <BR>
  150.  
  151.       <CENTER>
  152.       <!--BEGIN LEGAL INFORMATION-->
  153.       <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
  154.         <TR>
  155.           <TD>
  156.             <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1">
  157.               <A HREF="../legal.htm">
  158.                 ©1997 Microsoft Corporation. All rights reserved. Terms of Use.
  159.               </A>
  160.             </FONT>
  161.             <P>
  162.           </TD>
  163.         </TR>
  164.       </TABLE>
  165.       </CENTER>
  166.       <!--END LEGAL INFORMATION-->
  167.     </TD>
  168.   </TR>
  169. </TABLE>
  170.  
  171. </BODY>
  172. </HTML>
  173. <!--END HTML-->
  174.  
  175. <SCRIPT LANGUAGE="JavaScript">
  176. function openWindow(SourceURL)
  177. {
  178.     // Set some defaults
  179.     width=450;
  180.     height=450;
  181.  
  182.     url = "code.asp?Source=" + SourceURL;
  183.     window.open(url,"Sample","resizable=yes,scrollbars=yes,width=" + width + ",height=" + height);
  184. }
  185. </SCRIPT>
  186.  
  187. <%
  188.  
  189.   '
  190.   ' SetURLCallHIW saves the name of the page in the application that called HIW page
  191.   '
  192.   Sub SetURLCallHIW
  193.     ' Extract the last directory from path
  194.     Dim strPathInfo, strLastChar, intLocation, ShortString, strLastDir
  195.     strPathInfo = Request.ServerVariables("HTTP_REFERER")
  196.     ' now str has a value like: "http://servername/exair/benefits/Default.asp"
  197.     ' we need to extract "benefits"
  198.     strLastChar = ""
  199.     ShortString = strPathInfo
  200.     intLocation = 0
  201.     
  202.     If Len(ShortString) > 0 Then
  203.         ' Get position of beginning of file name
  204.         Do Until strLastChar = "/"
  205.           strLastChar = right(ShortString, 1)
  206.           ShortString = left(ShortString, len(ShortString)-1)
  207.           intLocation = intLocation + 1
  208.         Loop
  209.     
  210.         ' Now get position of beginning of last directory name
  211.         strLastChar = ""
  212.         Do Until strLastChar = "/"
  213.           strLastChar = right(ShortString, 1)
  214.           ShortString = left(ShortString, len(ShortString)-1)
  215.           intLocation = intLocation + 1
  216.         Loop
  217.         strLastDir = mid(strPathInfo, len(strPathInfo) - (intLocation - 2), 10)
  218.     
  219.         ' If last directory not 'HowItWorks', then save the calling URL
  220.         If strLastDir <> "HowItWorks" Then
  221.           Session("URLCallHIW") = strPathInfo
  222.         End If
  223.     End If
  224.   End Sub
  225.  
  226. %>
  227.