Top Banner
Your Name Here See Page Notes for Info about Hyperlinks
19
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Your Name Here See Page Notes for Info about Hyperlinks.

Your Name Here

See Page Notes for Info about Hyperlinks

Page 2: Your Name Here See Page Notes for Info about Hyperlinks.

Designing an Interactive Web Site

• Components of the BigHit Online Web Site • Data Modeling for BigHit Online

– Evaluating the E-R Diagram

– Improving the ER Diagram

– Using Weak Entity Classes for Many-To-Many Relationship Types

– Modeling Shopping Carts and Wish Lists

– Modeling to Support Searching for Movies

– Final Evaluation of the Conceptual Model

• Relational Model for BigHit Online • Creating a SQL Server Database • Web Site Design, Pages, and Flow

– Login and Customer Information

– Shopping Carts, Searching, and Selecting Items

– Checkout and Receipt

Page 3: Your Name Here See Page Notes for Info about Hyperlinks.

Components of the BigHit Online Web Site

• Statement of purpose– BigHit Video Inc. wants to create an information system for

online sales of in both DVD and videotape format. People will be allowed to register as customers of the online site and to update their stored information. Information must be maintained about customers’ shipping addresses, e-mail addresses and credit cards. In a single sale, customers will be allowed to purchase any quantity of videos. The items in a single sale will be shipped to a single address and will have a single credit card charge.

– A customer will be provided with a virtual shopping cart to store items to be purchased. As each item is selected, it is added to the shopping cart. When the customer finishes shopping, he will be directed to a checkout area where he can purchase all of the items in the shopping cart. At this time, payment and shipping information is entered. Once the sale is complete, the shopping cart will be deleted and the customer will be sent a receipt by e-mail.

Page 4: Your Name Here See Page Notes for Info about Hyperlinks.

User-side Requirements• The customer side of the Web site must provide these major

capabilities:– Customer information:

• Allow customers to create and edit their own profiles• To login and logout

– Shopping: • Allow customers to search for movies to buy• Select movies and place them in a shopping cart• View and modify the contents of the shopping cart

– Checkout: • Allow customers to purchase items in the shopping cart • Specify shipping and method of payment• Receive both an online and an e-mail receipt

– Inquiry: • Allow customers to inquire about the status of orders• See records of their past purchases• Comment on services

Page 5: Your Name Here See Page Notes for Info about Hyperlinks.

Business-side Requirements

• The business side of the Web site provides employees with the information services they need:– Orders:

• Evaluate orders and • Record their status as it changes

– Inventory:• Evaluate the inventory on hand• Add new movies• Update movie prices• Update the quantities as new movies arrive

– Business activity: • Analyze the purchasing behavior of customers• Evaluate the popularity of movies

Page 6: Your Name Here See Page Notes for Info about Hyperlinks.

ER Diagram from Chapter 4

Sale1

Includes

MPurchases

1

Customer

ShoppingCart

Selects

Includes

1

M M

M

M

creditCards

expirationaccountNumber

type

quantity

quantity

creditCard

totalCost saleIddateSold

cartIddate

Created

zipcode

statecity

street zipcode

statecity

street

shippingAddresses

lastName

accountId

firstName expiration

accountNumber

type

Movie

o

costquantitycostquantity

VideotapeDVD

genre

movieId

title

videoFormat

languages

captioning

format

soundtrack

Page 7: Your Name Here See Page Notes for Info about Hyperlinks.

Evaluating the E-R Diagram• Can an employee evaluate a sale to determine how many items it

includes and how much it costs? – Yes and no

• Can a shipping clerk tell where to ship the items of a sale?– no

• Is there any way for an employee to record information about packaging and shipping? – no

• Can an employee determine inventory information such as quantity on hand of particular items?– yes

• Can a manager extract information about purchasing behavior of customers?– yes

• Can a manager determine the rate of sales of movies?– yes

Page 8: Your Name Here See Page Notes for Info about Hyperlinks.

Improving the ER Diagram

• Add attribute videoType to Includes relationship types– Represent whether a shopping cart item or sale item is DVD or

videotape

• Add status to Sale class, and qtyShipped to Includes between Sale and Movie– Represent status of shipment

• What other attributes are needed?

Page 9: Your Name Here See Page Notes for Info about Hyperlinks.

Using Weak Entity Classes for Many-To-Many Relationship Types

• We know that many-to-many relationship types are not directly representable in relational schemas– It is appropriate to modify the ER diagram to eliminate them

• Create a new weak entity class for each many-to-many relationship type

Sale

saleId

Partialkey

weak entityclass

identifyingrelationship

type

MM

Movie

o

VideotapeDVD

movieId

videoType

SaleItemSaleItem

quantity qtyShipped

HasHasHasHas

11

requiredparticipation

Page 10: Your Name Here See Page Notes for Info about Hyperlinks.

Modeling Shopping Carts and Wish Lists

• Entity class ShoppingCart is used to represent the customer’s interest in buying items– Modeling almost identical to Sale– No qtyShipped, no billing information, no shipping address

• Buying process is intended to be– Customer is identified to the system– Customer searches for items– Customer adds items to cart– Customer modifies cart items: delete or change quantity– Customer goes to checkout to buy items in cart

• A wish list is similar to a shopping cart– Provides a way for a user to remember items for later purchase– May have longer lifetime than a shopping cart– May be shown to other users to allow gift purchases

Page 11: Your Name Here See Page Notes for Info about Hyperlinks.

Modeling to Support Searching for Movies

• The BigHit Online Web site does not have movie searching– Click on “search” and presented with comedy movies

• Searching should be based on title, genre, date– Also based on people who are involved in production– Also based on similarity and reviews (not shown)

Person

personId

MM

movieId

HasHasHasHas11

D

Movie

CrewCast

SaleItemPosition

titlesroles

"cast" "crew"

type

Disjointinheritance

Definingattribute

Definingattribute

value

RequiredParticipation

Page 12: Your Name Here See Page Notes for Info about Hyperlinks.

Final Evaluation of the Conceptual Model

• See Figure 13.7SaleM

PurchasescreditCard

totalCost saleIddateSold

expiration

accountNumber

type

status

M

M

SaleItemSaleItem

Has

1

1M

M

HasHasHas

11

quantity videoType

1Customer

1

zipcode

statecity

street zipcode

statecity

street

shippingAddresses

lastName

accountId

firstName

genre

movieId

title

cartIddate

Created

1

Selects

ShoppingCart MovieSaleItemCartItem

HasHas

quantity

qtyShipped

videoType

videoFormat languages

o

costquantity

VideotapeDVD

captioningformat soundtrack

costquantity

1

expiration

accountNumber

type

creditCards

"cast" "crew"

PersonMM

HasHasHasHas

1

D

CrewCast

SaleItemPosition

titlesroles

type

city

shippingAddress

statestreet

zipcodename

lastName

personId

firstName

lastUpdate

status

line

line

Page 13: Your Name Here See Page Notes for Info about Hyperlinks.

Relational Model for BigHit Online

• Direct translation of ER diagram to relational schema

Page 14: Your Name Here See Page Notes for Info about Hyperlinks.

Some SQL to Create Tables• create table ShoppingCart (

cartId varchar(16) not null primary key,startDate datetime not null,status varchar(16) not null,lastUpdate datetime nut null,foreign key cartId to Customer(accountId)

)• create table CartItem (

cartId varchar(16) not null,line int not null,movieId int not null references Movie(movieId),quantity int not null,videoType char(4) not null,cost money not null,foreign key cartId references ShoppingCart(cartId),primary key (cartId, line)

)

Page 15: Your Name Here See Page Notes for Info about Hyperlinks.

Creating a SQL Server Database

• Microsoft Office Professional (with Access) includes SQL Server database– Called MSDE (Microsoft Data Engine)– Separate install from CD directory

• Once installed, – Open Access database– Choose upsizing wizard– Follow directions

• Viola!

Page 16: Your Name Here See Page Notes for Info about Hyperlinks.

Web Site Design, Pages, and Flow

• Fundamental design – Navigation through buttons on header of every page

• No predefined path through pages– Identify the major pages required for user interaction– Identify the SQL statements required to produce each page

• Typical purchase scenario– Customer logs in– Searches for videos– Adds videos to the shopping cart– Modifies the contents of the shopping cart– Goes to checkout– Reviews purchase– Confirms purchase

• What’s left out?

Page 17: Your Name Here See Page Notes for Info about Hyperlinks.

Login and Customer Information

• Welcome page includes fields for accountId and password

• Checking for login requires– Select * from Customer where accountId=lower(‘JoJo’)

• JoJo is the accountId entered by customer in Figure 13.13

• Once the user has logged in, the information from the select statement is used to produce the customer information page

Page 18: Your Name Here See Page Notes for Info about Hyperlinks.

Shopping Carts, Searching, and Selecting Items

• Create new shopping cart– insert into ShoppingCart (cartId, startDate, status, lastUpdate) values

('jojo', getdate(),'new', getdate())

• Display items in shopping cart– select * from ShoppingCart where cartId = 'jojo'

– select line, c.movieId, title, quantity, videoType, cost, quantity*cost as totalCost from cartItem c, Movie m where c.movieId=m.movieId and cartId='jojo' order by title

• Add items to shopping cart– insert into CartItem (cartId, line, movieId, videoType, quantity,cost) values ('jojo','1','189','dvd',2,39.95)

– insert into CartItem (cartId, line, movieId, videoType, quantity,cost) values ('jojo','2',' 987','vhs', 3, 9.99)

• Search for comedy movies– select * from Movie where genre like '%comedy%' order by title

Page 19: Your Name Here See Page Notes for Info about Hyperlinks.

Checkout and Receipt• Create new Sale entity

– select max(salesId) from Sale // returns 66, e.g.– insert into Sale (salesId,accountId,saleDate,status,totalCost) values

(66,'jojo',getdate(),'sold',0)• Move items from shopping cart into SaleItem

– insert into SaleItem select 66, line, movieId, quantity, videoType, cost, 'pending' from CartItem where cartId='jojo' and quantity<>0

• Update total cost in sale– select sum(quantity*cost) from SaleItem where salesId=66– update Sale set totalCost=112.87 where salesId=66

• Update inventory– update Movie set dvdQty=dvdQty-2 where movieId=189– update Movie set tapeQty=tapeQty-3 where movieId=987

• Delete items from shopping cart– delete from cartitem where cartId='jojo' – delete from shoppingcart where cartId='jojo'

• Produce receipt page (see p. 348)