Microsoft ASP.NET: Designing and Developing a Line-of-Business

Microsoft ASP.NET:
Designing and Developing a
Line-of-Business
Web Application
®
ASP.NET: Designing and
Developing a
Line-of-Business
Web Application
®
Microsoft Corporation
What We Will Cover





Definition of a line-of-business
application
Time Tracker as example of line-ofbusiness application
Design and technology choices
Development techniques
Intranet security design and
implementation
Session Prerequisites
Ability to read C# code
 Working knowledge of ASP.NET
 Familiarity with Microsoft® Visual
Studio® .NET

Level 200
So Why This Presentation?

Provide overview of best practices for
 Application
architecture
 Development
Outline key features of ASP.NET and the
.NET Framework
 Promote the ASP.NET Starter Kits at
www.asp.net

Demonstrations



Demonstrating Time Tracker
functionality
Examining Time Tracker code
Configuring the Time Tracker
application
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Mobile
Globalization
Security
Deployment
Introduction
The Time Tracker Line-of-Business
Web Application



What is a line-of-business application?
Time Tracker allows users to track
hours worked on a project
Allows managers to monitor project
status



Per user
Per project
Allows administrators to manage user
accounts and projects
Introduction
The Time Tracker Line-of-Business
Web Application


Illustrates best practices for intranet application
development
Serves as a template for other line-of-business
applications
Time Tracker Starter Kit
Demonstration 1
Time Tracker
Functionality
Registering as a New User
Creating New Users
Creating a Project
Creating Time Entries
Generating Reports
Logging on as a Less-Privileged User
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Mobile
Globalization
Security
Deployment
Design Goals
Decisions for an Intranet Application



Emphasis on maintenance, not
performance
Can utilize company’s existing user
information
Clean separation between logical tiers

Enables code reuse by other applications
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Security
Mobile
Globalization
Deployment
Application Architecture
Logical 3-tier Design
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Security
Mobile
Globalization
Deployment
Data Layer
Database Schema Requirements





User enters time for project and
category
User role authorization
Time entries require user project
membership
Project has one or more categories
Projects can have one project manager
Data Layer
Database Schema
Data Layer
Stored Procedures





Provide separation between database
and data access layer
Performance benefits
Added security
Can change with no effect to data layer
ListTimeEntries helps enforce role
authorization
Data Layer
Data Access



Uses Data Access Application Blocks
(DAAB)
Time Tracker uses ExecuteDataSet
method
Reduces custom code from six or more
lines to one or two
DataSet ds = SqlHelper.ExecuteDataSet(
ConfigurationSettings.AppSettings[
Web.Global.CfgKeyConnString],
CommandType.StoredProcedure,
“ListAllProjects”);
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Security
Mobile
Globalization
Deployment
Business Logic Layer
Application-specific Code

Implements how a company does
business
Business Logic Layer
Application-specific Code





Distinct from UI and database-specific
code
Enables code reuse
Functionality available to Web services
Implements security
Classes wrap information from data
access code
Business Logic Layer
TTUser Class

Each name represents an instance of
the TTUser class
Business Logic Layer
TTUser Class

Public properties that contain user info



UserID
Role string
Methods interact with data access layer
to:




Return lists of users
Return user information
Manage user information
Log users in
Business Logic Layer
Custom Collections




Derive from ArrayList
Require less memory than DataSet and
others
Provide cleaner separation between
data and presentation layers
Each collection a class-specific object
(UsersCollection maps to TTUser )
Business Logic Layer
Other Features

Static methods


Belong to the type itself
Object needn’t be instantiated
ProjectGrid.DataSource = Project.GetProjects();

Retrieving user info


Configure to Microsoft® Active Directory® or
Windows® NT® SAM need to retrieve user info from
account source
DirectoryHelper class


Retrieves user first and last name from account source
Easily extendable
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Security
Mobile
Globalization
Deployment
Presentation Layer
Introduction



Provides user interface
Communicates directly with business
logic
Separate from data access and
business layers

Can develop multiple UIs that use code
from other layers
Presentation Layer
User Controls

Banner and all tabs are user controls
Presentation Layer
DataGrid with Inline Editing


Define EditItemTemplate Column
Fill column with another ASP.NET server
control

<asp:TemplateColumn runat=“server” />
<EditItemTemplate>
<asp:DropDownList … />
</EditItemTemplate>
</asp:TemplateColumn>
Agenda












Introduction
Design Goals
Application Architecture
Data Layer
Business Logic Layer
Presentation Layer
Report Creation
GDI+ Chart Creation
Security
Mobile
Globalization
Deployment
Report Creation
Project Report




Created per selected project
Grouped by project, category,
consultant
Created with nested DataList controls
Data source assigned at run time

DataSource=‘<%#
ListCategory((int)DataBinder.Eval(Container.DataItem,
“ProjectID”)) %>’
Report Creation
Resource Report



Compiles time entry lists
Can contain one or more consultants
Created with a DataGrid nested in a
DataList control
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Security
Mobile
Globalization
Deployment
GDI+ Chart Creation
Chart Page



Separate page needed to render chart
Uses query strings to pass graph data
Returns Portable Network Graphics
(PNG) format
GDI+ Chart Creation
Chart Classes



ChartItem—a single data point
ChartItemsCollection—collection of data
points
Chart—abstract class



Defines Draw() method that must be
overridden
Limits data points for derived graphs
BarGraph—performs calculations for
graph generation
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Security
Mobile
Globalization
Deployment
Security
Authentication


Forms authentication on install
Easily modified to Microsoft® Windows®
authentication



Active Directory
NT Security Authorization Manager (SAM)
Make changes in Web.config
Security
Authorization and Techniques

Roles-based




Roles define:



Consultant
Project Manager
Administrator
page access
Tasks user allowed to perform
User input cleaned
Demos
Demonstration 2
Code Walkthrough
Review the Data Access Layer
Review the TTUser Class
Review the UsersCollection Class
Review the TTSecurity Class
Review CustomPrincipal and Global.asax.cs
Review the Chart class
Review TimeEntry.aspx.cs and associated files
Review Banner.ascx.cs class
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Security
Mobile
Globalization
Deployment
Mobile
Time Tracker Device Support

Users can view, add or update entries
Agenda












Introduction
Design Goals
Application Architecture
Data Layer
Business Logic Layer
Presentation Layer
Report Creation
GDI+ Chart Creation
Security
Mobile
Globalization
Deployment
Globalization
Using the CultureInfo Class


Culture settings changed per user’s
browser settings
Application_BeginRequest method in
Global.asax performs check
if (Request.UserLanguages != null)
Thread.CurrentThread.CurrentCulture
CultureInfo.CreateSpecificCulture(
Request.UserLanguages[0]);
else
Thread.CurrentThread.CurrentCulture =
new CultureInfo(“en-us”);
Thread.CurrentThread.CurrentUICulture =
Thread.CurrentThread.CurrentCulture;
Agenda












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Security
Mobile
Globalization
Deployment
Deployment
Web Farm Considerations



Encrypted cookie’s key must be same
Set machineKey in each Web.config file
to same value
For pages that require session state


Set load-balancing affinity, or
Session state must be stored in a state
server or Microsoft® SQL Server™
Demos
Demonstration 3
Configuring the Time Tracker
Application
Review the Web.Config File
Change the User’s Default Role
Change Forms Authentication to
Windows NT SAM Authentication
Session Summary












Introduction
Design goals
Application architecture
Data layer
Business logic layer
Presentation layer
Report creation
GDI+ chart creation
Security
Mobile
Globalization
Deployment
For More Information…

MSDN Web site at


msdn.microsoft.com
Official ASP.NET Web site at

www.asp.net
MSDN
Essential Resources for Developers
Subscription
Services
Library, OS, Professional, Enterprise,
Universal Delivered via CD-ROM, DVD, Web
Online
Information
MSDN Online, MSDN Flash, How-to
Resources, Download Center
Training and
Events
MSDN Webcasts, MSDN Online
Seminars, Tech·Ed, PDC, Developer Days
Print
Publications
MSDN Magazine
MSDN News
Membership
Programs
MSDN User Groups
How-to Resources
Simple, Step-by-Step Procedures













Embedded development How-to resources
General How-to resources
Integration How-to resources
JScript® .NET How-to resources
Microsoft .NET development How-to resources
Office development resources
Security How-to resources
Microsoft Visual Basic .NET How-to resources
Microsoft Visual C#® .NET How-to resources
Microsoft Visual Studio .NET How-to resources
Web development How-to resources (ASP, IIS, XML)
Web services How-to resources
Windows development How-to resources
http://msdn.microsoft.com/howto
MSDN Webcasts
Interactive, Live Online Events




Interactive, synchronous, live online
events
Discuss the hottest topics from Microsoft
Open and free for the general public
Take place every Tuesday
http://www.microsoft.com/usa/webcasts
MSDN Subscriptions
The Way to Get Visual Studio .NET
Visual Studio .NET
MSDN Subscriptions
MSDN Universal
$2799 new
$2299 renewal/upgrade
Enterprise Developer
• Enterprise lifecycle tools
• Team development support
• Windows Server 2003 and
SQL Server™
MSDN Enterprise
$2199 new
$1599 renewal/upgrade
Professional
• Tools to build applications
and XML Web services for
Windows and the Web
MSDN Professional
$1199 new
$899 renewal/upgrade
NEW
Enterprise Architect
• Software and data modeling
• Enterprise templates
• Architectural guidance
Where Can I Get MSDN?





Visit MSDN Online at
msdn.microsoft.com
Register for the MSDN Flash e-mail
newsletter at
msdn.microsoft.com/flash
Become an MSDN CD subscriber at
msdn.microsoft.com/subscriptions
MSDN online seminars
msdn.microsoft.com/training/seminars
Attend more MSDN events
Microsoft Press®
Essential Resources for Developers
Microsoft Visual Studio .NET is here!
This is your chance to start building the next big
thing. Develop your .NET skills, increase your
productivity with .NET books from Microsoft Press
www.microsoft.com/mspress
Become a Microsoft Certified
Solution Developer

What is MCSD?


How do I attain MCSD certification?


Premium certification for professionals who design
and develop custom business solutions
Certification requires passing four exams to prove
competency with Microsoft solution architecture,
desktop applications, distributed application
development, and development tools
Where do I get more information?

For more information about certification
requirements, exams, and training options,
visit www.microsoft.com/mcp
© 2003 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Microsoft, MSDN, Visual Studio, Windows, Visual Basic, Active Directory, Microsoft Press, JScript, and Visual C# are either registered
trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and
products mentioned herein may be the trademarks of their respective owners.