BTI420 Lab 2

Lab 2 helps you learn about the “web forms” page lifecycle. You also get a good workout with a new language, C#. It is due on Friday January 29.

.

BTI420 Lab 2 – due Fri Jan 29

Assigned: During Week 2

Due date: Friday, January 29, 2010, at 8:00am

Grade value: 3% of your final course grade

Grading method: The following will be checked:

Your “labs/lab2.aspx” page

Correct interactive operation of the page’s logic

Accurate numerical calculations

.

Objective(s)

Use some ASP.NET “list” web server controls

Start to learn about layout capabilities and formatting in ASP.NET Web Forms

Begin using a number of .NET Framework classes

.

Introduction to the problem that you will solve

The Red Dog Bus Company needs a new point-of-purchase bus trip ticketing application for its ticket agents. The company currently has four bus routes:

Toronto to Orillia ($14.40 per ticket)

Toronto to London ($23.80 per ticket)

Toronto to Montreal ($47.30 per ticket)

Toronto to Sault Ste. Marie ($64.20 per ticket)

Your job is to create a simple ASP.NET Web Form using the C# language. Your web form should keep track of the number of empty seats on each of the four routes. When the program is first run, all routes will have 42 empty seats. The ticket agent should be presented with a screen that looks like the example below.

.

Specifications

The screen should show a listing of the available tickets remaining on each of the bus routes.
Hint: Use a table (from the Visual Studio menu) to help layout your work.
The cell contents will be “Label” web server controls.

The program should allow the user to make a ticket purchase by following these steps:

Select the route from a drop-down list control

Select the number of tickets required using a different control, preferably another list control

Complete the purchase transaction

(Your page may look different from the following example.)

The “Ticket Availability Status” area must show up-to-date numbers of available tickets.

This example shows the result after a number of transactions have taken place:

(The following example is from a past semester. Your page will look different.)

The example shows a “radio button list” web control in the Step 2 (select the number of tickets) area. You can use a different control if you wish. Make sure you use two different types of controls for steps 1 and 2 (that is – don’t use “dropdown lists” for both controls).

Your application should somehow check to ensure that it is NOT possible to select more tickets than are available on a bus route. There are many ways to accomplish this goal; one way is shown below, where it creates only the exact number of radio buttons for the number of tickets remaining on the route.

(Your page may look different from the following example.)

While making selections from the list controls, the selection’s status should appear in a label control, as shown in the following example:

You do NOT have to use file I/O to successfully complete this lab.

Also, you do not have to use “state management” techniques to persist values between postbacks.

This lab will help you learn C# language and syntax, ASP.NET web form operation and programming, Visual Studio usage, and more of the .NET Framework base class library.

Feel free to look in books, on the web, ask your friends for help, talk to your professor, etc. However, don’t just copy someone else’s code without first understanding it yourself. Everyone will struggle a bit, but that’s the point. Don’t get discouraged if you need help. This is a learning experience.

.

Bonus! (no marks)

Make your web form keep and display a running list of transactions that were completed. Put this list at the bottom of the page after each postback, as shown in the following example:

.

Submitting your work

Update your web site home page to add a link to this lab.

When you do a lab exercise, you are creating it online on the warp server. Therefore, you do NOT have to submit paperwork to your professor. Just do the lab, and your professor will find it (as long as it is in the right location!).

Note: As an experienced student, we expect you to be able to follow instructions. When your professor marks this lab, a helper “lab marker” program will browse to your home directory web app’s “default.aspx” page, and expect to find a hyperlink to “~/labs/lab2.aspx”.