home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / HIWBenefitsDependentAdd.asp < prev    next >
Text File  |  1997-11-01  |  8KB  |  217 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/DependentAdd.asp')" 
  53.           TITLE="View the Source for the Default 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 Add Dependent 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 for entry of information about a new dependent.
  74.  
  75.             <H2>Functional Overview</H2>
  76.  
  77.             As on most other pages in the Benefits application, a few standard tasks are
  78.             done at the top of the page. The first is that VBScript is declared the default 
  79.             scripting language for the page. Next, "TRANSACTION=REQUIRED" is specified to cause
  80.             Microsoft Transaction Server to wrap the actions of the page in a transaction.
  81.             Then, "Option Explicit" is specified so that an error will generate unless
  82.             all the variables on the page are explicitly declared. This protects against
  83.             errors caused by misspelling a variable name and having the server treat 
  84.             the misspelled variable name as a new variable declaration.
  85.         
  86.             <P>Next, libAuthenticate.inc checks whether the user has a Session variable containing
  87.             the EmployeeId. If not, then the request is redirected to Benefits/Default.asp 
  88.             to ensure that the application is properly initialized for the user.
  89.              
  90.             <P>Next, page variables are initialized, then the subprocedure BuildDependentTypeList
  91.             creates a select list of the available dependent types from
  92.             the database by calling the component method 
  93.             <STRONG><A HREF=HIWBenefitsComponent.asp#DependentTypeList>
  94.             BenefitList.DependentTypeList</A></STRONG>. 
  95.             
  96.             <P>The subprocedure BuildGenderList
  97.             is called to create a select list of the available Genders from
  98.             the database by calling the component method 
  99.             <STRONG><A HREF=HIWBenefitsComponent.asp#GenderList>
  100.             BenefitList.GenderList</A></STRONG>, and the subprocedure 
  101.             BuildChangeQualifierList is called to create a select list of the available 
  102.             Qualifiers from the database by calling the component method 
  103.             <STRONG><A HREF=HIWBenefitsComponent.asp#ChangeQualifierList>
  104.             BenefitList.ChangeQualifierList</A></STRONG>.
  105.  
  106.             <P>The page is sent to the client
  107.             browser for entry of the change information. A client-side script is run to validate 
  108.             the data entered, then the data is sent to the server. The server runs a 
  109.             subprocedure to get the data into the appropriate fields, then calls a function
  110.             called "UpdateDatabase" to update the database. The UpdateDatabase function calls
  111.             the component method <STRONG><A HREF=HIWBenefitsComponent.asp#AddDependent>
  112.             Employee.AddDependent</A></STRONG> to add the dependent record, and then
  113.             calls <STRONG><A HREF=HIWBenefitsComponent.asp#AddQualifier>
  114.             BenefitList.AddQualifier</A></STRONG> to add the qualifier record.
  115.  
  116.             <H2>Data Model</H2>
  117.  
  118.             You can view a diagram of the <STRONG><A HREF="HIWBenefitsSchema.asp">database</A></STRONG>.
  119.  
  120.             <P>
  121.             <H2>Components Used</H2>
  122.  
  123.             This pages uses methods in the BenefitList class and Employee class of the 
  124.             Benefit component.
  125.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#DependentTypeList>BenefitList.DependentTypeList</A></STRONG>
  126.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#GenderList>BenefitList.GenderList</A></STRONG>
  127.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#ChangeQualifierList>BenefitList.ChangeQualifierList</A></STRONG>
  128.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#AddDependent>Employee.AddDependent</A></STRONG>
  129.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#AddQualifier>BenefitList.AddQualifier</A></STRONG>
  130.  
  131.             <P>
  132.             </FONT>
  133.           </TD>
  134.         </TR>
  135.       </TABLE>
  136.       <!--END TOP TABLE HOLDING GRAPHIC, NAVIGATIONAL LINK, AND MAIN CONTENT-->
  137.  
  138.       <BR>
  139.       <BR>
  140.  
  141.       <CENTER>
  142.       <!--BEGIN LEGAL INFORMATION-->
  143.       <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
  144.         <TR>
  145.           <TD>
  146.             <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1">
  147.               <A HREF="../legal.htm">
  148.                 ©1997 Microsoft Corporation. All rights reserved. Terms of Use.
  149.               </A>
  150.             </FONT>
  151.             <P>
  152.           </TD>
  153.         </TR>
  154.       </TABLE>
  155.       </CENTER>
  156.       <!--END LEGAL INFORMATION-->
  157.     </TD>
  158.   </TR>
  159. </TABLE>
  160.  
  161. </BODY>
  162. </HTML>
  163. <!--END HTML-->
  164.  
  165. <SCRIPT LANGUAGE="JavaScript">
  166. function openWindow(SourceURL)
  167. {
  168.     // Set some defaults
  169.     width=450;
  170.     height=450;
  171.  
  172.     url = "code.asp?Source=" + SourceURL;
  173.     window.open(url,"Sample","resizable=yes,scrollbars=yes,width=" + width + ",height=" + height);
  174. }
  175. </SCRIPT>
  176.  
  177. <%
  178.  
  179.   '
  180.   ' SetURLCallHIW saves the name of the page in the application that called HIW page
  181.   '
  182.   Sub SetURLCallHIW
  183.     ' Extract the last directory from path
  184.     Dim strPathInfo, strLastChar, intLocation, ShortString, strLastDir
  185.     strPathInfo = Request.ServerVariables("HTTP_REFERER")
  186.     ' now str has a value like: "http://servername/exair/benefits/Default.asp"
  187.     ' we need to extract "benefits"
  188.     strLastChar = ""
  189.     ShortString = strPathInfo
  190.     intLocation = 0
  191.     
  192.     If Len(ShortString) > 0 Then
  193.         ' Get position of beginning of file name
  194.         Do Until strLastChar = "/"
  195.           strLastChar = right(ShortString, 1)
  196.           ShortString = left(ShortString, len(ShortString)-1)
  197.           intLocation = intLocation + 1
  198.         Loop
  199.     
  200.         ' Now get position of beginning of last directory name
  201.         strLastChar = ""
  202.         Do Until strLastChar = "/"
  203.           strLastChar = right(ShortString, 1)
  204.           ShortString = left(ShortString, len(ShortString)-1)
  205.           intLocation = intLocation + 1
  206.         Loop
  207.         strLastDir = mid(strPathInfo, len(strPathInfo) - (intLocation - 2), 10)
  208.     
  209.         ' If last directory not 'HowItWorks', then save the calling URL
  210.         If strLastDir <> "HowItWorks" Then
  211.           Session("URLCallHIW") = strPathInfo
  212.         End If
  213.     End If
  214.   End Sub
  215.  
  216. %>
  217.