- •About the Authors
- •Contents at a Glance
- •Contents
- •Introduction
- •Goal of the Book
- •How to Use this Book
- •Introduction to the .NET Framework
- •Common Language Runtime (CLR)
- •Class Library
- •Assembly
- •Versioning
- •Exceptions
- •Threads
- •Delegates
- •Summary
- •Introduction to C#
- •Variables
- •Initializing Variables
- •Variable Modifiers
- •Variable Data Types
- •Types of Variables
- •Variable Scope
- •Types of Data Type Casting
- •Arrays
- •Strings
- •Initializing Strings
- •Working with Strings
- •Statements and Expressions
- •Types of Statements
- •Expressions
- •Summary
- •Classes
- •Declaring Classes
- •Inheritance
- •Constructors
- •Destructors
- •Methods
- •Declaring a Method
- •Calling a Method
- •Passing Parameters to Methods
- •Method Modifiers
- •Overloading a Method
- •Namespaces
- •Declaring Namespaces
- •Aliases
- •Structs
- •Enumerations
- •Interfaces
- •Writing, Compiling, and Executing
- •Writing a C# Program
- •Compiling a C# Program
- •Executing a C# Program
- •Summary
- •Arrays
- •Single-Dimensional Arrays
- •Multidimensional Arrays
- •Methods in Arrays
- •Collections
- •Creating Collections
- •Working with Collections
- •Indexers
- •Boxing and Unboxing
- •Preprocessor Directives
- •Summary
- •Attributes
- •Declaring Attributes
- •Attribute Class
- •Attribute Parameters
- •Default Attributes
- •Properties
- •Declaring Properties
- •Accessors
- •Types of Properties
- •Summary
- •Introduction to Threads
- •Creating Threads
- •Aborting Threads
- •Joining Threads
- •Suspending Threads
- •Making Threads Sleep
- •Thread States
- •Thread Priorities
- •Synchronization
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Primary and Foreign Keys
- •Referential Integrity
- •Normalization
- •Designing a Database
- •Low-Level Design
- •Construction
- •Integration and Testing
- •User Acceptance Testing
- •Implementation
- •Operations and Maintenance
- •Summary
- •Creating a New Project
- •Console Application
- •Windows Applications
- •Creating a Windows Application for the Customer Maintenance Project
- •Creating an Interface for Form1
- •Creating an Interface for WorkerForm
- •Creating an Interface for CustomerForm
- •Creating an Interface for ReportsForm
- •Creating an Interface for JobDetailsForm
- •Summary
- •Performing Validations
- •Identifying the Validation Mechanism
- •Using the ErrorProvider Control
- •Handling Exceptions
- •Using the try and catch Statements
- •Using the Debug and Trace Classes
- •Using the Debugging Features of Visual Studio .NET
- •Using the Task List
- •Summary
- •Creating Form1
- •Connecting WorkerForm to the Workers Table
- •Connecting CustomerForm to the tblCustomer Table
- •Connecting the JobDetails Form
- •to the tblJobDetails Table
- •Summary
- •Introduction to the Crystal Reports Designer Tool
- •Creating the Reports Form
- •Creating Crystal Reports
- •Creating the Windows Forms Viewer Control
- •Creating the Monthly Worker Report
- •Summary
- •Introduction to Deploying a Windows Application
- •Deployment Projects Available in Visual Studio .NET
- •Deployment Project Editors
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Low-Level Design
- •Summary
- •Populating the TreeView Control
- •Displaying Employee Codes in the TreeView Control
- •Event Handling
- •Displaying Employee Details in the ListView Control
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Low-Level Design
- •Summary
- •Adding the Programming Logic to the Application
- •Adding Code to the Form Load() Method
- •Adding Code to the OK Button
- •Adding Code to the Exit Button
- •Summary
- •The Created Event
- •Adding Code to the Created Event
- •Overview of XML
- •The XmlReader Class
- •The XmlWriter Class
- •Displaying Data in an XML Document
- •Displaying an Error Message in the Event Log
- •Displaying Event Entries from Event Viewer
- •Displaying Data from the Summary.xml Document in a Message Box
- •Summary
- •Airline Profile
- •Role of a Business Manager
- •Role of a Network Administrator
- •Role of a Line-of-Business Executive
- •Project Requirements
- •Creation and Deletion of User Accounts
- •Addition of Flight Details
- •Reservations
- •Cancellations
- •Query of Status
- •Confirmation of Tickets
- •Creation of Reports
- •Launch of Frequent Flier Programs
- •Summarizing the Tasks
- •Project Design
- •Database Design
- •Web Forms Design
- •Enabling Security with the Directory Structure
- •Summary
- •Getting Started with ASP.NET
- •Prerequisites for ASP.NET Applications
- •New Features in ASP.NET
- •Types of ASP.NET Applications
- •Exploring ASP.NET Web Applications
- •Introducing Web Forms
- •Web Form Server Controls
- •Configuring ASP.NET Applications
- •Configuring Security for ASP.NET Applications
- •Deploying ASP.NET Applications
- •Creating a Sample ASP.NET Application
- •Creating a New Project
- •Adding Controls to the Project
- •Coding the Application
- •Summary
- •Creating the Database Schema
- •Creating Database Tables
- •Managing Primary Keys and Relationships
- •Viewing the Database Schema
- •Designing Application Forms
- •Standardizing the Interface of the Application
- •Common Forms in the Application
- •Forms for Network Administrators
- •Forms for Business Managers
- •Forms for Line-of-Business Executives
- •Summary
- •The Default.aspx Form
- •The Logoff.aspx Form
- •The ManageUsers.aspx Form
- •The ManageDatabases.aspx Form
- •The ChangePassword.aspx Form
- •Restricting Access to Web Forms
- •The AddFl.aspx Form
- •The RequestID.aspx Form
- •The Reports.aspx Form
- •The FreqFl.aspx Form
- •Coding the Forms for LOB Executives
- •The CreateRes.aspx Form
- •The CancelRes.aspx Form
- •The QueryStat.aspx Form
- •The ConfirmRes.aspx Form
- •Summary
- •Designing the Form
- •The View New Flights Option
- •The View Ticket Status Option
- •The View Flight Status Option
- •The Confirm Reservation Option
- •Testing the Application
- •Summary
- •Locating Errors in Programs
- •Watch Window
- •Locals Window
- •Call Stack Window
- •Autos Window
- •Command Window
- •Testing the Application
- •Summary
- •Managing the Databases
- •Backing Up the SkyShark Airlines Databases
- •Exporting Data from Databases
- •Examining Database Logs
- •Scheduling Database Maintenance Tasks
- •Managing Internet Information Server
- •Configuring IIS Error Pages
- •Managing Web Server Log Files
- •Summary
- •Authentication Mechanisms
- •Securing a Web Site with IIS and ASP.NET
- •Configuring IIS Authentication
- •Configuring Authentication in ASP.NET
- •Securing SQL Server
- •Summary
- •Deployment Scenarios
- •Deployment Editors
- •Creating a Deployment Project
- •Adding the Output of SkySharkDeploy to the Deployment Project
- •Deploying the Project to a Web Server on Another Computer
- •Summary
- •Organization Profile
- •Project Requirements
- •Querying for Information about All Books
- •Querying for Information about Books Based on Criteria
- •Ordering a Book on the Web Site
- •Project Design
- •Database Design
- •Database Schema
- •Web Forms Design
- •Flowcharts for the Web Forms Modules
- •Summary
- •Introduction to ASP.NET Web Services
- •Web Service Architecture
- •Working of a Web Service
- •Technologies Used in Web Services
- •XML in a Web Service
- •WSDL in a Web Service
- •SOAP in a Web Service
- •UDDI in a Web Service
- •Web Services in the .NET Framework
- •The Default Code Generated for a Web Service
- •Testing the SampleWebService Web Service
- •Summary
- •Creating the SearchAll() Web Method
- •Creating the SrchISBN() Web Method
- •Creating the AcceptDetails() Web Method
- •Creating the GenerateOrder() Web Method
- •Testing the Web Service
- •Securing a Web Service
- •Summary
- •Creating the Web Forms for the Bookers Paradise Web Site
- •Adding Code to the Web Forms
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Low-Level Design
- •Summary
- •Overview of Mobile Applications
- •The Microsoft Mobile Internet Toolkit
- •Overview of WAP
- •The WAP Architecture
- •Overview of WML
- •The Mobile Web Form
- •The Design of the MobileTimeRetriever Application
- •Creating the Interface for the Mobile Web Forms
- •Adding Code to the MobileTimeRetriever Application
- •Summary
- •Creating the Forms Required for the MobileCallStatus Application
- •Creating the frmLogon Form
- •Creating the frmSelectOption Form
- •Creating the frmPending Form
- •Creating the frmUnattended Form
- •Adding Code to the Submit Button in the frmLogon Form
- •Adding Code to the Query Button in the frmSelectOption Form
- •Adding Code to the Mark checked as complete Button in the frmPending Form
- •Adding Code to the Back Button in the frmPending Form
- •Adding Code to the Accept checked call(s) Button in the frmUnattended Form
- •Adding Code to the Back Button in the frmUnattended Form
- •Summary
- •What Is COM?
- •Windows DNA
- •Microsoft Transaction Server (MTS)
- •.NET Interoperability
- •COM Interoperability
- •Messaging
- •Benefits of Message Queues
- •Limitations
- •Key Messaging Terms
- •Summary
- •Pointers
- •Declaring Pointers
- •Types of Code
- •Implementing Pointers
- •Using Pointers with Managed Code
- •Working with Pointers
- •Compiling Unsafe Code
- •Summary
- •Introduction to the Languages of Visual Studio .NET
- •Visual C# .NET
- •Visual Basic .NET
- •Visual C++ .NET
- •Overview of Visual Basic .NET
- •Abstraction
- •Encapsulation
- •Inheritance
- •Polymorphism
- •Components of Visual Basic .NET
- •Variables
- •Constants
- •Operators
- •Arrays
- •Collections
- •Procedures
- •Arguments
- •Functions
- •Adding Code to the Submit Button
- •Adding Code to the Exit Button
- •Summary
- •Introduction to Visual Studio .NET IDE
- •Menu Bar
- •Toolbars
- •Visual Studio .NET IDE Windows
- •Toolbox
- •The Task List Window
- •Managing Windows
- •Customizing Visual Studio .NET IDE
- •The Options Dialog Box
- •The Customize Dialog Box
- •Summary
- •Index
602 Project 5 CREATING A WEB PORTAL FOR A BOOKSTORE
Ordering a Book on the Web Site
The procedure to order a book on the Web site is as follows:
1.The user selects a book to order in the Orders page.
2.The user then clicks on the Order button to order the book.
3.The user is taken to the Orders page. On the Orders page, the customer details, such as name, address, and credit card information, are specified.
4.After specifying the required details, the user clicks on the Order button.
5.When the Order button is clicked, the details submitted by the user is sent to the database maintained by the publishing house.
NOTE
To send the information submitted by the user to the database of the publishing house, the Web site uses a Web method created in the Web service. You will learn about this method, AcceptDetails(), in Chapter 29, “Developing Web Services.”
6.The details of the customer and the order placed by the customer are stored in the database at the publishing house.
7.At the site of the publishing house, the request of the user is processed and the book is delivered to the client.
Project Design
Having examined the project requirements in detail, you need to create a detailed design of the project. You can create a design of the application in the project design stage. The project design stage includes identifying the database design and the database schema. To finalize the database schema, you first need to decide on the tables required in the database. Then, a detailed analysis of the database design is required to identify the relationships between various tables in the database. Based on this, a detailed schema of the database is created. It is critical to examine all possible requirements and incorporate them in the database schema to avoid reworking at a later stage. The following section delineates the database design for the Web portal.
PROJECT CASE STUDY AND DESIGN |
Chapter 27 |
|
603 |
|
|
||||
|
|
|
|
|
Database Design
After creating the structure of database tables and normalizing the structure, you arrive at a database schema that is appropriate for your Web portal project. Normalizing the database design helps to remove data redundancy.
In the case of this Web portal, data is not stored in the database of any one organization.Data is spread across the databases of Bookers Paradise and the two publishing houses. It therefore becomes all the more essential for you to carefully plan the database design and normalize the design. This will help you avoid data redundancy across tables in the databases of different organizations. You have learned about the basic concepts of creating an SQL database and normalization in Chapter 7, “Project Case Study,” in the section “Normalization.”
In addition to creating the database design for the three organizations, you need to establish relationships between the tables in the databases. This will help you program your application to query and update data in the related tables. I will discuss how to create relationships between tables later in this chapter. However, I will first discuss the structure of the tables in the databases of the three organizations.
Database Design for Bookers Paradise
Bookers Paradise plans to launch a Web site that allows visitors to view information about books and to place an order for a book. To do this, Bookers Paradise maintains a database called BookersDB. This database includes two tables, BookersOrders and BookersCustDetails. The following section discusses these tables in detail.
The BookersOrders Table
The BookersOrders table stores information about the order placed by a customer for a book.Therefore, this table includes information such as OrderNo, CustomerID, and ISBNNo of the book. When a customer places an order, a unique identification number, CustomerID, is assigned to the customer. In addition, for each order, a unique number, OrderNo, is assigned.The OrderNo is defined as the primary key for the table. Table 27-1 shows the fields in the BookersOrders table in the BookersDB database.
604 Project 5 CREATING A WEB PORTAL FOR A BOOKSTORE
Table 27-1 Structure of the BookersOrders Table
Column Name |
Data Type |
Length |
Allow Nulls |
OrderNo |
char |
10 |
0 |
CustomerID |
char |
6 |
0 |
ISBNNo |
char |
10 |
0 |
|
|
|
|
NOTE
In the preceding structure of the BookersOrders table, the value 0 for the Allow Nulls column does not allow the user to leave this field blank. However, if you specify the value as 1, the field is optional when adding a new record. I will be using this convention while discussing the structure of the rest of the tables.
The BookersCustDetails Table
In addition to storing the details of the order, Bookers Paradise wants to store the details of all the customers who place an order for a book. To do this, the BookersCustDetails table is created. The BookersCustDetails table contains fields
such as CustomerID, CustomerName, BillingAddress, and so on. The CustomerID
field is set as primary key for this table. Table 27-2 shows the details of the
BookersCustDetails table.
Table 27-2 Structure of the BookersCustDetails Table
Column Name |
Data Type |
Length |
Allow Nulls |
CustomerID |
char |
6 |
0 |
CustomerName |
varchar |
50 |
0 |
BillingAddress1 |
varchar |
50 |
0 |
BillingAddress2 |
varchar |
50 |
0 |
BillingAddressCity |
varchar |
20 |
0 |
BillingAddressState |
varchar |
20 |
0 |
|
|
|
|
PROJECT CASE STUDY AND DESIGN |
Chapter 27 |
|
605 |
|
|
||||
|
|
|
|
|
Database Design for Deepthoughts Publications
If you consider the business requirements for the Web portal project, when a customer places an order for a book, the order, along with the information about the customer, is forwarded to the respective publisher. Deepthoughts Publications then stores this information in a database called DTDB. The DTDB database contains two tables, the DTCatalog and the DTOrders tables.I will discuss the structure of these tables in the following sections.
The DTCatalog Table
The DTCatalog table stores information about the books published by Deepthoughts Publications. This information includes the ISBN number, title, author, date of publishing, price, and category of the book. In addition, the table contains a short description of the book.
Every book published at the publishing house has a unique ISBN number, which is defined as the primary key for the DTCatalog table. Table 27-3 shows the structure of the DTCatalog table.
Table 27-3 Structure of the DTCatalog Table
Column Name |
Data Type |
Length |
Allow Nulls |
ISBNNo |
char |
10 |
0 |
BookTitle |
varchar |
50 |
0 |
Author |
varchar |
50 |
0 |
Category |
char |
10 |
0 |
Description |
varchar |
50 |
0 |
DateOfPublication |
datetime |
8 |
0 |
Price |
varchar |
8 |
0 |
|
|
|
|
The DTOrders Table
The DTOrders table stores information about an order placed by the customer. In addition, you can store the details of the customer who placed the order. Table 27-4 shows the fields in the DTOrders table.
606 |
Project 5 |
CREATING A WEB PORTAL FOR A BOOKSTORE |
|
||||
|
|
|
|
|
|
||
|
|
Table 27-4 Structure of the DTOrders Table |
|
|
|||
|
|
|
|
|
|
|
|
|
|
Column Name |
Data Type |
Length |
Allow Nulls |
||
|
|
|
|
|
|
|
|
|
|
ISBNNo |
char |
10 |
0 |
||
|
|
OrderNo |
char |
5 |
0 |
||
|
|
DateOfOrder |
datetime |
8 |
0 |
||
|
|
CustomerName |
varchar |
50 |
0 |
||
|
|
CustomerAddress1 |
varchar |
50 |
0 |
||
|
|
CustomerAddress2 |
varchar |
50 |
1 |
||
|
|
CustomerCity |
varchar |
20 |
0 |
||
|
|
CustomerState |
varchar |
10 |
0 |
||
|
|
OrderedBy |
varchar |
50 |
0 |
||
|
|
Status |
|
varchar |
20 |
0 |
|
|
|
CreditCardType |
char |
10 |
0 |
||
|
|
CreditCardNumber |
varchar |
20 |
0 |
||
|
|
|
|
|
|
|
|
The preceding table contains a Status column. This column contains information about the status of the delivery of the book to the customer. In addition, Table 27-4 contains a field with the name OrderedBy. This field stores the information about the retailer who ordered for the specified book. In our case, the value stored in this field is Bookers Paradise.
The DTOrders table also contains information about the credit card of the customer, such as the type of credit card and the credit card number of the customer.
The DTOrders table has the combination of ISBNNo and OrderNo fields as the composite key.
Database Design for Black and White Publications
Black and White Publications maintains a database called BWDB. Similar to the database of Deepthoughts Publications, the BWDB database stores information
PROJECT CASE STUDY AND DESIGN |
Chapter 27 |
607 |
|
|
|
|
|
about the books published by Black and White Publications and the customers who order the books. To store this information, the BWDB database has two tables, BWCatalog and BWOrders. The following sections discuss these tables in detail.
The BWCatalog Table
The BWCatalog table stores information about the books published by Black and White Publications. Table 27-5 shows the structure of the BWCatalog table.
Table 27-5 Structure of the BWCatalog Table
Column Name |
Data Type |
Length |
Allow Nulls |
ISBNNo |
char |
10 |
0 |
BookName |
varchar |
50 |
0 |
Author |
varchar |
50 |
0 |
Price |
decimal |
9 |
0 |
AboutTheAuthor |
varchar |
100 |
1 |
Category |
varchar |
30 |
0 |
|
|
|
|
As you can see, the BWCatalog table stores information such as the ISBN number, name, author, price, and category of the book. In addition, the preceding table contains the AboutTheAuthor field. You can store some information about the author of the book in this field. The ISBNNo field is set as the primary key for this table.
The BWOrders Table
Similar to the orders table of Deepthoughts Publications,the orders table of Black and White Publications stores information about the orders that are sent by the site of Bookers Paradise. Table 27-6 shows the fields contained in the BWOrders table in the BWDB database.