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

  1. <%@ LANGUAGE="VBSCRIPT" TRANSACTION=REQUIRED %>
  2. <% Option Explicit %>
  3. <%
  4.     '
  5.     ' This page needs to be authenticated differently from other pages because it 
  6.     ' can be called by a new user who does not yet have an account number. Thus, 
  7.     ' libAuthenticate.asp isn't called. The following code is used instead
  8.     '
  9.     ' check if user tried to get to this page directly, without using appropriate URLs
  10.     If Request("UpdateUser") = "" Then 
  11.         Response.Redirect("login.asp")
  12.         Response.End
  13.     ' Or maybe a sneaky user typed in UpdateUser=1 in the URL but hasn't really logged on:
  14.     ElseIf CInt(Request.QueryString("UpdateUser")) = 1 And Session("AccountID") = "" Then
  15.         Response.Redirect("login.asp")
  16.         Response.End
  17.     End If
  18.     
  19.   '
  20.   ' User information variables. Values for these are retrieved from the database for
  21.   ' existing users and submitted to the database for new users and user updates
  22.   '
  23.   Dim m_strFirstName, m_strLastName, m_strMiddleName, m_strKnownAs, m_strGender, m_strAddress1, _
  24.     m_strAddress2, m_strCity, m_strState, m_strPostCode, m_strCountry, m_strHomePhone, _ 
  25.     m_strBusinessPhone, m_strFax, m_strEmail, m_strWebSite, _
  26.     m_strMeal, m_strSeating, m_strSmoking, m_strExitRow, m_lngAccountID
  27.  
  28.   '
  29.   ' Status variables. 
  30.   '
  31.   Dim m_intUpdate         ' Value of 1 if this is an existing user, 0 if a new user
  32.   Dim m_intRequestToSave  ' Value of 0 means to display the page, 0 to process the form
  33.     
  34.       
  35.   Dim m_strMainPrompt, m_strDSN
  36.     
  37.  
  38.   '
  39.   ' Initialize some page level variables
  40.   '
  41.   m_intUpdate = Cint(Request("UpdateUser"))
  42.     
  43.   m_intRequestToSave = Cint(Request.Form("RequestToSave"))
  44.   m_lngAccountID = Session("AccountID")
  45.   m_strDSN = Application("DSN")
  46.  
  47.   '
  48.   ' This block determines whether to display the page, or attempt to update the
  49.   ' database and then redirect.
  50.   '
  51.   If m_intRequestToSave = 1 Then
  52.     GetValuesFromForm
  53.     If UpdateDatabase = 0 Then ' database update occurred successfully
  54.       If m_intUpdate = 0 Then ' Send to a new user page to get AccountID and Password
  55.         Response.Redirect("Welcome.asp")
  56.         Response.End
  57.       Else ' Existing user, send back to Frequent flyer Home Page
  58.         Response.Redirect("default.asp")
  59.         Response.End
  60.       End If
  61.     Else  ' database update did not occur successfully so let the user know
  62.       
  63.     End If
  64.   Else
  65.     If m_intUpdate = 1 Then
  66.       m_strMainPrompt = "Please make any changes you desire to the information listed below.<BR>" & _
  67.         "The items listed in <STRONG>bold</STRONG> and marked by a blue bullet are required.<BR>" & _
  68.         "Select Save when you are done."
  69.       GetValuesFromDatabase
  70.     Else
  71.       m_strMainPrompt = "Welcome to the Exploration Air Frequent Flyer Club!<BR>" & _
  72.         "Please fill out the member information listed below. " & _
  73.         "The items listed in <STRONG>bold</STRONG> are required. " & _
  74.         "Select Save when you are done to receive your frequent flyer number."
  75.     End If
  76.   End If
  77. %>
  78.  
  79. <!--BEGIN HTML-->
  80. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  81. <HTML>
  82. <HEAD>
  83. <META NAME="DESCRIPTION" Content="Exploration Air's profile information">
  84. <META NAME="KEYWORDS" CONTENT="profile, join, log on, sign up, club, update">
  85. <META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev 1.0">
  86. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
  87. <TITLE>Manage Your Profile</TITLE>
  88. </HEAD>
  89.  
  90. <BODY BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#228B22 LINK=#23238E>
  91. <BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
  92.  
  93. <!--Change link color on mouseover
  94.     Only if running Internet Explorer 4.0 or later -->
  95. <!--#include file=../libHighlight.inc-->
  96. <!--#include file=../libGlobalFuncs.inc-->
  97.  
  98. <!--COLOR BANNER_START-->
  99. <CENTER>
  100. <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
  101.     <TR>
  102.     <TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
  103.     </TD>
  104.     </TR>
  105.     </TABLE>
  106. <!--COLOR BANNER_END-->
  107.  
  108. <!--BEGIN TOP TABLE CONTAINING LOGO AND NAVIGATIONAL LINK-->
  109. <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
  110.     <TR>
  111.     <TD VALIGN=TOP WIDTH=325>
  112.     <A HREF="<%=HomePage("..")%>"><IMG SRC="../images/logo_sm.gif" WIDTH=200 HEIGHT=100 ALT="Return to Exploration Air Home Page" BORDER=0></A>
  113.     <BR>
  114.     <A HREF="Default.asp"><IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 HSPACE=5 ALT="Return to Frequent Flyer Home Page" BORDER=0></A> <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2" ><STRONG><A HREF="Default.asp">FREQUENT FLYER      HOME PAGE</A></STRONG></FONT>
  115.     </TD>
  116.     <TD WIDTH=200>
  117.     <FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=5>
  118.     Manage Your Profile</FONT>
  119. </TD>
  120. <TD VALIGN=TOP ALIGN=RIGHT>
  121. <A HREF="../HowItWorks/HIWProfile.asp"><IMG SRC="../images/btssmall.gif" WIDTH="115" HEIGHT="52" ALT="Click here to learn how this page works" BORDER=0></A>
  122. </TD>
  123. </TR>
  124. </TABLE>
  125. <!--END TABLE CONTAINING LOGO AND NAVIGATIONAL LINK -->
  126. <BR>
  127.  
  128. <%= m_strMainPrompt %>
  129.  
  130. <BR>
  131.  
  132. <!--BEGIN FORM-->
  133. <FORM NAME="ProfileForm" METHOD=POST ACTION="Profile.asp" LANGUAGE="JavaScript"
  134.   onSubmit="if (!validateForm(document.ProfileForm))
  135.             {
  136.               alert ('Please provide all of the required information (listed in bold), then select Save.');
  137.               return false;
  138.              }">
  139.   <INPUT TYPE=HIDDEN NAME="RequestToSave" Value=1>
  140.   <INPUT TYPE=HIDDEN NAME="UpdateUser" Value = <%= m_intUpdate %>>
  141.  
  142. <TABLE BACKGROUND="images/btsbgflip.gif" COLS=2  TOPMARGIN=0 cellspacing=0 WIDTH=600 BORDERCOLOR=#0000000 BORDER=1 CELLPADDING=1>
  143.     <TR>
  144.         <TD VALIGN=TOP>
  145.             <TABLE COLS=4 WIDTH=300 CELLPADDING=1 CELLSPACING=0 BORDER=0> 
  146.                 <TR>
  147.                     <TD BGCOLOR="#C71585" COLSPAN=4><STRONG><FONT COLOR="#FFFFFF"> Personal Information</FONT></STRONG>
  148.                     </TD>
  149.                 </TR>
  150.                 <TR>
  151.                     <TD WIDTH=110>
  152.                            <IMG SRC="images/bulletb.gif"><STRONG>First Name:</STRONG>
  153.                        </TD>
  154.                        <TD COLSPAN=3 WIDTH=190>
  155.                            <INPUT SIZE=25 MAXLENGTH=20 NAME="FirstName" VALUE="<%= m_strFirstName %>"> 
  156.                        </TD>      
  157.                 </TR>
  158.                 <TR>
  159.                     <TD>
  160.                         <IMG SRC="images/bulletb.gif"><STRONG>Last Name:</STRONG>
  161.                        </TD>
  162.                        <TD COLSPAN=3>
  163.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="LastName" VALUE="<%= m_strLastName %>">
  164.                       </TD>
  165.                 </TR>
  166.     
  167.                 <TR>
  168.                     <TD>
  169.                          Middle Name:
  170.                        </TD>
  171.                        <TD COLSPAN=3>
  172.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="MiddleName" VALUE="<%= m_strMiddleName %>">
  173.                       </TD>
  174.                 </TR>
  175.                 <TR>
  176.                     <TD>
  177.                          Known As:
  178.                        </TD>
  179.                        <TD COLSPAN=3>
  180.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="KnownAs" VALUE="<%= m_strKnownAs %>">
  181.                       </TD>
  182.                 </TR>
  183.                 <TR>
  184.                     <TD>
  185.                          Gender:
  186.                        </TD>
  187.                        <TD COLSPAN=3>
  188.                         <SELECT NAME="Gender">
  189.                             <OPTION VALUE=" ">
  190.                             <OPTION VALUE="F"<% If m_strGender = "F" Then %> SELECTED<% End If %>>Female
  191.                             <OPTION VALUE="M"<% If m_strGender = "M" Then %> SELECTED<% End If %>>Male
  192.                            </SELECT>
  193.                     </TD>
  194.                 </TR>
  195.                 <TR>
  196.                     <TD>
  197.                         <IMG SRC="images/bulletb.gif"><STRONG>Address 1</STRONG>
  198.                        </TD>
  199.                        <TD COLSPAN=3>
  200.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="Address1" VALUE="<%= m_strAddress1 %>">
  201.                       </TD>
  202.                 </TR>
  203.                 <TR>
  204.                     <TD>
  205.                          Address 2
  206.                        </TD>
  207.                        <TD COLSPAN=3>
  208.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="Address2" VALUE="<%= m_strAddress2 %>">
  209.                       </TD>
  210.                 </TR>
  211.                 <TR>
  212.                     <TD>
  213.                         <IMG SRC="images/bulletb.gif"><STRONG>City</STRONG>
  214.                        </TD>
  215.                        <TD COLSPAN=3>
  216.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="City" VALUE="<%= m_strCity %>">
  217.                       </TD>
  218.                 </TR>
  219.                 <TR>
  220.                     <TD>
  221.                         <IMG SRC="images/bulletb.gif"><STRONG>State/Province</STRONG>
  222.                        </TD>
  223.                        <TD COLSPAN=3>
  224.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="State" VALUE="<%= m_strState %>">
  225.                       </TD>
  226.                 </TR>
  227.                 <TR>
  228.                     <TD>
  229.                         <IMG SRC="images/bulletb.gif"><STRONG>Postal Code:</STRONG>
  230.                        </TD>
  231.                        <TD COLSPAN=3>
  232.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="PostCode" VALUE="<%= m_strPostCode %>">
  233.                       </TD>
  234.                 </TR>
  235.                 <TR>
  236.                     <TD>
  237.                         <IMG SRC="images/bulletb.gif"><STRONG>Country:</STRONG>
  238.                        </TD>
  239.                        <TD COLSPAN=3>
  240.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="Country" VALUE="<%= m_strCountry %>">
  241.                       </TD>
  242.                 </TR>
  243.             </TABLE>
  244.  
  245.         </TD>
  246.         <TD VALIGN=TOP>
  247.             <TABLE COLS=4 WIDTH=300 CELLPADDING=1 CELLSPACING=0 BORDER=0> 
  248.                 <TR>
  249.                     <TD BGCOLOR="#C71585" COLSPAN=2>
  250.                         <STRONG><FONT COLOR="#FFFFFF"> Contact Information</FONT></STRONG>
  251.                     </TD>
  252.                 </TR>
  253.                 <TR>
  254.                     <TD WIDTH=225>
  255.                          Home<BR> Phone 
  256.                        </TD>
  257.                        <TD WIDTH=75>
  258.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="HomePhone" VALUE="<%= m_strHomePhone %>">
  259.                       </TD>
  260.                 </TR>
  261.                 <TR>
  262.                     <TD WIDTH=225>
  263.                          Business<BR> Phone
  264.                        </TD>
  265.                        <TD WIDTH=75>
  266.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="BusinessPhone" VALUE="<%= m_strBusinessPhone %> ">
  267.                       </TD>
  268.                 </TR>
  269.                 <TR>
  270.                     <TD WIDTH=225>
  271.                          Fax:
  272.                        </TD>
  273.                         <TD WIDTH=75>
  274.                         <INPUT SIZE=25 MAXLENGTH=20 NAME="Fax" VALUE="<%= m_strFax %>">
  275.                     </TD>
  276.                 </TR>
  277.                 <TR>
  278.                     <TD WIDTH=225>
  279.                          E-mail<BR>
  280.                          Address:
  281.                        </TD>
  282.                        <TD WIDTH=75>
  283.                         <INPUT SIZE=25 MAXLENGTH=30 NAME="Email" VALUE="<%= m_strEmail %>">
  284.                     </TD>
  285.                 </TR>
  286.                 <TR>
  287.                     <TD WIDTH=225>
  288.                          Web Site:
  289.                        </TD>
  290.                        <TD WIDTH=75>
  291.                         <INPUT SIZE=25 MAXLENGTH=30 NAME="WebSite" VALUE="<%= m_strWebSite %>">
  292.                     </TD>
  293.                 </TR>
  294.                 <TR>
  295.                     <TD BGCOLOR="#C71585" COLSPAN=2>
  296.                         <STRONG><FONT COLOR="#FFFFFF"> In-flight Preferences</FONT></STRONG>
  297.                     </TD>
  298.                 </TR>
  299.                    <TR>
  300.                        <TD WIDTH=225>
  301.                             Meal<BR> Preference:
  302.                        </TD>
  303.                     <TD WIDTH=75>
  304.                            <SELECT NAME="Meal">
  305.                              <OPTION VALUE="N"<% If m_strMeal = "N" Then %> SELECTED<% End If %>>None
  306.                             <OPTION VALUE="V"<% If m_strMeal = "V" Then %> SELECTED<% End If %>>Vegetarian
  307.                              <OPTION VALUE="L"<% If m_strMeal = "L" Then %> SELECTED<% End If %>>Low-sodium
  308.                             <OPTION VALUE="O"<% If m_strMeal = "O" Then %> SELECTED<% End If %>>Organically-grown
  309.                            </SELECT>
  310.                     </TD>
  311.                 </TR>
  312.                 <TR>
  313.                        <TD WIDTH=225>
  314.                             Seat<BR> Preference:
  315.                        </TD>
  316.                        <TD WIDTH=75>
  317.                         <SELECT NAME="Seating">
  318.                             <OPTION VALUE="N"<% If m_strSeating = "N" Then %> SELECTED<% End If %>>None
  319.                             <OPTION VALUE="A"<% If m_strSeating = "A" Then %> SELECTED<% End If %>>Aisle
  320.                               <OPTION VALUE="W"<% If m_strSeating = "W" Then %> SELECTED<% End If %>>Window
  321.                         </SELECT>
  322.                     </TD>
  323.                 </TR>
  324.                 <TR>
  325.                        <TD WIDTH=225>
  326.                             Special<BR> Seating:
  327.                        </TD>
  328.                        <TD WIDTH=75>
  329.                         <SELECT NAME="ExitRow">
  330.                             <OPTION VALUE="N"<% If m_strExitRow = "N" Then %> SELECTED<% End If %>>None
  331.                             <OPTION VALUE="E"<% If m_strExitRow = "E" Then %> SELECTED<% End If %>>Exit Row
  332.                              <OPTION VALUE="B"<% If m_strExitRow = "B" Then %> SELECTED<% End If %>>Bulkhead
  333.                         </SELECT>
  334.                     </TD>
  335.                 </TR>
  336.             </TABLE>
  337.         </TD>
  338.     </TR>
  339. </TABLE>
  340.  
  341. <P>
  342. <CENTER>
  343. <% 
  344.   '
  345.   ' ListInterests is a function on this page which will 
  346.   ' dynamically generate a form based on the interests currently being tracked
  347.   ' in the database and check off the ones previously selected by the user.
  348.   ' 
  349.   ListInterests 
  350. %>
  351.  
  352. <P>
  353. <CENTER><INPUT TYPE="Submit" VALUE="Save"></FORM></CENTER>
  354. <!--END FORM-->
  355.  
  356.  
  357. <P> 
  358. <HR=400>
  359. <P>
  360.  
  361. <!--BEGIN LEGAL INFORMATION-->
  362. <CENTER>
  363. <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1"><A HREF="../legal.htm">©1997 Microsoft Corporation. All rights reserved. Terms of Use.</A></FONT></CENTER>
  364. <!--END LEGAL INFORMATION-->
  365.  
  366. <P>
  367.  
  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.  
  383. <SCRIPT LANGUAGE="JavaScript">
  384. // Begin client side helper functions
  385.   function validateForm(form)
  386.   {
  387.     if (isEmpty(form.FirstName)) return false;
  388.     if (isEmpty(form.LastName)) return false;
  389.     if (isEmpty(form.Address1)) return false;
  390.     if (isEmpty(form.City)) return false;
  391.     if (isEmpty(form.State)) return false;
  392.     if (isEmpty(form.PostCode)) return false;
  393.     if (isEmpty(form.Country)) return false;
  394.     
  395.     return true;
  396.   }
  397.  
  398.   function isEmpty(textcontrol)
  399.   {
  400.     str = textcontrol.value
  401.     for (i = 0; i < str.length; i++)
  402.     {
  403.       chr = str.substring(i, i + 1);
  404.       if (chr != ' ')
  405.       {
  406.         return false;
  407.       }
  408.     }
  409.     return true;
  410.   }
  411.  
  412. </SCRIPT>
  413.  
  414. <%
  415.   '
  416.   ' Begin server side helper functions
  417.   '
  418.  
  419.   '
  420.   ' Set page level variables to values retrieved from database
  421.   '
  422.   Sub GetValuesFromDatabase()
  423.     Dim Member, rstMember
  424.     Set Member = Server.CreateObject("ExAir.Member")
  425.     rstMember = Member.GetForID(m_strDSN, m_lngAccountID)
  426.     m_strFirstName = rstMember("FirstName")
  427.     m_strLastName = rstMember("LastName")
  428.     m_strMiddleName = rstMember("MiddleName")
  429.     m_strKnownAs = rstMember("KnownAs")
  430.     m_strGender = rstMember("Gender")
  431.     m_strAddress1 = rstMember("Address1")
  432.     m_strAddress2 = rstMember("Address2")
  433.     m_strCity = rstMember("City")
  434.     m_strState = rstMember("State")
  435.     m_strPostCode = rstMember("PostCode")
  436.     m_strCountry = rstMember("Country")
  437.     m_strHomePhone = rstMember("HomePhone")
  438.     m_strBusinessPhone = rstMember("BusinessPhone")
  439.     m_strFax = rstMember("Fax")
  440.     m_strEmail = rstMember("Email")
  441.     m_strWebSite = rstMember("WebSite")
  442.     m_strMeal = rstMember("Meal")
  443.     m_strSeating = rstMember("Seating")
  444.     m_strExitRow = rstMember("ExitRow")
  445.   End Sub
  446.  
  447.   '
  448.   ' This subroutine is called in the middle of the User Profile form to generate
  449.   ' a table of checkboxes for the interests currently being stored in the database
  450.   ' and check off the ones indicated by the user
  451.   '
  452.   Sub ListInterests
  453.       Dim Member, Interest, rstInterests, strCheckBox, _
  454.         strInterestName, intInterestNumber, strCategoryName, _
  455.         strNewCategoryName, intInterestCounter, strTH, strTD, strSpacer
  456.  
  457.       strTH = "<TH BGCOLOR=#C71585 COLSPAN=3 ALIGN=CENTER><FONT FACE=VERDANA, ARIAL, HELVETICA COLOR=#FFFFFF SIZE=3>"
  458.       strTD = "<TD><FONT FACE=VERDANA, ARIAL, HELVETICA COLOR=#000000 SIZE=2>"
  459.       strSpacer = "<TR><TD HEIGHT=20> </TD></TR>"  & Chr(13)
  460.       If m_intUpdate = 0 Then
  461.           Set Interest = Server.CreateObject("ExAir.Interest")
  462.           set rstInterests = Interest.ListAll(m_strDSN)
  463.       Else
  464.           Set Member = Server.CreateObject("ExAir.Member")
  465.           Set rstInterests = Member.ListInterests(m_strDSN, m_lngAccountID)
  466.       End If
  467.       Response.Write "<TABLE WIDTH=600 CELLPADDING=0 CELLSPACING=2 BORDER=0>"  & Chr(13)
  468.     strCategoryName = rstInterests("Description")
  469.     Response.Write strTH & strCategoryName & "</FONT></TH>"  & Chr(13)
  470.       Response.Write strSpacer
  471.       intInterestCounter = 0
  472.     Do Until rstInterests.EOF
  473.         intInterestCounter = intInterestCounter + 1
  474.         strNewCategoryName = rstInterests("Description")
  475.         If strNewCategoryName <> strCategoryName Then
  476.           intInterestCounter = 1
  477.           strCategoryName = strNewCategoryName
  478.           Response.Write strSpacer
  479.           Response.Write strTH & strCategoryName & "</FONT></TH>"  & Chr(13) 
  480.           Response.Write strSpacer
  481.         End If
  482.         strInterestName = rstInterests("InterestDescription") 
  483.         intInterestNumber = rstInterests("InterestID")
  484.         strCheckBox = strTD & "<INPUT TYPE=Checkbox NAME=Interest VALUE=" & intInterestNumber
  485.         If (intInterestCounter Mod 3) = 1 Then
  486.           strCheckBox = "<TR>"  & Chr(13) & strCheckBox
  487.         End If
  488.         If m_intUpdate <> 0 Then
  489.           If rstInterests("AccountID") = m_lngAccountID Then
  490.               strCheckBox = strCheckBox & " CHECKED"
  491.           End If
  492.         End If
  493.         strCheckBox = strCheckBox & ">" & strInterestName & "</FONT></TD>"  & Chr(13)
  494.         Response.Write strCheckBox
  495.         rstInterests.MoveNext
  496.         If (intInterestCounter Mod 3) = 0 Then
  497.           Response.Write "</TR>"  & Chr(13)
  498.         End If
  499.     Loop
  500. Response.Write "</TABLE>"
  501.   End Sub
  502.  
  503.  
  504.   ' 
  505.   ' Take values from the submitted form and assign to page level variables.
  506.   ' These variables will in turn be passed to the database. If the database
  507.   ' update fails, the form will be displayed again with these values filled 
  508.   ' into the correct fields.
  509.   '
  510.   Sub GetValuesFromForm
  511.     m_strFirstName = Trim(Request.Form("FirstName"))
  512.     m_strLastName = Trim(Request.Form("LastName"))
  513.     m_strMiddleName = Trim(Request.Form("MiddleName"))
  514.     m_strKnownAs = Trim(Request.Form("KnownAs"))
  515.     m_strGender = Request.Form("Gender")
  516.     m_strAddress1 = Trim(Request.Form("Address1"))
  517.     m_strAddress2 = Trim(Request.Form("Address2"))
  518.     m_strCity = Trim(Request.Form("City"))
  519.     m_strState = Trim(Request.Form("State"))
  520.     m_strPostCode = Trim(Request.Form("PostCode"))
  521.     m_strCountry = Trim(Request.Form("Country"))
  522.     m_strHomePhone = Trim(Request.Form("HomePhone"))
  523.     m_strBusinessPhone = Trim(Request.Form("BusinessPhone"))
  524.     m_strFax = Trim(Request.Form("Fax"))
  525.     m_strEmail = Trim(Request.Form("Email"))
  526.     m_strWebSite = Trim(Request.Form("WebSite"))
  527.     m_strMeal = Trim(Request.Form("Meal"))
  528.     m_strSeating = Trim(Request.Form("Seating"))
  529.     m_strExitRow = Trim(Request.Form("ExitRow"))
  530.   End Sub
  531.  
  532.   ' 
  533.   ' Call the correct method for updating the database based on whether this is 
  534.   ' an existing member updating information or a new member creating a database
  535.   ' entry. Return 0 if successful or 1 if an error is encountered.
  536.   '
  537.   Function UpdateDatabase
  538.     On Error Resume Next
  539.     Dim Member, lngNewAccountID
  540.     Set Member = Server.CreateObject("ExAir.Member")
  541.     If m_intUpdate = 1 Then
  542.       Member.Update m_strDSN, m_lngAccountID, m_strFirstName, m_strLastName, m_strMiddleName, _
  543.           m_strKnownAs, m_strGender, m_strAddress1, m_strAddress2, m_strCity, m_strState, m_strPostCode, m_strCountry, _
  544.           m_strHomePhone, m_strBusinessPhone, m_strFax, m_strEmail, m_strWebSite, _ 
  545.           m_strMeal, m_strSeating, m_strExitRow
  546.     Else
  547.       m_lngAccountID = Member.AddNew(m_strDSN, m_strFirstName, m_strLastName, m_strMiddleName, _
  548.         m_strKnownAs, m_strGender, m_strAddress1, m_strAddress2, m_strCity, m_strState, m_strPostCode, m_strCountry, _
  549.         m_strHomePhone, m_strBusinessPhone, m_strFax, m_strEmail, m_strWebSite, _
  550.         m_strMeal, m_strSeating, m_strExitRow, 50000)
  551.       Session("AccountID") = m_lngAccountID
  552.     End If
  553.     If Err.Number = 0 Then
  554.       Member.UpdateInterests m_strDSN, m_lngAccountID, Request.Form("Interest")
  555.     Else
  556.       ContextObject.SetAbort
  557.     End If
  558.     If Err.Number = 0 Then
  559.       UpdateDatabase = 0
  560.     Else
  561.       ContextObject.SetAbort
  562.       UpdateDatabase = 1
  563.     End If
  564.   End Function
  565.  
  566.   Sub OnTransactionCommit
  567.       
  568.   End Sub
  569.  
  570.   Sub OnTransactionAbort    
  571.         m_strMainPrompt = "We're sorry, a problem occurred while trying to update the database. Please try again later. "
  572.     End Sub
  573. %>
  574.