MIS 4372 -- Midterm Answers Spring 2016 (version B) -- Parks

Assume the Bates Hotel has implemented a new reservation system. The primary table is named reserve was created with following specification is:

table name: reserve columns:

  1. resnum integer IDENTITY (1,1) NOT NULL,
  2. firstname varchar(30) NOT NULL,
  3. lastname varchar(30) NOT NULL,
  4. personcount int NOT NULL,
  5. checkindate varchar(8) NOT NULL,
    [this field is composed of three parts: year (four digits), month 2 digits (e.g., March would be entered as: 03) and day 2 digits (the 5th of the month would be entered as 05)]
  6. checkoutdate varchar(8) NOT NULL, [this field is composed of three parts: year (four digits), month 2 digits (e.g., March would be entered as: 03) and day 2 digits (the 5th of the month would be entered as 05)]
  7. the primary key is: resnum

Write the asp code with four passes for a UPDATE/DELETE program named fixres.asp) that allows a user to modify a person's hotel reservation. Customers call the concierge desk to make reservation changes. Specifically:

  1. the first pass (named pass1) contains:
    1. a form with action="fixres.asp" and method="POST"
    2. include a clearly labeled textboxea (you pick their design) to record: lastname
    3. a hidden variable with name="token" with a value of "2"
    4. a submit button
    5. a form action="fixres.asp" and method="POST"

  2. the second pass (named pass2) receives the data from the first pass and then:
    1. performs an existence test on the reserve table to see if a reservation exists for the lastname entered.
    2. Show the user one line for each record returned for the lastname entered. Each record should show: resnum, firstname and lastname, checkindate and checkoutdate and personcount on one line separated by commas. At the end of the line create a link of the form:

      <a href='fixres.asp?token=3&rn=value of resnum found for this reservation'>FIX THIS ONE</a>

  3. the third pass looks up the reservation using the value of rn returned by the link in pass2 to created a modifiable form for the user. If the This form shows:
    1. the resnum as text, followed by hidden textbox named rn with the value of the returned from pass2.
    2. the firstname and lastname as text
    3. the checkin year in a four digit textbox, the checkin month in a two digit textbox and the checkin day in a two digit textbox. Each should have a value clause with the data from the table for the resnum.
    4. the checkout year in a four digit textbox, the checkout month in a two digit textbox and the checkout day in a two digit textbox. Each should have a value clause with the data from the table for the resnum.
      [the two fields above will require you concatenate the year, month and day components together to make a single field -- one for checkindate and one for checkoutdate]
    5. a two digit personcount field with the value from the resnum row
    6. a hidden field named "token" with a value of "4"
    7. a submit button

  4. the fourth pass updates all the values for the resnum row.
    That is update: checkindate, checkoutdate, and personcount
    The user cannot change the lastname, firstname or resnum
    Report the result of the task action to the user ("Updated OK" or "Update Failed")
DO NOT WRITE MAIN
Each pass is 25% of your grade. Assume the data editing is performed outside the scope of the code (i.e., assume the user makes no data entry errors]