Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Microsoft C# Professional Projects - Premier Press.pdf
Скачиваний:
177
Добавлен:
24.05.2014
Размер:
14.65 Mб
Скачать

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.