9.3. Solution

We'll go very quickly through the implementation of the solution, as the structure of many classes and pages is similar to those developed for previous modules. In particular, creation of the database tables, the stored procedure, the configuration code, and the DAL classes is completely skipped in this chapter, due to space constraints. Of course, you'll find the complete details in the code download. Instead, I'll focus this space on the implementation of code containing new ASP.NET 2.0 features not already discussed, and code containing interesting logic, such as the shopping cart profile class and the companion classes, as well as the checkout process and the integration with PayPal.

9.3.1. Implementing the Business Logic Layer

First we'll examine the BLL classes related to the shopping cart, starting with the ShoppingCartItem class, which is an entity class that wraps data for an item in the cart, with its title, SKU, ID, unit price, and quantity. This class is decorated with the [Serializable] attribute, which is necessary to allow the ASP.NET profile system to persist the ShoppingCartItem objects. Here's the code:

public class ShoppingCartItem
   private int _id = 0;
   public int ID
      get { return _id; }
      private set { _id = value; }

   private string _title = "";
   public string Title
      get { return _title; }
      private set { _title = value; }

   private string _sku = "";
   public string SKU
get { return _sku; } private set { _sku = value; } } private ...

Get ASP.NET 2.0 Website Programming Problem - Design - Solution now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.