mark jackson\'s portfoilo

17
Mark Jackson [email protected] Page 1 of 17 SetFocus .NET Framework Project Objective Build parts of the business tier for a retail company, consisting of two assemblies; Foundation and AppTypes. Summary This project demonstrates fundamental .NET skills and interaction between an n-tiered application. A list of C# / .NET skills used in this project: Delegates, events Abstract classes & interfaces Custom exception/attribute classes Enumerations Custom EventArgs classes Properties Event logger and collection classes Custom Enumerators Implementation of ISerializable, IComparer, IComparable, & IList<T> interfaces Generic Collections Custom Serializations Binary & SOAP Formatters Foundation Assembly This assembly contains the foundation interfaces and base classes used throughout the project.

Upload: markjackson

Post on 01-Jul-2015

269 views

Category:

Documents


0 download

DESCRIPTION

A portfolio of Mark Jackson\'s SetFocus projects.

TRANSCRIPT

Page 1: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 1 of 17

SetFocus .NET Framework Project

Objective Build parts of the business tier for a retail company, consisting of two assemblies;

Foundation and AppTypes.

Summary This project demonstrates fundamental .NET skills and interaction between an n-tiered

application. A list of C# / .NET skills used in this project:

• Delegates, events • Abstract classes & interfaces

• Custom exception/attribute classes • Enumerations

• Custom EventArgs classes • Properties

• Event logger and collection classes • Custom Enumerators Implementation of

ISerializable, IComparer, IComparable, &

IList<T> interfaces

• Generic Collections

• Custom Serializations

• Binary & SOAP Formatters

Foundation Assembly This assembly contains the foundation interfaces and base classes used throughout the

project.

Page 2: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 2 of 17

AppTypes Assembly This assembly contains various entity, collection, and exception classes used by the

business.

Page 3: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 3 of 17

SetFocus Library Phase 1 Project

Objective Create a Windows Forms-based front-end application that will provide a librarian with a

visual interface through which librarian functions are performed.

Requirements

• Design and develop a front end application that satisfies the four basic

functionalities: Add Adult Member, Add Juvenile Member, Check In a book, Check

Out a book.

• Develop code that is easily maintainable.

• Provide validation for all required fields.

• Provide adequate error handling.

• Produce a user interface that is intuitive, requiring minimal training for users while

minimizing resource utilization.

Summary This project demonstrates the use of .NET windows form development techniques. Some of

the techniques used include:

• User input validation and feedback using the ErrorProvider class.

• Data binding to a DataGridView control and manipulation of the control.

• Effective error and exception handling.

• Use of regular expressions for input validation.

• Use of a supplied XML file to populate the selection items in a ComboBox control.

• Inheritance from the TextBox control to perform user input validation.

• Use of Multiple Document Interface (MDI) forms.

Description Menus on the parent MDI form were used to access the Add Adult,

Add Juvenile, Check In, and Member Information child MDI forms.

The code behind the user interface (MJ.LibraryWinClient) handled

screen changes, and contained the logic to perform each operation.

The Business Layer (MJ.LibraryBusiness) provides the connection

between the UI and the library of data access functions. In this

project, all book information, member records, loan records, etc.

are all stored on SQL Server 2005. Access to the database occurs

through a Data Access Layer, which was provided as a

precompiled DLL for the project. The UI does not know how the

data is accessed or retrieved. If changes in data access are

necessary, the front end does not need to be modified, providing

for scalability.

Page 4: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 4 of 17

The MJ.LibraryContolLibrary code provides a means for validation and error handling. An

abstract class, ValidationTextBox, inherits from the TextBox control and contains an

abstract method to perform validation on the text the user entered in the text box. Other

classes, specific to the type of data entered, inherit from ValidationTextBox and override

the abstract method. Through polymorphism, each of these other classes performs the

appropriate input validation.

Display Adult Member:

Page 5: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 5 of 17

Add Juvenile Member:

Check Out Library Item:

Page 6: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 6 of 17

Check In Library Item:

Page 7: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 7 of 17

SetFocus Library Phase 2 Project

Objective Develop code to replace the Data Access and Library Entities assemblies supplied in the

Library Phase 1 project.

Requirements

• Develop Transact-SQL (T-SQL) Stored Procedures to access the library database to

perform all library functions.

• Generate T-SQL scripts to fully test the Stored Procedures.

• Develop code in ADO.NET to call the Stored Procedures for all library functions.

• Develop the code for all classes in the Library Entities assembly.

• Develop code that is easily maintainable.

• Provide adequate error handling.

• Use database-programming techniques that provide maximum programming

flexibility and control while minimizing resource utilization.

• Automatically convert the membership to adult when displaying information for a

juvenile member that has reached 18 years of age (optional).

• Highlight an overdue library item when display in the DataGridView control

(optional).

Summary This project demonstrates the use of ADO.NET and T-SQL to access a SQL Server 2005

database. Some of the techniques used include:

• Use of Microsoft SQL Server Management Studio to develop Stored Procedures and

test scripts.

• Data validation in SQL.

• Implementing error handling in SQL.

• Accessing Stored Procedures through the System.Data.SqlClient namespace.

• Retrieve and process result sets returned from Stored Procedures.

• Process errors raised by T-SQL in ADO.NET using error numbers and states.

• Use Microsoft Visual Studio 2005 to create and utilize strongly typed datasets based

on Stored Procedures.

• Change the appearance of data displayed in a DataGridView control.

Description The goal of this project was to recreate the DLLs provided for the Library Phase 1 project.

LibraryEntities contains the various classes and enumerations referenced by the entire

project. It contains the AdultMember, JuvenileMember, Member, Item, LibraryException

classes as well the ErrorCode enumeration. It also contains the strongly typed

ItemsDataSet dataset.

The LibraryDataAccess project provides the layer between the Business layer and the

database. The UI (user interface) layer makes requests to the LibraryBusiness layer, which

in turn makes the request of the Data Access layer. The Data Access layer executes the

appropriate SQL Server database Stored Procedures through ADO.NET code. The

connection string for the library database is stored at the project level.

Page 8: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 8 of 17

The DataAccess and Business layers were not modified except to implement the new

functionality.

The (partial) AddMember method for Juvenile Members in the Data Access Layer:

A T-SQL Stored Procedure for Adding a Juvenile Member: /****** Object: StoredProcedure [dbo].[AddJuvenileMember] Script Date: 06/28/2009 15:11:39 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[AddJuvenileMember] @FirstName varchar(15), -- The new member's first name @MiddleInitial char, -- The new member's middle initial @LastName varchar(15), -- The new member's last name @AdultMemberId smallint, -- The new member's parent's member ID @BirthDate datetime -- The new member's birthdate as -- Procedure to add a new juvenile member. -- Check parameters not allowed to be null.

Page 9: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 9 of 17

if @FirstName is null begin -- First name is invalid. raiserror('Invalid value for first name.', 14, 1) return 0 end if @LastName is null begin -- Last name is invalid. raiserror('Invalid value for last name.', 14, 1) return 0 end if @AdultMemberId is null or @AdultMemberId < 1 begin -- Adult member ID is invalid. raiserror('Invalid value for adult member ID.', 14, 2) return 0 end if @BirthDate is null or @BirthDate < dateadd(year, -18, getdate()) begin -- Birthdate is invalid. raiserror('Invalid value for birthdate.', 14, 3) return 0 end if not exists (select * from adult where member_no = @AdultMemberId) begin -- Adult member ID is invalid. raiserror('Adult member does not exist.', 14, 2) return 0 end -- Check if adult membership has expired. if (select expr_date from adult where member_no = @AdultMemberId) < getdate() begin -- Adult member ID is expired. raiserror('Adult member ID is expired.', 14, 4) return 0 end declare @MemberId smallint begin tran begin try -- Insert the new juvenile member into the member table. insert member values(@LastName, @FirstName, @MiddleInitial, null) end try begin catch -- Problem inserting row into member table. raiserror('Add juvenile member failed.', 14, 1) rollback tran return 0 end catch

Page 10: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 10 of 17

-- Save the member ID. set @MemberId = scope_identity() begin try -- Insert the new juvenile member into the juvenile table. insert juvenile values(@MemberId, @AdultMemberId, @BirthDate) end try begin catch -- Problem inserting row into adult table. raiserror('Add juvenile member failed.', 14, 1) rollback tran return 0 end catch commit tran return @MemberId GO

Page 11: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 11 of 17

SetFocus Library Phase 3 Project

Objective Create a web application that supports all the functionality required for Phase 1 and 2 of

the Library project.

Additional Requirements

• When an adult is displayed that has an expired membership, give the librarian the

option to renew it.

• Use hyperlinks to navigate between pages.

• The web application project must use Forms-based authentication and

authorization. Only members of the Librarian role must be able to access the web

application.

Summary This project demonstrates the use of ASP.NET. Some of the techniques used include:

• Create and use ASP.NET Master Pages to provide a consistent look across the

website.

• Use of Membership Roles to restrict access to pages.

• Utilizing ViewState and SessionState objects to save data between post backs.

• Create a web interface that is intuitive and requires minimal training.

• Use various validation controls to validate input before post back.

• Data binding to a GridView control and manipulation of the control.

Description The Library Business and Data Access layers as well as the Library Entities classes remain

unchanged, except to implement the new functionality.

Dialog boxes in the Windows form projects were replaced with a single web page, since the

layout of the page remained the same. Only the text explaining the user options changed.

The QueryString property of the HttpRequest was used to display the new member on the

Member Info page after the member was added. It was also used to display messages upon

entry to the Member Info page.

Page 12: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 12 of 17

The Log In Page:

Adding a new Library Item:

Page 13: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 13 of 17

The Member Information Page:

Page 14: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 14 of 17

The (partial) Page_Load Method for the Member Information Page:

Page 15: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 15 of 17

SetFocus Library Phase 4 Project

Objective Modify the Library Project to use Web Services.

Requirements

• Create a Web service that calls into either the business or data layer.

• Update the layers in the system to use the service as deemed appropriate.

• Make sure the Web service supports the Basic Profile and uses Document/Literal

formatting of the Soap messages.

• Customize formatting of XML for some of the business types.

• Employ WSE 3.0 security using Certificates. Signing, encryption and secure session

are required.

• Support previous project functionality.

Summary This project demonstrates the use of Web Service implementation techniques. Some of the

techniques used include:

• Customization of XML attributes

• Employment of WSE 3.0 security setting

• Usage of Certificates for Security, Signing, and Encryption

• True N-Tier structures

• Use of SoapException objects

Description The Business Layer was modified to call the Web Service, which called the Data Access

Layer.

The Library Entities classes were changed to control XML Serialization.

Since Basic Profile Web Services do not natively support overloaded operations, the

overloaded methods in the Data Access Layer had to be separated into methods with

different names in the Web Service.

Since pass by reference behavior is not available natively with Web services, the Data

Access Layer’s AddMember methods were changed. Previously the AddMember methods

stored the new member’s membership ID number in the Member object whose reference

was passed in as a parameter. The methods were changed to return the membership ID

number to the Web Service method. The Web Service method returned the value to the

Business Layer.

The custom LibraryExceptions are thrown in the Data Access Layer and caught in the web

methods. The web methods throw SoapExceptions to the Business Layer. The

InnerException property of the SoapException is set to a reference of the LibraryException.

The GetMember web methods return the base class Member. Because these web methods

can return a reference to either the derived AdultMember or JuvenileMember class objects,

XmlInclude attributes were used.

Page 16: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 16 of 17

The Web Methods of the Web Service:

Page 17: Mark Jackson\'s Portfoilo

Mark Jackson [email protected] Page 17 of 17

The GetItem and AddAdultMember WebMethods: