- •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
248 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
Table 11-2 Buttons in the Toolbar of the Windows Forms Viewer Control
(continued)
Buttons |
Description |
Go to Page |
A user can click on the Go to Page button to view a specified page. |
Close Current View |
A user can click on the Close Current View button to close the |
|
current view. This button is active only for Subreport or groups. |
Print Report
Refresh Report
Export Report
Toggle Group Tree
Zoom
Search Text
A user can click on the Print Report button to print the data in a
report. |
|
L |
|
|
|
|
|
A user can click on the Refresh Report button to refresh the data in |
|||
a report. |
|
Y |
|
|
M |
|
|
A user can click on the Export Report button to save the report as |
|||
A |
|
|
|
a Word documentF(.doc), an Acrobat file (.pdf), an Excel spread- |
|||
sheet (.xls), or a rich text format (.rtf) file. |
|||
T |
|
|
|
user can click on the Toggle Group Tree button to display or |
|||
hide the Field Explorer window. |
|||
EA user can click on the Zoom button to increase or decrease the |
zoom percentage of a report.The user can select the zoom percentage from the drop-down list.
A user can click on the Search Text button to find the specified data in a report.
The following section discusses creating a Windows Forms Viewer control to display a crystal report.
Creating the Windows Forms Viewer Control
As discussed earlier, a Windows Forms Viewer control is used to host and display a crystal report. Perform the following steps to create a Windows Forms Viewer control.
1.In the Solution Explorer window, right-click on the project name, Customer Maintenance Project.
Team-Fly®
CRYSTAL REPORTS |
Chapter 11 |
249 |
|
|
|
|
|
2.In the displayed list , point to Add and click on the Add New Item option.
The Add New Item dialog box is displayed.
3.In the Templates: pane, select the Windows Form option.
4.In the Name: text box, type the name of the form as ConsumableForm and click on the Open button.
Visual Studio .NET creates a new form for you.
From the Windows Forms toolbox, drag the CrystalReportViewer and Button controls to the form.
TIP
In the Windows Forms toolbox, a Windows Forms Viewer control is called CrystalReportViewer.
Resize the CrystalReportViewer control to occupy maximum area on the form. Figure 11-4 shows ConsumableForm with the Cr ystalReportViewer control.
FIGURE 11-4 ConsumableForm with the CrystalReportViewer control
250 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
As you can see, the CrystalReportViewer control is empty. To host and display the report in the CrystalReportViewer control, you need to associate the control with ConsumablesReport.rpt. To do so, perform the following steps:
1.Select the CrystalReportViewer control to make it active.
2.In the Properties window, change the value of the ReportSource property of the CrystalReportViewer control.
The ReportSource property enables you to associate the CrystalReportViewer control with the required crystal report.
3.Click on the down arrow button of the ReportSource property.
4.From the drop-down list, select the Browse option.
The Browse option enables you to browse for the location of the ConsumablesReport.rpt report.
After associating the report with the CrystalReportViewer control, you can test the report by clicking on the F5 key or by selecting the Start command on the Debug menu.
When you run the project and click on the Monthly Consumable Report radio button in the Reports form, the ConsumableForm form is displayed. Figure 11-5 shows the Reports form with the Monthly Consumable Report radio button.
FIGURE 11-5 Reports form
The ConsumableForm form now contains the Consumable Report that you have created. Figure 11-6 shows the Consumable Report as seen at run time.
CRYSTAL REPORTS |
Chapter 11 |
251 |
|
|
|
|
|
FIGURE 11-6 Consumable Report at run time
To enable a user to return to the Reports form after viewing the report, you can make the Exit button functional. To do so, add the following code to the Click event of the Exit button.
private void btnExit_Click(object sender, System.EventArgs e)
{
Reports newForm = new Reports(); newForm.Show();
this.Hide();
}
After creating the Monthly Consumable report, you can similarly create the Monthly Customer Visit, Monthly Balancing and Alignment, and Monthly Worker reports.
Creating the Monthly
Customer Visit Report
The Monthly Customer Visit report is created to track the number of visits of a customer in a particular month. The procedure for creating the Monthly Customer
252 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
Visit report is similar to the one you used to create the Monthly Consumable report. However, while creating the Monthly Customer Visit report, you need to make a few changes, such as changes in the table name, field names, Group By: field, and so on.
Similar to the Monthly Consumable report, you can use Standard Report Expert to create the Monthly Customer Visit report.However, if you want, you can select any other expert.The following list will discuss the changes that you need to make while creating the Monthly Customer Visit report.
1.In the Data tab of Standard Report Expert, select the tblCustomer and tblJobDetails tables to display data from both these tables. After clicking on the Next button, the Links tab is displayed.
The Links tab displays the link between the tblCustomer and tblJobDe-
tails tables. By default, the common field name, CarNo, is selected as the link. However, if required, you can clear the link by clicking on the Clear Links button and then create a new link by dragging the field name from one table to another. Figure 11-7 displays the Links tab of Standard Report Expert.
FIGURE 11-7 The Links tab of Standard Report Expert
CRYSTAL REPORTS |
Chapter 11 |
253 |
|
|
|
|
|
2. In the Fields tab, select the CarNo, Name, Address, and Make fields from the tblCustomer table. From the tblJobDetails table, select the JobDate option.
3.In the Group By: list, select the CarNo and then the JobDate fields.
4.In the Title: text box of the Style tab, type the title of the report as Customer Visit Report and select any style from the Style: list.
Figure 11-8 displays the Monthly Customer Visit report as created by the Crystal Report Gallery.
FIGURE 11-8 Monthly Customer Visit report in the design view
After creating the crystal report, you can create a new form, CustomerVisitForm, and include a CrystalReportViewer control to display the report. Figure 11-9 shows the Monthly Customer Visit report as seen at run time.
254 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
FIGURE 11-9 Monthly Customer Visit report at run time
Creating the Monthly Balancing
and Alignment Report
The Monthly Balancing and Alignment report is created to track the number of balancing and alignment jobs performed by a worker in a month. You can create the Monthly Balancing and Alignment report by using the Crystal Report Gallery as discussed in the previous sections. Figure 11-10 displays the report as created by the Cr ystal Report Gallery.
CRYSTAL REPORTS |
Chapter 11 |
255 |
|
|
|
|
|
FIGURE 11-10 Monthly Balancing and Alignment report in the design view
You can make changes to the layout of the Monthly Balancing and Alignment report in the design view. However, to display the report at run time, you need to create a new form, AlignmentForm, and then include a CrystalReportViewer control. Figure 11-11 shows the Monthly Balancing and Alignment report at run time.
FIGURE 11-11 Monthly Balancing and Alignment report at run time