- •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
PROJECT CASE STUDY AND DESIGN |
Chapter 18 |
407 |
|
|
|
|
|
Total fare collected. Customers who have paid more than a certain amount as fare are also given discounts. The amount and the discount, in this case as well, are decided by the business manager.
The discount applicable to users is applied when they book a ticket on the airline.
Summarizing the Tasks
I have explained all the tasks that need to be performed by the airline. I will now sort each task by role, because this information is used for creating the form design.
The tasks of business managers are summarized as follows:
Add and remove flights
Request for user IDs
Generate reports
Manager frequent flier programs
The tasks of network administrators are summarized as follows:
Add and delete user accounts
Back up and archive databases
Examine Web server and database logs
The tasks of line-of-business executives are summarized as follows:
Create and cancel reservations
Query status of flights and tickets
Confirm tickets
The summarized tasks form the basis of the application. As you will see in the next section, the database structure and the application interface follow closely with the tasks summarized for each business executive.
Project Design
After having examined the requirements of the application in detail, you can now proceed with designing the application. In the project design stage, you identify the database tables and the relationships between them to finalize the database
408 Project 4 CREATING AN AIRLINE RESERVATION PORTAL
schema. It is critical to examine all the possible requirements and incorporate them in the database schema because reworking the design later means a lot of wasted effort. After you finalize the database schema, you can finalize interface of your application so that the development team has a framework on which it can work.
In this section, I examine the database schema of the SkyShark Airlines database
and the design of the forms. The design of the forms is the interface of the final application.
Database Design |
|
|
Y |
You arrive at the structure of the databaseLtables after creating the preliminary |
|||
structure of tables that match the application requirements and then normalizing |
|||
|
|
F |
|
the structure to eliminate data redundancy. The process is explained in Chapter 7, |
|||
“Project Case Study,” in the section “Normalization.” |
|||
|
|
M |
|
If you examine the businessArequirements stated previously, the first task per- |
|||
|
E |
|
|
T |
|
|
formed in the airline application is the creation of new user accounts. Therefore, I begin with explaining the structure of the dtUsers table, which will be used for storing the details of authorized users.Thereafter, I explain each table of the database as it is created.
The dtUsers Table
The dtUsers table has four columns.Three columns store the username, password, and role of the user, while the fourth one signifies whether or not the user has changed the password after logging on the first time.The structure of the dtUsers table is given in Table 18-1.
Table 18-1 Structure of the dtUsers Table
Column Name |
Data Type |
Length |
Allow Nulls |
Username |
char |
15 |
0 |
Password |
char |
15 |
0 |
Role |
char |
10 |
0 |
PasswordChanged |
bit |
1 |
1 |
|
|
|
|
Team-Fly®
PROJECT CASE STUDY AND DESIGN |
Chapter 18 |
409 |
|
|
|
|
|
TIP
In the preceding table structure, the value 0 for Allow Nulls implies that it is mandatory for you to specify a value for the field when you add a new record. Similarly, the value 1 implies that the field is optional when you add a new record. For example, in the dtUsers table, the PasswordChanged field, which stores a Boolean value to specify whether or not the user has changed the password, is optional.
After network administrators create user IDs in the dtUsers table, business managers should specify flight details.
The dtFltDetails Table
The dtFltDetails table stores details of airline routes flown by the airline. The structure of the dtFltDetails table is given in Table 18-2.
Table 18-2 Structure of the dtFltDetails Table
Column Name |
Data Type |
Length |
Allow Nulls |
FltNo |
char |
10 |
0 |
Origin |
text |
16 |
0 |
Destination |
text |
16 |
0 |
Deptime |
datetime |
8 |
0 |
Arrtime |
datetime |
8 |
0 |
AircraftType |
char |
10 |
0 |
SeatsExec |
int |
4 |
0 |
SeatsBn |
int |
4 |
0 |
FareExec |
int |
4 |
0 |
FareBn |
int |
4 |
0 |
LaunchDate |
datetime |
8 |
0 |
|
|
|
|
410 Project 4 CREATING AN AIRLINE RESERVATION PORTAL
In the structure of the dtFltDetails table given in Table 18-2, I have added a LaunchDate field.The LaunchDate field is used to store the date on which the flight is launched. This information will be used to display details of newly launched flights on the Web site.
After flight details are added to the dtFltDetails table, line-of-business executives can make reservations on the airline. Therefore, I now move on to the table that is used for storing details of reservations, dtReservations.
The dtReservations Table
The dtReservations table is the most frequently used table of the database. The table is used to store details of passengers who have reserved a seat on the flight. The structure of the dtReservations table is given in Table 18-3.
Table 18-3 Structure of the dtReservations Table
Column Name |
Data Type |
Length |
Allow Nulls |
TicketNo |
char |
10 |
0 |
FltNo |
char |
10 |
0 |
DateOfJourney |
datetime |
8 |
0 |
ClassOfRes |
char |
4 |
0 |
Name |
char |
20 |
0 |
char |
50 |
1 |
|
Fare |
int |
4 |
0 |
Status |
int |
4 |
0 |
ReservedBy |
char |
15 |
0 |
DateOfRes |
datetime |
8 |
0 |
TicketConfirmed |
bit |
1 |
1 |
|
|
|
|
In the dtReservations table, the TicketConfirmed and EMail fields allow null values. The TicketConfirmed field is updated when users confirm their ticket. The e-mail address, when specified by the passenger, is used for enabling the frequent flier program.
PROJECT CASE STUDY AND DESIGN |
Chapter 18 |
411 |
|
|
|
|
|
TIP
To ensure privacy of data, only customers who specify their e-mail address can query their ticket status on the online portal of SkyShark Airlines.
As a result of a large number of flights flown by the airline, there will be a large amount of data in the dtReservations table. However, if you notice, you need to store details of passengers related to those flights that have departed only for the frequent flier programs. Therefore, a network administrator should ideally move the data related to departed flights to another table, which can be used for the frequent fliers program.This type of mechanism will have the following advantages:
Archiving database tables easily. Data that is ready for archiving is automatically moved to another table. Therefore, network administrators can archive database tables easily.
Improved performance. If you use a different database for storing data pertaining to flights that have departed, queries for analyzing data will be directed to the other database and the performance of the dtReserva-
tions table, which is critical to the online portal, will improve because redundant transactions are eliminated.
Easy access to data. For generating reports, business managers need not access dynamic data in the dtReservations table. Instead, they can use the other table to retrieve only the data that is pertinent to analysis.
To implement the logic that I have explained, I have created the dtDepartedFlights table, which follows next.
The dtDepartedFlights Table
The dtDepartedFlights table has exactly the same structure as the dtReservations table. Therefore, I do not replicate it here. You can look the structure up in Table 18-3. After a flight has departed, data pertaining to passengers who have flown the flight is moved to the dtDepartedFlights table. This data is used for generating reports and for enabling the frequent flier programs.
Having examined the tables related to flight details and reservations, you can examine the table for cancellations, dtCancellations.
412 Project 4 CREATING AN AIRLINE RESERVATION PORTAL
The dtCancellations Table
The dtCancellations table stores information related to tickets that have been cancelled. This information is required only for accountability of refunded fare and reservations. Therefore, if a passenger whose ticket has been cancelled informs the airline that the ticket should not have been cancelled, the details of the executive who processed the cancellation can be traced and the reasons of the cancellation can be determined. The structure of the dtCancellations table is given in Table 18-4.
Table 18-4 Structure of the dtCancellations Table
Column Name |
Data Type |
Length |
Allow Nulls |
TicketNo |
char |
10 |
0 |
Refund |
int |
4 |
0 |
ProcessedBy |
char |
15 |
0 |
CancellationDate |
datetime |
8 |
0 |
|
|
|
|
The dtCancellations table can be archived on a timely basis to ensure that no redundant data is stored in the database. I will now discuss the next important
table, dtFltStatus.
The dtFltStatus Table
When a passenger reserves a seat on an airline, the number of seats available for reservation should reduce by one. Similarly, if a flight is overbooked, excess passengers should be placed in queue. The updated status of a flight should be available to passengers when they reserve their seat.
To ensure that an updated status of a flight is always available, I have used the dtFltStatus table. As soon as the first ticket is booked on a flight, an entry for the flight is created in the dtFltStatus table.This table is updated as reservations and cancellations are made. The structure of the dtFltStatus table is given in Table 18-5.
|
PROJECT CASE STUDY AND DESIGN |
Chapter 18 |
413 |
|||
Table 18-5 Structure of the dtFltStatus Table |
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
Column Name |
Data Type |
Length |
Allow Nulls |
|||
|
|
|
|
|
|
|
FltNo |
char |
10 |
0 |
|
|
|
StatusDate |
datetime |
8 |
0 |
|
|
|
StatusClass |
char |
10 |
0 |
|
|
|
Status |
int |
4 |
0 |
|
|
|
|
|
|
|
|
|
|
In the structure of the dtFltStatus table, the FltNo, StatusDate, and StatusClass
fields form a composite key. This implies that the three fields together form a unique combination that can be used to retrieve the status of a specific class of a flight on a specified date.
I will now examine the last two tables that are related to the frequent flier pro-
gram, dtPassengerDetails and dtFrequentFliers.
The dtPassengerDetails Table
To enable the frequent fliers program, the dtPassengerDetails table retrieves data
from the dtDepartedFlights table. The dtPassengerDetails table uses the e-mail
address of passengers to identify the number of times they have flown the airline and the total fare collected from them in these flights.The structure of the sengerDetails table is given in Table 18-6.
Table 18-6 Structure of the dtPassengerDetails Table
Column Name |
Data Type |
Length |
Allow Nulls |
char |
50 |
0 |
|
FareCollected |
int |
4 |
0 |
TotalTimesFlown |
int |
4 |
0 |
|
|
|
|
Whenever a new frequent flier program is launched, data from the dtPassengerDetails table is used to determine how many passengers the program will impact. This data is used for enabling discounts to passengers. The discounts are specified in the dtFrequentFliers table.
414 Project 4 CREATING AN AIRLINE RESERVATION PORTAL
The dtFrequentFliers Table
The dtFrequentFliers table is used to specify the discount (expressed in percentage) applicable to customers. Just as in the dtPassengerDetails table, the passengers are identified by their e-mail address. The structure of the dtFrequentFliers table is given in Table 18-7.
Table 18-7 Structure of the dtFrequentFliers Table
Column Name |
Data Type |
Length |
Allow Nulls |
char |
50 |
0 |
|
Discount |
int |
4 |
0 |
|
|
|
|
When a passenger reserves a ticket, the e-mail address of the passenger is checked in the dtFrequentFliers table to query if a discount is applicable to the passenger. If a discount is applicable, the fare is computed after deducting the applicable discount.
Database Schema
Having examined all the tables of the SkyShark Airlines database, you can infer the database schema by creating relationships between database tables. The schema for the SkyShark Airlines database is shown in Figure 18-1.
FIGURE 18-1 Database schema for SkyShark Airlines