- •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 |
Chapter 7 |
|
115 |
|
|||
|
|
|
|
Project Life Cycle
The development life cycle of a project involves three phases:
Project initiation
Project execution
Project deployment
Project development actually starts when the need to develop or significantly change an existing system is identified. In this case, the need is to store, organize, and analyze the data.
After the business need is identified, the different approaches to meet it are reviewed for feasibility and appropriateness. An effective approach would be to create databases to store the data.The data in the databases can then be analyzed by displaying selective data or by grouping the data in a crystal report. I’ll now discuss the phases of a project life cycle in detail.
In the project initiation phase, a comprehensive list of tasks to be performed is prepared, and responsibilities, depending upon individual skills, are assigned to team members. I will be discussing the tasks that need to be performed when I proceed with the coding of the application.
In the project execution phase, the development team develops the application.This phase consists of the following stages:
Analyzing requirements
Creating high-level design
Creating low-level design
Constructing
Integration and testing
User acceptance testing
The final stage in the project life cycle is the project deployment phase. In this stage, the application is deployed at the client location, and support is provided to the client for a specified period. In addition, any bugs identified in the application are debugged. This phase consists of the following two stages:
Implementation
Operation and maintenance
116 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
The following sections discuss each of these stages in detail. To start with, I will discuss the stages of the project execution phase.
Analyzing Requirements
Analyzing requirements is the process of determining and documenting a customer’s needs and constraints. Subsequently, based on these requirements, you create a plan for developing the application. The process of analyzing requirements often starts with a problem statement given by a customer or the customer’s representative. Analysts organize all the information gathered from the customer and analyze the customer’s needs. Finally, they prepare a written description of the customer’s problem and define a possible solution.
In this case, the problem statement, as stated by Don Burton, is “CareKar, Inc. needs to analyze data on jobs done by a worker and visits made by a customer.” On analyzing the problem statement, the analysts defined the following list of problems faced by CareKar, Inc.
The company needs to create databases to store and organize data.
The company needs to analyze the data.
Based on the analysis of the data, the company needs to find means to serve its customers better and more efficiently.
Based on the analysis of the data, the company needs to calculate the gross salary of an individual worker.
As a solution to the problems faced by the customer, the analysts proposed that a Windows application with the following features be developed for CareKar, Inc.
The application communicates with the databases and displays the data in the databases in the Windows forms.
The application includes a means to create crystal reports that are used for analysis of the data.
The application is then deployed at the client site.
PROJECT CASE STUDY |
Chapter 7 |
117 |
|
|
|
High-Level Design
The second stage in the project execution phase is to develop a high-level design. In the high-le vel design phase, the external characteristics of the system, such as interfaces, are designed. In addition, in this phase, the operating environment and various subsystems and their input and output are decided. In this stage, features that require user input or approval from the client are documented, and client approval is obtained for the same. These documents include the functional specifications document of the application, which is presented in a simple language to the client. The functional specifications include the description of the databases, forms, and reports that will be included in the application. This application will be called Customer Maintenance Project.
This project includes Windows forms that display data from an underlying database, CMS (Customer Maintenance System). The following section discusses the database design.
Database Design
The first step in the development of a project is to design a robust database. Before you design a database, it’s a good idea to recapitulate the concepts related to a database.
Why do you need a database? A database is a repository of data,a place where you can store data and extract it whenever required. You can store and extract data from a database in various ways. One of the ways is by using SQL (structured query language) statements. The following section discusses some of the basic SQL statements used to create and modify the data in a database.
The SQL Statements
SQL is an ANSI (American National Standards Institute) standard for accessing database systems. SQL statements can be used to retrieve and update data in a database. SQL works with databases such as Microsoft Access, DB2 (Database 2), Informix, Microsoft SQL Ser ver, Oracle, Sybase, and many others.
Databases contain tables, which contain the data in the form of rows and columns. Table 7-1 shows an example of how data is stored in tables.
118 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
Table 7-1 Displaying Data in a Sales Table
City |
Sales |
Date |
New York |
23600 |
Jul-14-2002 |
Atlanta |
16400 |
Jul-12-2002 |
Seattle |
17300 |
Jul-11-2002 |
Chicago |
19700 |
Jul-14-2002 |
San Francisco |
24200 |
Jul-14-2002 |
In this table, City, Sales, and Date are tableYcolumns. The rows contain five |
||
records each about sales at five cities onLa particular date. |
||
You can extract this data from the databaseFby using SQL query statements. The |
||
next section will revise basic SQL query statements. |
|
|
|
M |
|
|
A |
|
E
The Select StatementT
A database can be queried using SQL Select statements. Here is an example of a simple SQL Select statement.
Select * from Sales
This statement extracts all the records from the Sales table.The syntax of an SQL Select statement is as follows:
Select [select-list] from [table name]
You can further modify the Select statement to extract data from the table based on a condition by using the where keyword. For example, consider that you need to only view the sales on July 14, 2002. The following SQL statement provides the required output.
select city, sales from Sales where date = ‘jul-14-2002’
The syntax for the Select statement where you extract data based on a condition is as follows:
Select [select-list] from [table name] where [search condition]
The search operators that you can use with the where keyword are described in Table 7-2.
Team-Fly®
PROJECT CASE STUDY |
Chapter 7 |
119 |
|
|
|
Table 7-2 Operators Used in a Search Condition
Operator |
Description |
= |
Equal |
> |
Greater than |
< |
Less than |
>= |
Greater than or equal |
<= |
Less than or equal |
<> |
Not equal |
Between |
Between an inclusive range |
Like |
Search for a pattern in a column |
|
|
Table 7-3 shows the Students table that contains information about students.
Table 7-3 The Students Table
FirstName |
LastName |
EmailAddress |
DOB |
City |
Sandra |
Lewis |
slewis@aol.com |
Jan-04-1971 |
Atlanta |
Elaine |
Thorn |
ethorn@yahoo.com |
Oct-27-1979 |
Chicago |
George |
Thomas |
gthomas@freemail.com |
Aug-25-1976 |
Atlanta |
Simon |
Watson |
swatson@fastmail.com |
Mar-18-1978 |
Memphis |
Larry |
Gates |
lgates@mymail.com |
Jun-12-1981 |
Atlanta |
Michael |
Brown |
mbrown@aol.com |
Feb-02-1972 |
Memphis |
Sarah |
Judd |
sjudd@zipmail.com |
Oct-04-1982 |
Chicago |
Joshua |
Johnson |
jjohnson@slowmail.com |
Apr-24-1977 |
Detroit |
Daniel |
Allison |
dallison@aol.com |
Dec-07-1975 |
Chicago |
Nicholas |
Harvey |
nharvey@buzz.com |
Mar-13-1979 |
Detroit |
Laura |
Hansen |
lhansen@hotmail.com |
Sep-12-1973 |
Memphis |
|
|
|
|
|
Now, I’ll create some SQL statements that will refresh your memory. To select only the students who live in Chicago, modify the Select statement, as follows:
Select * from Students where city = ‘Chicago’
120 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
Table 7-4 displays the result of the previous query.
Table 7-4 Students Who Live in Chicago
FirstName |
LastName |
EmailAddress |
DOB |
City |
Daniel |
Allison |
dallison@aol.com |
Dec-07-1975 |
Chicago |
Elaine |
Thorn |
ethorn@yahoo.com |
Oct-27-1979 |
Chicago |
Sarah |
Judd |
sjudd@zipmail.com |
Oct-04-1982 |
Chicago |
|
|
|
|
|
Consider the following SQL statement. The statement returns all rows with last names ending with n.
Select * from Students where LastName like ‘%n’
Table 7-5 displays the result of the previous query.
Table 7-5 Students Whose Last Name Ends With N
FirstName |
LastName |
EmailAddress |
DOB |
City |
Daniel |
Allison |
dallison@aol.com |
Dec-07-1975 |
Chicago |
Elaine |
Thorn |
ethorn@yahoo.com |
Oct-27-1979 |
Chicago |
Joshua |
Johnson |
jjohnson@slowmail.com |
Apr-24-1977 |
Detroit |
Laura |
Hansen |
lhansen@hotmail.com |
Sep-12-1973 |
Memphis |
Michael |
Brown |
mbrown@aol.com |
Feb-02-1972 |
Memphis |
Simon |
Watson |
swatson@fastmail.com |
Mar-18-1978 |
Memphis |
|
|
|
|
|
To alphabetically sort names of all students between Joshua and Michael, use the following SQL statement.
Select * from Students where FirstName between ‘Joshua’ and ‘Michael’
The result of the previous statement is displayed in Table 7-6.
|
|
PROJECT CASE STUDY |
Chapter 7 |
121 |
||
|
|
|
||||
Table 7-6 Students Whose First Name Is between Joshua and Michael |
||||||
|
|
|
|
|
|
|
FirstName |
LastName |
EmailAddress |
DOB |
City |
||
|
|
|
|
|
|
|
Joshua |
Johnson |
jjohnson@slowmail.com |
Apr-24-1977 |
Detroit |
||
Larry |
Gates |
lgates@mymail.com |
Jun-12-1981 |
Atlanta |
||
Laura |
Hansen |
lhansen@hotmail.com |
Sep-12-1973 |
Memphis |
||
Michael |
Brown |
mbrown@aol.com |
Feb-02-1972 |
Memphis |
||
|
|
|
|
|
|
|
Similarly, you can also display only specific columns. For example, to extract only FirstName, LastName, and City, you can use the following Select statement.
Select FirstName, LastName, City from Students
The result of the above SQL statement is shown in Table 7-7.
Table 7-7 List of First Names, Last Names, and Cities
FirstName |
LastName |
City |
Daniel |
Allison |
Chicago |
Elaine |
Thorn |
Chicago |
George |
Thomas |
Atlanta |
Joshua |
Johnson |
Detroit |
Larry |
Gates |
Atlanta |
Laura |
Hansen |
Memphis |
Michael |
Brown |
Memphis |
Nicholas |
Harvey |
Detroit |
Sandra |
Lewis |
Atlanta |
Sarah |
Judd |
Chicago |
Simon |
Watson |
Memphis |
|
|
|
122 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
The Insert Statement
The Insert statement inserts a new row in a table. For example, to insert a new record in the Students table, you can use the following SQL statement.
Insert into Students values (‘Sarah’, ‘Lee’, ‘slee@yahoo.com’, ‘Mar-22-1977’, ‘Detroit’)
The preceding SQL statement inserts a new record in the Students table with the values mentioned in the SQL statement.
You can also insert data into specific columns. For example, to add only first and last names, you can use the following Insert statement.
Insert into students (FirstName, LastName) values (‘Jessica’, ‘Parker’)
The Update Statement
The Update statement modifies the data in a table. For example, consider that Laura Hansen has changed her last name to Brown. The following update statement can help you make the change:
Update Students set LastName = ‘Brown’ where FirstName = ‘Laura’ and LastName =
‘Hansen’
The Delete Statement
The Delete statement removes some or all rows from a table. For example, in the Students table, to delete the records of all students in Detroit, you use the following SQL statement:
Delete from Students where City = ‘Detroit’
The Create Statement
The Create statement can be used to create a database, a table in a database, and indexes in a table. For example, the following Create statement can be used to create a database containing customers.