- •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 15 |
335 |
|
|
|
|
|
An operator at the head office makes an entry of each cash memo into an XML document. At the end of the day, the data in the XML document is analyzed to determine the sales from each bookstore. This data would then be analyzed at the end of the month to decide the performance of the bookstores.
The development team at Creative Learning has decided to automate the entire process. When a salesperson issues a cash memo to a customer, the salesperson makes a copy of the cash memo in the specified directory on the main server. Then, on the main server, the format of the cash memo is checked for accuracy. Once the format is validated, the entry of the cash memo will be made into the XML document.The data in the document can then be easily analyzed to see the performance of each of the bookstores.
To carry out the entire process, the development team plans to create a Windows application and name it the Creative Learning project.The following section discusses the stages in the life cycle of the Creative Learning project.
Project Life Cycle
You looked at the phases of a DLC (development life cycle) of a project in Chapter 7, “Project Case Study,” in the section “Case Study.” Therefore, in this chapter, I will not discuss the entire life cycle of the project. However, I will discuss the analysis of the organization’s requirements from the development team at Creative Learning. In addition, I will discuss the design of the application created by the development team based on the analysis of the organization’s requirements. You, as a part of the development team, will analyze the requirements of Creative Learning and will create a design for the application based on the analysis.
Analyzing Requirements
To find a solution to a customer’s problem, it is essential that you analyze the requirements of the customer in detail.This is done in the analyzing requirements phase of the project life cycle. After analyzing the customer’s problem in detail, you create a plan for developing the application. This analysis of the customer’s problem is based on the problem statement stated by senior managers and the information gathered by the development team.
336 Project 3 CREATING A CREATIVE LEARNING PROJECT
In the case of Creative Learning, the problem statement, as stated by senior managers, is, “Creative Learning needs to automate the process of analyzing sales data of each bookstore.”
Upon analyzing the problem statement, the development team defined the following list of tasks that Creative Learning needs to do:
The organization needs to analyze the sales data of each bookstore.
The organization needs to automate the data analysis process.
Based on the analysis results, the organization will determine the performance of each bookstore.
Based on the performance of bookstores, the organization plans to move ahead with its growth plans.
To provide a solution to the aforementioned problems of Creative Learning, the development team plans to create a Windows application with the following features:
The application will receive a copy of the cash memo from a directory on the main ser ver at the head office of Creative Learning.
The application will validate the format of the cash memo.
If the format of the cash memo is incorrect, the application will create an event log.
Alternatively, if the format of the cash memo is correct, an entry for the cash memo will be created in an XML document.
High-Level Design
Based on the plan of the Windows application, the development team created a design of the Windows application in the high-level design phase. The design of the Creative Learning application includes creating the interface for the Windows form used in the application.
The Creative Learning application consists of a Windows form called Creative Learning. Figure 15-1 shows the layout of the Creative Learning form.
PROJECT CASE STUDY AND DESIGN |
Chapter 15 |
337 |
|
|
|
|
|
FIGURE 15-1 Layout of the Creative Learning form
To create the layout of the Creative Learning application, as shown in Figure 15-1, you need to include a tab control and two button controls.You have learned about button controls in Chapter 8, “Windows Forms and Controls” in the section “Types of Windows Forms Controls.”The following section discusses a TabControl control in detail.
The TabControl Control
A TabControl control is a Windows forms control that you can use to create multiple tabbed pages in a window or a dialog box. For example, a tab control can be used to display multiple-options pages in a wizard. You can use the arrow keys to shift from one tabbed page to another. A TabControl control has a TabPages property that you can modify to add tabbed pages to the tab control. You will learn about adding tabbed pages to a tab control later in this chapter.
To create a tab control in Visual Studio .NET, you can drag the control from the Windows Forms toolbox to the form. Figure 15-2 shows the TabControl control in the Windows Forms toolbox.
338 Project 3 CREATING A CREATIVE LEARNING PROJECT
|
|
Y |
|
L |
|
|
F |
|
|
M |
|
A |
|
|
E |
|
|
FIGURE 15-2 A TabControl control in the Windows Forms toolbox |
||
T |
|
|
You can now create a tab control for your application. To create a tab control, perform the following steps:
1. Drag a TabControl control from the Windows Forms toolbox to the Creative Learning form.
A blank TabControl control is added to the form. To add pages to the tab control, you need to change the properties of the tab control.
2. Press the F4 key to display the properties of the tab control.
3. In the Properties window, click on the ellipsis button of the TabPages property.
The TabPage Collection Editor page is displayed. This page allows you to add tabbed pages to the control as a Collection object.
4. To add a tabbed page, click on the Add button.
A tabbed page with an index 0 is added to the Members: text box. The properties of the tabbed page are displayed in the tabPage1 Properties: window.
5. In the tabPage1 Properties: window, change the following properties of the tabbed page.
Text: Source Options
Name: tabSource
Team-Fly®
PROJECT CASE STUDY AND DESIGN |
Chapter 15 |
339 |
|
|
|
|
|
When you change the name of the tabbed page to tabSource, the name of the tabPage1 Properties: window changes to tabSource Properties: window.
6.Repeat Steps 4 and 5 to add another tabbed page to the form.
7.Name the new tabbed page tabDest, and change the Text property to Destination Options.
You can change the order in which the tabbed pages are displayed by clicking on either the Up or Down Arrow buttons.
Figure 15-3 shows the TabPage Collection Editor page.
8.Click on the OK button to add tabbed pages.
FIGURE 15-3 The TabPage Collection Editor page
The tabbed pages are added, as shown in Figure 15-4. You can resize the tab control to display the tabbed pages.
340 Project 3 CREATING A CREATIVE LEARNING PROJECT
FIGURE 15-4 The TabControl control added to the Creative Learning form
The tabs in the tab control do not contain an image yet. You can add images to the tabs in the tab control by changing the ImageIndex property in the TabPage Collection Editor page. However, to do this, you first need to add an ImageList control to the Creative Learning form.
The ImageList Control
Visual Studio .NET provides you with an ImageList control that you can use to add images to the controls in a Windows form. These include various controls, such as TabControl, Button, ToolBar, TreeView control, and so on. An ImageList control is a collection of images. You can add images to the ImageList control by using the Images property.
However, to associate an ImageList control to a Windows Forms control, you can change the ImageList property of the Windows Forms control. The ImageList control is present in the Windows Forms toolbox, and to add the control to the form, you must drag the control to the form.
To add an ImageList control to the Creative Learning form, perform the following steps:
1.Drag an ImageList control from the Windows Forms toolbox to the form.
PROJECT CASE STUDY AND DESIGN |
Chapter 15 |
|
341 |
|
|
||||
|
|
|
|
|
An ImageList control with the name ImageList1 is added to the component tray. Figure 15-5 shows the ImageList control added to the component tray of the Creative Learning form.
FIGURE 15-5 The ImageList control added to the component tray of the Creative Learning form
Until now, the ImageList control does not contain any image. To add images to the ImageList control, you need to change the Images property of the ImageList control. When you add images to the ImageList control, the images are added to a Collection object of the control. To add images to a ImageList control in Visual Studio .NET, perform the following steps:
2.Click on the ellipsis button of the Images property. The Image Collection Editor dialog box is displayed.
3.Click on the Add button to add an image to the Members: textbox.
You can browse for the image to add it to the ImageList control. The image that you add is included in the System.Drawing namespace. The index value of the first image that is added is 0. As you add more images to the ImageList control, the index value increases. However, in the case of Creative Learning form, you will add only one image.
4.Click on the OK button to close the Image Collection Editor dialog box.
Figure 15-6 shows the Bitmap image added to the Image Collection Editor dialog box.
342 Project 3 CREATING A CREATIVE LEARNING PROJECT
FIGURE 15-6 The Bitmap image added to the Image Collection Editor dialog box
To add the image in the ImageList control to the TabControl control, perform the following steps:
5.Click on the drop-down button of the ImageList property of the TabControl control.
6.From the drop-down list, select the imageList1 option. imageList1 is associated with the TabControl control.
However, the Bitmap image is not presently visible on the tabbed pages. To display the image on the tabbed pages, you need to modify the properties of the tabbed pages on the TabPage Collection Editor page.
7.Click on the ellipsis button of the TabPages property of the tab control to display the properties of the tabbed pages.
The tabSource tabbed page is selected by default.
8.Click on the drop-down button of the ImageIndex property.
9.From the drop-down list, select the 0 option.
10.Repeat Steps 8 and 9 to add an image to the tabDest tabbed page. The images get added to the tabbed pages.
PROJECT CASE STUDY AND DESIGN |
Chapter 15 |
343 |
|
|
|
|
|
TIP
You can add the same image to all tabbed pages or different images to different tabbed pages in a tab control.
Having created the tabbed pages in the tab control, you can add label controls and text boxes to be displayed on the tabbed pages.
Adding Controls to Tabbed Pages
The tab control that you created contains two tabbed pages, Source Options and Destination Options. You can first add controls to the Source Options page.
The Source Options page consists of a check box control, two label controls, and two text box controls. You can add these controls to the tabSource tabbed page by dragging the controls from the Windows Forms toolbox. Then, change the following properties of the controls.
Label1
Name: label1
Text: Source Directory
Label2
Name: label3
Text: After processing, move source file to:
TextBox1
Name: txtSource
TextBox2
Name: txtProcessedFile
344 Project 3 CREATING A CREATIVE LEARNING PROJECT
CheckBox
Name: optGenerateLog
Text: Generate event log for bad file format
After adding controls to the tabSource tabbed page, the page looks as shown in Figure 15-7.
FIGURE 15-7 The tabSource page with the cont rols added
Similarly, you can add controls to the tabDest page. The tabDest page contains a label, a text box, a list box, a group box, and two button controls. Change the following properties of the controls after adding them to the tabbed page.
Label
Name: label2
Text: Destination Directory
TextBox
Name: txtDest
ListBox
Name: lstEvents