Wednesday, November 23, 2011

ITC 172 Assignment Two

Outcomes

Connect to databases with ADO

Make interactive Web pages with Data bound controls

Understand and implement secure coding techniques


Practices

We will do the practices together

1. Show the code to create and instantiate a new ADO connection object that connects to a database named MagazineTracker using integrated security.

2. Show the code to create and instantiate a New ADO connection that connects to a database named MagazineTracker using SQL authentication with a username of "salesperson" and a password of "P@ssw0rd1"

3. Create a new SQL command object that gets all the data from the table Magazine.

4. Create the code to retrieve the data from the Magazine table and store it in a dataset. Bind the dataset to a ViewGrid

5. Use Css to Style a ViewGrid

6. Show the code to update a customer address

7. Show the code to throw an error

8. Show the code for redirecting an error to a web page


Programming

Overview

This web site uses the Automart web site. It will have 5 web forms.

This assignment is big and has many pieces.The goal is to give you a good overview of how to use ADO to build a web site. The project is broken into five parts. You should complete and test each part before moving to the next. I will help. Also, this program also the model for the LINQ assignment, which will do all the same things but with different tools.

The first form will be the opening page. It will show the locations of the Automart stores and a list of the services provided. It will also have a login control. That allows the user to login and see their registered vehicles. The login control uses the registered customer email as a user name and the password in the Customer.RegisteredCustomer table as their password. If they successfully log in, they will be redirected to the second web Form which greets them by name and shows them a list of their registered vehicles (usually only one). A button on this page when clicked will allow them to edit their information.

Under the login control on the first web form is a button for unregistered customers, that when clicked redirects them to a web form which allows them to enter their first and last name, email, vehicle license number, vehicle make, vehicle year and password. At the bottom of the form a submit button should write all these to the database. When successful the customer should be congratulated and encouraged to login.

When the edit information button on the second web form is clicked it should redirect them to a web form where all their information is retrieved into editable text boxes. After they have made changes, the changes should be submitted to the database.

The last page is error page where the user will be redirected if there is an error in the process. We will put error trapping and validation throughout the assignment.

Part one (getting the Locations and services)

Create a new empty web site. Add A Web Form and a Style Sheet. Use ADO programming objects to connect to the Automart Database and return a list of locations with their addresses and services. (Use a separate gridview for each)

Use Css to Style the ViewGrid.

Part two (Login and get customer and vehicle information)

We are going to do this correctly, in an object oriented way. First, create a new class called Customer. It should have fields for PeronKey, LastName, Firstname, email and password. Password should be write only. Create a second class for Vehicle. It should contain fields for Personkey, vehicle license number, vehicle make and vehicle year.

Add a login control to the first web form

In the login authenticate method connect to the Customer.RegisteredCustomer table. Match the email and password. IF it does match store the personkey in a Session variable, and redirect the user to the second form.

Create a new class called ManageCustomer

Add a method called GetCustomer that takes the person key as a parameters that queries the database and returns a customer Object

Create a second new class called ManageVehicle

Add a method called GetVehicle which also takes the personkey as a parameter and which returns a vehicle object

In the page load of the second web form, get the person key from the session variable and use it to query the Person, Vehicle and Registered Customer tables to pull of all the customer information.

Display their names, and the vehicle information

Part Three (Register New Customer).

Create a new mehtod in the class ManageCustomer called AddCustomer that takes a customer Object as a parameter and To the ManageVehicle class another method AddVehicle that takes a Vehicle object as a parameter.

On the web page create a form that allows a customer to enter all the appropriate fields. Use the validation controls to require fields and make sure the email is well formed. Have them enter the pass word twice. Use the compare validation control to make sure the passwords match.

When the customer clicks the submit button the contents of the text boxes should be assigned to the customer and vehicle objects respectively. Pass those objects to the RegisterCustomer Class.

Provide the customer some feedback on whether the submission was successful or not

Part Four (Updating information)

The good news is you have already done most of the work for this

The webform should look a lot like the web form you did for the new customer registration

You can use the Manage classes you have already created to retrieve the data from the database.

In each Manage class, add another method UpdateCustomer, UpdateVehicle, respectively.


Part Five

Add Try catches to each part of the code that could generate a error. Throw the errors from the class to the web page where they should be redirected to an error page.

What I am looking for

Each part is worth 10 points for a total of 50 points
In part one, Listing the services is 4 pts, listing the locations 4 points, css styling 2 pts.
In part two logging in 2 pts, creating the classes 6 points, displaying the welcome 2 pts
In Part three input form 2 pts, validation 3 points, inserting new customer 5 pts
In Part four web form 2 points, retreiving information 2 pts, class methods for update 3 points, successful update 2 points
For part five. Throwing errors back to pages 3 pts, Location and handling errors 5 pts, Error page 2 pts

The total is worth 20 points


To turn in

copy all the markup code, C# and CSS into a Google doc and share it with spconger@gmail.com

No comments:

Post a Comment