Visual Basic Shopping Cart Source Code

Jun 16, 2012, by admin

VisualBasic .netVisual Basic Shopping Cart

Visual Studio .NET 2003

The Shopping Cart displays the books that a user has selected for purchase. It also presents the option to change the quantity of each selected book.

Implementation

The Shopping Cart page uses the following ASP.NET file and C# or Visual Basic .NET code-behind files:

ShoppingCart.aspx

 ShoppingCart.aspx.cs

 ShoppingCart.aspx.vb

 Process Overview

After a user selects the shopping cart option from the top of an ASP.NET page or chooses the Add To Cart button on a book selection, the application displays the Shopping Cart page. To advance to checkout, a user clicks the Proceed to Checkout link. From the shopping cart, a user can change the quantity of each selected book. When the user clicks the Update button, the Duwamish7.Web.ShoppingCart.UpdateButton_Click method changes the quantity, which calls the Duwamish7.Web.Cart.UpdateItems method. (A maximum quantity of fifty is allowed per item.). The Duwamish7.Web.Cart.UpdateItems method also handles deleting books when the user enters a zero for the quantity.

Architectural Decisions

There are no calls from the Web layer to manage cart management, thus increasing both scalability and presentation. The downside of this approach is that the shopping cart can get lost if the session state times out. An exchange approach would be to back the Shopping Cart out to SQL. For further information on session state in Duwamish 7.0, see User Services.

Web Source Code

The default location for the Duwamish7.Web.ShoppingCart.UpdateButton_Click method source code is the [Drive letter where Visual Studio .NET is installed]:Program FilesMicrosoft Visual Studio .NET 2003Enterprise SamplesDuwamish 7.0 CSWebShoppingCart.aspx.cs file. The default location for Duwamish7.Web.Cart.UpdateItems method source code is the [Drive letter where Visual Studio .NET is installed]:Program FilesMicrosoft Visual Studio .NET 2003Enterprise SamplesDuwamish 7.0 CSWebCart.cs file.

Note   If the Visual Basic .NET version is installed, Duwamish 7.0 VB replaces Duwamish 7.0 CS in the path, the file name is the same, and the extension is vb rather than cs.

Duwamish7.Web.ShoppingCart.UpdateButton_Click method:

[C#]


 

[Visual Basic .NET]


Duwamish7.Web.Cart.UpdateItems method:

[C#]


 

[Visual Basic .NET]