B118 Web Programming PowerPoint PPT Presentation

presentation player overlay
1 / 7
About This Presentation
Transcript and Presenter's Notes

Title: B118 Web Programming


1
B118 Web Programming
  • IBuySpy.com Shopping Cart Mechanism

2
IBuySpy.com Store
  • http//cypress.cob.sjsu.edu/storevb
  • Documentation http//cypress.cob.sjsu.edu/storevb
    /docs/docs.htm
  • Well be concentrating on the Shopping Cart
    architecture topic

3
ShoppingCartDB Class Methods
  • GetItems(ByVal cartID As String) As
    OleDbDataReader
  • AddItem(ByVal cartID As String, ByVal productID
    As String, ByVal quantity As Integer)
  • UpdateItem(ByVal cartID As String, ByVal
    productID As String, ByVal quantity As Integer)
  • RemoveItem(ByVal cartID As String, ByVal
    productID As String)
  • GetItemCount(ByVal cartID As String) As Integer

4
ShoppingCartDB Class Methods (contd)
  • GetTotal(ByVal cartID As String) As Decimal
  • MigrateCart(ByVal oldCartId As String, ByVal
    newCartId As String)
  • EmptyCart(ByVal cartID As String)
  • GetShoppingCartId() As String
  • GetProductQty(ByVal cartID As String, ByVal
    productID As String) As Integer
  • bEssentials addition

5
Shopping Cart Implementation Architecture
6
Why a separate set of routines?
  • Improves maintainability
  • Separates UI from Business Components
  • Web page code contains very little database code,
    makes it easier to read
  • Database code can be changed without affecting
    web page code
  • Example Fall 2003 re-architecting to use
    ShoppingCartConnectionString
  • Stored procedures isolates SQL-specific
    instructions
  • Makes Business Components database-independent
  • Prevents SQL-injection hacking

7
Comparison of the two shopping cart mechanisms
  • Previous cookie-based
  • Cart contents accessible only from the same
    machine
  • Has the potential to disappear over time
  • Private contents, accessible only when user views
    web site
  • Server-platform independent
  • Now database-driven
  • Cart contents accessible from different machines
  • Permanent
  • Server operator can view contents without users
    knowledge
  • Coding depends on server environment
Write a Comment
User Comments (0)
About PowerShow.com