Project #2
Up ]

Create a Kites-R-Us Dynamic Web Site

The point of this project is to demonstrate that you can create a simple but interactive dynamic web site. You will create a simple storefront for the Kites-R-Us Company. You will want to list a number of different kites and have an interactive way for a customer to order kites from your web site. Dynamic aspects of the web site will be programmed in Active Server Pages (ASP). ASP works best with Visual Basic Script so I expect you’ll want to use it as your programming language.

Book Example

In doing this project it is important to study the Book Example I put together. You may use any part of my code that you see fit.  But remember that the Book database and the Kites-R-Us database are not quite the same thing. The Book Example is a partial solution only. It does not keep a record of customer information, although it does solicit for credit card details. Nor does it keep a list of orders and order items.

The Book example is comprised of three ASP scripts. If using Internet Explorer, to see the source code you may need to do a View Source to see it. Note that ASP code cannot normally be seen, which is why you must view text versions of the ASP source code. The actual files executed are saved with an .asp suffix, not an .asp.txt suffix.

The URL to try the book example is:

http://www.nvcc.edu/home/mhamill/ITD-210/Files/database/books.asp

The three source files you can examine are:

http://www.nvcc.edu/home/mhamill/ITD-210/Files/database/books.asp.txt

http://www.nvcc.edu/home/mhamill/ITD-210/Files/database/buy_book.asp.txt

http://www.nvcc.edu/home/mhamill/ITD-210/Files/database/process_order.asp.txt

Publishing

This project must be published to the NVCC Student Server. This web server is configured for ASP and Access databases. On the Class Resources page you will find instructions on how to download, upload and test your copy of the Access database to make sure it can be accessed over the World Wide Web. See me as soon as possible if you cannot get it to work.

You will use FTP to move your source files to the server. Since ASP code is plain text, use ASCII mode to transfer these files to the server from your machine. Note that you will have to publish repeatedly to test your changes.

Turning in your work

The project is due on the start of our last class on April 26, 2003. You must:

Email me the URL to the first page of your project by the end of our final class.
Provide me with a printed copy of all your source code in ASP.
When you are done with the project, you must also save each page as a text file with a .asp.txt suffix and place them in the same folder as your work on the web server. Transfer these as ASCII files. This will let me view your source code over the Internet.

Grading

C Grade

If you succeed only in getting a dynamic list of kites from the database to a web page table (similar to the Book example) so there are no errors you earn a grade of 70. All information from the products table except for the picture field and the product ID field must show for each row in your table (and there must be at least several rows so I can ensure it is working properly) to earn the grade. (The picture field is actually a binary image of a kite stored in the database as a .GIF file. You probably won’t be able to figure out how to display this image, but bonus points if you figure it out.) Data should be displayed in a tabular format similar to the Book example.

B Grade

If in addition to the above, you can figure out a way to order just one kite at a time similar to the Book example (without capturing customer information in the database) you earn a grade of 80. The quantity available in the Products table must be reduced by the quantity ordered to earn this grade. You do not need to create rows in the Orders and Order Items table to earn this grade.

A Grade

If in addition to all of the above, you can figure out a way to capture the customer name, address and credit card information into the customer table you earn a grade of 90. The table is keyed on the credit card name, so if the name is already in the table you need to update the record rather than add it.

A+ Grade

If in addition to all of the above you can correctly populate both the orders and the order items table you earn a grade of 100. The especially clever will figure out a way to order more than one kite in the same transaction.

Squishy Points

Ten points can be added or subtracted to the grade either way. If the user interface is attractive and well thought out, perhaps with appropriate Javascript for forms, then up to ten points will be added. On the other hand, if I find serious errors and things not working right I may deduct up to ten points for these sorts of errors. So test thoroughly. I will also look at your source code and see how readable it is.

It’s Gotta Work to Earn a Grade

Regardless the basic functionality must work to earn the points. If I can’t even retrieve a listing of books from your database, for example, I can’t award any points.

Summary

So scoring will range from 60-110, depending on your interest and talents. If basically nothing works you can expect an F. If it is clear you tried and it didn’t work I’ll award 50 points. If it is obvious you didn’t even try, you will get nothing.

Online References

You may find the following online references extremely useful as you work on your project. I found it useful to have multiple browser windows open, one for testing my work, one for an ASP Reference and one for an ADO Reference.

For a Visual Basic Script tutorial:

http://www.asp-help.com/getstarted/ms/vbscript/vbstutor.asp

For a good reference on Visual Basic Script commands, functions, etc:

http://www.asp-help.com/getstarted/ms/vbscript/

For some basic database manipulation examples see:

http://www.asp-help.com/database/db_tutorial1.asp

This reference details the various database manipulation objects used with ASP. Look particularly at the Connection, RecordSet and Field objects:

http://www.w3schools.com/ado/default.asp

Utility

For your convenience I have included this link to a free ASP application that can be used to view, modify and edit Access databases over the web. You will need to download the zip file, unzip it in a temporary folder, read the instructions, do some minor configuration then upload it to your web site. You can see it in operation here but don't change any data or modify any tables!

In my demo, you will need to check the checkbox and enter home\mhamill\ITD-210\Files\database\kitesrus.mdb for the database path. Then press the Load Database button.

Kites-R-Us Database

The Kites-R-Us Database is actually a Microsoft Access database that will exist on your NVCC Student Web Site. Follow the instructions on the Class Resources page to download, upload and test the database to make sure it is working correctly. If you have problems first contact the instructor so he can look at it. He will direct you to the appropriate NVCC person if there are server issues that need to be resolved.

There are four tables in the database. The details are below.

Table Name: products

This is what you are selling. It contains information about your kites for sale:

Field Name

Type

Max Length

Attributes

product_id

Autonumber

 

Primary Key. Don’t specify this number in your Insert statement. It is created automatically by the database. Its purpose is to ensure that a row in the table is always unique

stock_number

Text

15

A stock number that uniquely identify the kite

title

Variable Length String

50

A short display title of the name of the kite, kite kit or accessory

description

Variable Length String

255

A fully elaborated description of the kite

price

Currency 

 

Selling price

quantity_available

Number

 

Items in stock. If someone order more than is available, you have a problem!

picture

OLE Object

 

A picture of the kite. You probably won’t be able to show the picture but it’s there if you can figure out a way to display it!

Table Name: customers

This table contains people who have ordered products from your site. As you take orders your list of customers will grow. The columns are:

Field Name

Type

Max  Length

Attributes

CustomerID

Autonumber

 

Primary Key. Don’t specify this number. It is created automatically by the database. Its purpose is to ensure that a row in the table is always unique

StudentID

Text

 

Always use the value 8443! It is required. It doesn’t serve a purpose anymore. Originally I was going to have all students do their work in the same database and I wanted to distinguish work by different students. Then I realized it was a bad approach and had too many possibilities for error.

CreditCardHolder

Text

30

Name as it appears on credit card

CreditCardType

Text

10

Up to 10 characters, Visa, Mastercard and Discover

CreditCardNumber

Text

16

Must be exactly 16 characters

CreditCardExpDate

Text

7

Format MM/YYYY assumed

Address1

Text

50

Required

Address2

Text

50

Optional

City

Text

50

Required

State

Text

2

2 digit Postal Code

ZipCode

Text

10

Format 99999-9999 assumed

Email

Text

50

Email address

Table Name: orders

This is a list of orders to fill. Note that an order consists of one or more items. The actual items to be ordered are in the order_items table.

Field Name

Type

Max Length

Attributes

order_id

Autonumber

 

Primary Key. Don’t specify this number. It is created automatically by the database. Its purpose is to ensure that a row in the table is always unique

customer_id

Variable Length String

50

The customer_id value for your customer is placed here. This is considered a foreign key, i.e. the number placed here must be in your customers table, and this cannot be left blank. It must be equal to a customer_id in the customers table for the appropriate customer.

order_date

Date

8

Enter the date the order was created. Generally you can just put the system date in here when an order is created.

Table Name: order_items

One row for each kite to be ordered.

Field Name

Type

Max Length

Attributes

order_item_id

Autonumber

 

Primary Key. Don’t specify this number. It is created automatically by the database. Its purpose is to ensure that a row in the table is always unique

order_id

Variable Length String

50

This is the order_id value from the order table for this particular customer.

product_id

Variable Length String

50

This is the product_id value from the product table for this customer. In other words, this is the kite they want to buy.

Quantity

4-byte Signed Integer

4

How many of this item are wanted.

 

Sample Solutions

Here are some sample outstanding solutions to Project #2. Since these exist on student server web sites they may elect to take them down at any time. All solutions were excellent but each student took a different approach to the solution.

Ahmed Kabir

Ahmed's solution wasn't high on the user interface but got all the server side scripting right, properly writing to all the tables. He fully extended the book example. Nice work Ahmed!

http://www.student.nvcc.edu/home/ahkabir1/project2/kites.asp

Source code:

http://www.student.nvcc.edu/home/ahkabir1/project2/kites.asp.txt

http://www.student.nvcc.edu/home/ahkabir1/project2/buy_kite.asp.txt

http://www.student.nvcc.edu/home/ahkabir1/project2/process_order.asp.txt

Ieva Velotta

Ieva's solution surprised me. She had her own server with ASP already installed on it! And it appears she wrote almost all of the code by herself, and used the book solution only as a guide. She went beyond anything I taught in class and investigated ASP session objects and used it to create a genuine shopping cart. Since she had her own server she had the ability to create her own Data Source Name (DSN) that we talked about in class. This simplified accessing her database. Great work Ieva!

http://kitesrus.lore.net/

Source code:

http://kitesrus.lore.net/proj2.asp.txt

http://kitesrus.lore.net/carts.asp.txt

http://kitesrus.lore.net/customer.asp.txt

Ha Ly

Ha built a number of utilities into her solution that "proved" things were being stored into the right tables and went well beyond my requirements. She also had a nice interface. Good work Ha!

http://www.student.nvcc.edu/home/haly/kite.asp

Source code:

http://www.student.nvcc.edu/home/haly/kite.asp.txt

http://www.student.nvcc.edu/home/haly/buyKite.asp.txt

http://www.student.nvcc.edu/home/haly/sale.asp.txt

http://www.student.nvcc.edu/home/haly/utility.asp.txt

Last Updated 12/24/2004