Beginning ASP. NET E-Commerce shows you how to build a full e-commerce web site. Guiding you through every step of the design and build process, this book will have you building high quality, extendable e-commerce web sites quickly and easily.
To get the site up and running quickly, we build in phases. The first puts your site live on the web, using an online service to handle the shopping cart, checkout, and payment. The second adds an ASRNET shopping basket and checkout. Finally we'll add our own order processing system - complete with credit card processing, data storage, and order tracking.
What you will learn from this book
With Beginning ASP. NET E-Commerce you will learn to:
Design and build a Web-based application for online selling
Build a browsable product catalog, with administration facilities for addinmodifying, and removing products
Create your own shopping basket and check out in ASRNET
Hook into online services for payment processing
Build a free-text search engine
Transfer and store information securely using SSL and encryption
Use n-tier techniques to create a scalable, extendable online application
The book's P2P forum provides a platform for discussing extensions and changes to the site with other readers.
Who is this book for?
This book is for readers who:
Have already used ASP. NET with Visual Basic .NET
Use Visual Basic .NET Standard Edition or Visual Studio .NET
The book is also valuable for ASP3 developers who learn best by example, and want to experience ASP. NET development techniques first hand.
Introduction
What Does This Book Cover?
Phase One:
Chapter 1: Starting an E-Commerce site
Chapter 2: Laying Out the Foundations
Chapter 3: The Product Catalog: Part I
Chapter 4: The Product Catalog: Adding Content
Chapter 5: Searching the Catalog
Chapter 6: Receiving Payments using PayPal
Chapter 7: Catalog Administration
Phase Two:
Chapter 8: The Shopping Basket
Chapter 9: Dealing with Customer Orders
Phase Three:
Chapter 10: Customer Details
Chapter 11: Order Pipeline
Chapter 12' Implementing the Pipeline
Chapter 13: Credit Card Transactions
Chapter 14: The End
Who Is This Book For?
What You Need to Use This Book
Style Conventions
Customer Support and Feedback
Source Code and Updates
Errata
Technical Support
p2p.wrox.com
Chapter 1: Starting an E-Commerce Site
Why Go E-Commerce?
Get More Customers
Make Customers Spend More
Convincing Them to Come Back
Reduce the Costs of Fulfilling Orders
Let's Make Money
Risks and Threats
Designing for Business
Phase I - Getting a Site Up
Phase II - Our Own Shopping Cart
Phase III - Processing Orders
The Wrox Joke Shop
Summary
Chapter 2: Laying Out the Foundations
Designing for Growth
So What Do We Want?
The Magic of Three-Layered Architecture
A Simple Scenario
What's in a Number?
The Right Logic for the Right Tier
A Three-Tier Architecture for WroxJokeShop
Why Not Use More Tiers?
Technologies and Tools
ASP.NET
The Code Behind the Page
Web Forms and Web User Controls
ASP.NET and the Three-Tier Architecture
VB.NET
Visual Studio .NET
SQL Server
SQL Server and the Three-Tier Architecture
Coding Standards
Creating the Visual Studio .NET Project
Implementing the Site Skeleton
Building the First Page
Adding the Header to the Main Page
Creating the SQL Server Database
Code Download
Summary
Chapter 3: Creating the Product Catalog
Showing the Visitor What we Have
What Does a Product Catalog Look Like?
Previewing the Product Catalog
What we'll Do in This Chapter
A Place to Store the Data
The Theory: What Makes up a Data Table
Previewing the Department Table
Primary Keys
Unique Columns
Columns and Data Types
Nullable Columns and Default Values
Identity Columns
Indexes
Creating the Table
The Data Tier
The Theory: Speaking with the Database
Creating the Stored Procedure
How to Ask for a List of Department Names
Saving the Query as a Stored Procedure
The Business Tier
The Theory: How to Access SQL Server from'VB.NET
Opening a Database Connection
Issuing Commands Using the Connection
Closing the Connection
Implementing the Business-Tier Functionality
Adding the Catalog Class to the Solution
Storing the Connection String in a Central Location
Adding the GetDepartments0 method to the Catalog Class
The Presentation Tier
Preparing the Field: Setting the Styles
Creating the DepartmentsList Web User Control
Code Download
Summary
Chapter 4: The Product Catalog: Adding Content
What is the New Functionality?
A New Place to Store the Data
The Theory: What Makes a Relational Database
Relational Data and Table Relationships
The Foreign Key Constraint
Implementing Table Relationships
Departments, Categories, and the One-to*Many Relationship
Adding Categories Linked to Existing Departments
Categories, Products, and the Many-to-Many Relationship
Database Diagrams
The Data Tier
The Theory: WHERE to JOIN?
Where to Use WHERE
Where to Use JOIN
How to Use JOIN
The Stored Procedures
Input and Output Stored Procedure Parameters
Implementing the Stored Procedures
The Business Tier
The Theory: Working with Stored Procedure Parameters
Completing the Catalog Class
The Presentation Tier
Displaying Data about the Selected Department
Displaying the List of Categories
Displaying the Products
Displaying Contents on the Main Web Page
Custom Error Page
Summary
Chapter 5: Searching the Catalog
What Kind of Search de we Want?
The Data Tier
The Theory: Teaching the Database to Search itself
Dynamically Creating the Query in the Business Tier
Dynamically Creating the Query in the Data Tier
Not Using Dynamically Generated Queries
implementing the SearchCatalog Stored Procedure
The Business Tier
The Presentation Tier
The SearchBox User Control
The SearchResults User Control
Summary
Chapter 6: Receiving Payments using PayPal
Internet Payment Service Providers
Learning how to Use PayPal
Creating a New PayPal Account
Integrating PayPal into our Web Site
Letting PayPal Calculate Shipping Costs
The PayPal Single Item Purchases
Summary
Chapter 7: Catalog Administration
So Where Do We Start?
Authenticating Administrators
Setting up the Catalog Administration Page
Administering Departments
The DepartmentsAdmin User Control
Middle-Tier Methods for Departments Administration
Stored Procedures for Departments Administration
Testing the DepartmentsAdmin Web User Control
Administering Categories
The CategoriesAdmin Web User Control
Middle-Tier Methods for Categories Administration
Stored Procedures for Categories Administration
Testing the CategoriesAdmin Web User Control
Administering Products
The ProductsAdmin Web User Control
Middle-Tier Methods for Products Administration
Stored Procedures for Products Administration
Testing the ProductsAdmin Web User Control
Viewing Product Details and Deleting Products
The ProductDetailsAdmin Web User Control
Middle-Tier Methods for Product Details Admin
Stored Procedures for Product Details Admin
Testing the ProductDetailsAdmin Web User Control
Summary
Chapter 8: The Shopping Basket
Designing the Shopping Cart
The Database
A Place to Store Shopping Cart Items
The ShoppingCart Table
The Stored Procedures
AddProductToCart
UpdateCartltem
RemoveProductFromCart
GetShoppingCartProducts
GetTotalAmount
The Business Layer
Generating Shopping Cart IDs
Implementing the Methods
The User Interface
The Add to Cart Buttons
The View Cart Button
Modifying default.aspx to Load ShoppingCart
Creating the ShoppingCart Web User Control
Adding 'Continue Shopping' Functionality
Allowing the Visitor to Change the Quantity
EditCommand
CancelCommand
UpdateCommand
DeleteCommand
Testing the Shopping Cart
The Next Steps
Summary
Chapter 9: Dealing with Customer Orders
Implementing an Order Placing System
Storing Orders in the Database
The Tables
The Stored Procedures
Updating the Business Layer
Implementing the User Interface
The Place Order Button
Administering Orders
The OrdersAdminPage Web Form
Creating the Form
Implementing Security
Having a Link to OrdersAdminPage on the First Page
The OrdersAdmin Web User Control
The Database Stored Procedures
The Business Layer Methods
The Presentation Tier: OrdersAdmin.ascx
The OrderDetailsAdmin Web User Control
The Database Stored Procedures
The Business Layer
The Presentation Tier: OrderDetailsAdmin.ascx
Summary
Chapter 10: Customer Details
Customer Accounts
WroxJokeShop Customer Account Scheme
The Customer Table
The SecurityLib Class Library
Hashing
Encryption
The Customer Login Page
The Customer Registration Page
Customer Detail Modification Pages
The Checkout Page
Secure Connections
Obtaining a SSL Certificate from VeriSign
Enforcing SSL Connections
Modifying Redirections to Use SSL Connections
Summary
Chapter 11: Order Pipeline
What is an Order Pipeline?
The WroxJokeShop Order Pipeline
Building the Pipeline
Groundwork
The Audit Table
The Orders Table
The CreateCustomerOrder Stored Procedure
WroxJokeShop Modification
Utility Classes
The OrderProcessor Class
Adding More Functionality to OrderProeessor
Summary
Chapter 12: Implementing the Pipeline
The Pipeline Sections
PSlnitialNotification
PSCheckFunds
PSCheckStock
PSStockOK
PSTakePayment
PSShipGoods
PSShipOK
PSFinalNotification
WroxJokeShop Modifications
The Checkout.aspx Web Page
Modifications to OrdersAdminPage.aspx
The Status Table
Stored Procedures
OrderManager Modifications
OrdersAdmin.ascx Modifications
OrderDetailsAdmin.ascx Modifications
Testing the Order Administration Page
Summary
Chapter 13: Credit Card Transactions
Credit Card Transaction Fundamentals
Credit Card Payment Gateways
DataCash
Credit Card Transactions
Implementing Credit Card Processing
The DataCash XML APl
Pre Request
Pre Response
Fulfil Request
Fulfil Response
Exchanging XML Data
Integration with WroxJokeShop
OrderProcessor Configuration Modification
Pipeline Modification
Testing
Going Live
Summary
Chapter 14: The End
Join Our Community
Stake Out IBuySpy
Read More
Server Controls
Databases
ASP.NET
Security
Building Web Sites
Appendix A: Installing IlS, MSDE. OSQL, and Creating Class Libraries
Installing the IlS 5.x Web Server
Working with. liS
The Microsoft Management Console (MMC)
Testing your Installation
identifying your Web Server's Name
MSDE: Introduction
Obtaining and Installing MSDE
Using MSDE
Running Scripts with osql
Creating Class Libraries
Indexes
General Index
Wrox Joke Shop Index
Cristian Darie
Cristian is an independent IT consultant specializing in Microsoft technologies. He has worked with computers since he was a child, he won his first prize at the age of 12 in the first programming contest he ever entered. Now, with more than five years of professional programming experience, he tries to get involved in projects that are somehow connected to the .NET Framework, a product he likes very much. He is actively involved with Wrox Press as a technical reviewer, havin