This document outlines several projects related to developing a library management system. Project 2 focuses on creating a Windows Forms front-end application for library functions like adding members and checking books in/out. Project 3 develops the data access layer and SQL stored procedures to replace those provided for Project 1. This demonstrates using ADO.NET and T-SQL to access a SQL Server database.
5. SetFocus Project #5 – Library Phase 4Page 23SetFocus Project #1 – .NET Framework<br />Objective<br />Build parts of the business tier for a retail company, consisting of two assemblies; Foundation and AppTypes.<br />Summary<br />This project demonstrates fundamental .NET skills and interaction between a n‐tiered application.<br />A list of C# / .NET skills used in this project:<br />• Delegates, events• Custom exception/attribute classes<br />• Custom EventArgs classes• Event logger and collection classes<br />• Generic Collections• Custom Serializations<br />• Binary & SOAP Formatters• Abstract classes & interfaces<br />• Enumerations• Properties<br />• Custom Enumerators Implementation<br />of ISerializable, IComparer, IComparable <br />& IList<T> interfaces<br />Foundation Assembly<br />This assembly contains the foundation interfaces and base classes used throughout the project.<br />SetFocus Project #1 – .NET Framework<br />AppTypes Assembly<br />This assembly contains various entity, collection, and exception classes used by the business.<br />SetFocus Project #2 – Library Phase 1<br />Objective<br />Create a Windows Forms‐based front‐end application that will provide a librarian with a visual interface through which librarian functions are performed. Required functionality included adding new members (adult and juvenile) and checking books in and out.<br />Summary<br />This project demonstrates the use of .NET windows form development techniques. Some of the techniques used include:<br />• User input validation and feedback using error providers<br />• Data binding to a gridview control and manipulation of the control<br />• Incorporate n‐tier architecture for scalability<br />• Create a user interface that is intuitive and requires minimal training<br />• Effective error and exception handling.<br />• Use of regular expressions for input validation.<br />DescriptionTo make the interface as intuitive as possible, all functions were accessed through the menu.The code behind the user interface (HU.LibraryWinClient) handled all the input validations, screen changes, and contained the logic to perform each operation.The Business Layer (HU.LibraryBusiness) provided 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 2008. Access to the database occurred 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 are needed to how data is accessed, the front‐end does not need to be modified, providing for scalability.<br />SetFocus Project #2 – Library Phase 1<br />BusinessLayer source code<br />using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.Text;<br />using HU.LibraryEntities;<br />using HU.LibraryDataAccess;<br /> <br />namespace HU.LibraryBusiness<br />{<br /> public class BusinessLayer<br /> {<br /> public BusinessLayer()<br /> {<br /> <br /> }<br /> <br /> public Member GetMemberInformation(short memberId)<br /> {<br /> // Create a library data access object<br /> HU.LibraryDataAccess.DataAccess lda = new HU.LibraryDataAccess.DataAccess();<br /> // Call the GetMember() method and pass in a member id<br /> Member myMember = lda.GetMember(memberId);<br /> // return the retrieved member<br /> return myMember;<br /> }<br /> <br /> public Item GetItemInformation(Int32 isbn,Int16 copyNumber)<br /> {<br /> // Create a library data access object<br /> HU.LibraryDataAccess.DataAccess lda = new HU.LibraryDataAccess.DataAccess();<br /> // Call the GetItem() method and pass in a isbn and Copy number<br /> Item myItem = lda.GetItem(isbn,copyNumber);<br /> // return the retrieved item<br /> return myItem;<br /> }<br /> <br /> public short GetLastCopyNumner(Int32 isbn)<br /> {<br /> // Create a library data access object<br /> HU.LibraryDataAccess.DataAccess lda = new HU.LibraryDataAccess.DataAccess();<br /> // Call the GetLastCopy() method and pass in a isbn<br /> short lastCopyNumner = lda.GetLastCopy(isbn);<br /> // return the retrieved item<br /> return lastCopyNumner;<br /> }<br /> <br /> public HU.LibraryEntities.ItemsDataSet GetOutstandingLoans(short memberId)<br /> {<br /> // Create a library data access object<br /> HU.LibraryDataAccess.DataAccess lda=new HU.LibraryDataAccess.DataAccess();<br /> // Call the GetIItems() method and pass in a member id<br /> HU.LibraryEntities.ItemsDataSet myItemsDataSet = lda.GetItems(memberId);<br /> return myItemsDataSet;<br /> }<br /> <br /> public void AddAdultMember(AdultMember member)<br /> {<br /> // Create a library data access object<br /> HU.LibraryDataAccess.DataAccess lda = new HU.LibraryDataAccess.DataAccess();<br /> // Call the AddMember() method and pass in an Adult member<br /> lda.AddMember(member);<br /> }<br /> <br /> public void AddJuvenileMember(JuvenileMember member)<br /> {<br /> // Create a library data access object<br /> HU.LibraryDataAccess.DataAccess lda = new HU.LibraryDataAccess.DataAccess();<br /> // Call the AddMember() method and pass in an Juvenile member<br /> lda.AddMember(member);<br /> }<br /> <br /> public void AddItemNumber(Item item)<br /> {<br /> // Create a library data access object<br /> HU.LibraryDataAccess.DataAccess lda = new HU.LibraryDataAccess.DataAccess();<br /> // Call the AddItem() method and pass in isbn<br /> lda.AddItem(item);<br /> }<br /> <br /> public void CheckOut(string memberNumberText, string isbnText, string copyNumberText)<br /> {<br /> // Create a library data access object<br /> HU.LibraryDataAccess.DataAccess lda = new HU.LibraryDataAccess.DataAccess();<br /> // Call the CheckOutItem method and pass in memberId,isbn,copyNumber<br /> short memberNumber = short.Parse(memberNumberText);<br /> Int32 isbn = Int32.Parse(isbnText);<br /> short copyNumber = short.Parse(copyNumberText);<br /> lda.CheckOutItem(memberNumber, isbn, copyNumber);<br /> }<br /> <br /> public void CheckIn(string isbnText, string copyNumberText)<br /> {<br /> // Create a library data access object<br /> HU.LibraryDataAccess.DataAccess lda = new HU.LibraryDataAccess.DataAccess();<br /> // Call the CheckInItem method and pass in isbn,copyNumber<br /> Int32 isbn = Int32.Parse(isbnText);<br /> short copyNumber = short.Parse(copyNumberText);<br /> lda.CheckInItem(isbn, copyNumber);<br /> }<br /> <br /> }<br />}<br /> <br />SetFocus Project #2 – Library Phase 1<br />Functionality Details<br />Add Adult – First and Last name, Street, City, State, and Zip Code are mandatory. Middle Initial and phone number are optional.<br />Add Juvenile – First and Last name, Birth Date, and Sponsoring Adult Member ID are required.<br />Middle Initial is an optional field.<br />Rules implemented while adding and displaying a member:<br />• The first and last name fields could only contain 15 alphabetic characters. The first letter was<br />required to be uppercase and the remaining characters must be lowercase.<br />• The middle initial, while optional, was required to be a single uppercase letter.<br />• The Street and City fields could be no more than 15 characters.<br />• The State field had to be two uppercase letters. The dropdown was populated from a XML file.<br />• The Zip Code had to be a ##### or #####-#### where # is a number (0-9).<br />• The phone number had to be in the (###)###-#### format when supplied.<br />• Birth Date had to be a valid date falling within the 18 year period ending on the current date.<br />• Sponsoring Adult Member ID had to reference a valid adult member already in the database.<br />• Each member could only have 4 books checked out at a time. Checking out a book also required <br />that the member’s expiration date be in the future.<br />• If a book was to be checked out, but the database indicated that it was already on loan, the<br />librarian was prompted if they wanted to check the book in first.<br />• All functions like check in book, check out book, and canceling the addition of a new member<br />provided a method for the librarian to cancel the operation.<br />SetFocus Project #2 – Library Phase 1<br />Screenshots:<br />Main Menu<br /> <br />Member Information<br />SetFocus Project #2 – Library Phase 1<br />Screenshots ( continued ):<br />Check Out<br />Check In<br />SetFocus Project #3 – Library Phase 2<br />Objective<br />Library Phase 1 created the UI layer for a library management system. This project created the<br />Data Access layer and SQL Server Stored Procedures for the library application to replace the ones provided for Phase 1. In addition to Phase 1’s functionality, Phase 2 added “Add Item” menu to add new books.<br />Summary<br />This project demonstrates the use of ADO.NET and Transact‐SQL to access a SQL Server 2008 database. Some of the techniques used include:<br />• Create and implement the Entities classes used in the library project<br />• Data validation in SQL<br />• Stored procedures in Transact‐SQL (T‐SQL) on SQL Server 2008<br />• Implementing error handling in SQL<br />• Accessing stored procedures through System.Data.SqlClient<br />• Retrieve and process result sets returned from stored procedures<br />• Process errors raised by T‐SQL in ADO.NET <br />• Write a T‐SQL script to test Stored Procedures for functionality<br />• Create and utilize strongly typed datasets based on stored procedures.<br />DescriptionThe goal of this project was to recreate the DLLs provided during Phase 1.HU.LibraryEntities contained 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 HU.LibraryDataAccess project provided the layer between theBusiness layer and the database. The UI (user interface) layer made requests to the LibraryBusiness layer, which in turn made 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 was stored at the project level, which means that it only needs changed ONCE.As long as the DataAccess layer returns the expected objects, theBusiness and UI layers do NOT need modifying. These layers were only modified was to add functionality and change from the SetFocus provided DLLs from phase 1. This provides for scalability and flexibility on the database server.<br />SetFocus Project #3 – Library Phase 2<br />This diagram shows the tables and their relationships in the Library database used in this project.<br />SetFocus Project #3 – Library Phase 2<br />Stored ProceduresSeveral stored procedures were created during this phase of the project. The majority were to duplicate the results from Phase 1.The dbo.AddItem procedure supports the additional functionality added during Phase 2.Each stored procedure contained the same validation on data as the other layers of the project.The GetMemberByISBNCopy stored procedure called the GetMemberByMemberID procedure to return the member records to the Data Access layer. This simplifies code modification by requiring change to a single stored procedure and a single Data Access method to change the data.<br />As part of Phase 2, to test the stored procedures T-SQL scripts was created. The scripts include code for passing and failure of procedures. <br />Each stored procedure attempted to make the select statements returning information to the data access layer as efficient and compact as possible. The AddAdult stored procedure is below.<br />USE [library]<br />GO<br /> <br />-- ==================================================================<br />-- Author: Harmik Uchian<br />-- Create date: 01/21/2010<br />-- Description: Adds a row in the Member and Adult<br />-- ==================================================================<br />-- Errors raised:<br />--<br />-- Message Severity State<br />--'Last Name is missing',11,1<br />--'Name is missing',11,2<br />--'Street is missing',11,3<br />--'City is missing',11,4<br />--'State is missing',11,5<br />--'Zip is missing',11,6<br />--'Last Name must contain 1 - 15 chracters',11,7 <br />--'First Name must contain 1 - 15 chracters',11,8 <br />--'Middle Initial must contain 1 chracter',11,9 <br />--'Street must contain 1 - 15 chracters',11,10 <br />--'City must contain 1 - 15 chracters',11,11<br />--'State must contain 1 - 15 chracters',11,12<br />--'Zip Code must contain 5 - 10 chracters',11,13 <br />--'Telephone must contain less than 13 chracters',11,14 <br />-- ==================================================================<br />SetFocus Project #3 – Library Phase 2<br />AddAdult stored procedure ( continued )<br /> <br />CREATE proc [dbo].[AddAdult]<br />-- ==================================================================<br />-- Parameters:<br />-- Name Type<br />@lastname varchar(15) =null,<br />@firstname varchar(15) =null,<br />@middleinitial char(1) =null,<br />@street varchar(15) =null,<br />@city varchar(15) =null,<br />@state char(2) =null,<br />@zip char(10) =null,<br />@phone_no char(13) =null,<br />@expiration_date datetime =null,<br />-- ==================================================================<br />--Output variables<br />@member_no smallint output<br /> <br />As<br />-- ==================================================================<br />-- validate params<br />If @lastname is null<br /> BEGIN<br /> RAISERROR ('Last Name is missing',11, 1)<br /> return -1<br /> END<br />If @firstname is null<br /> BEGIN<br /> RAISERROR ('First Name is missing',11, 2)<br /> return -1<br /> END<br />If @street is null<br /> BEGIN<br /> RAISERROR ('Street is missing',11, 3)<br /> return -1 <br /> END<br />If @city is null<br /> BEGIN<br /> RAISERROR ('City is missing',11, 4)<br /> return -1<br /> END<br />If @state is null<br /> BEGIN<br /> RAISERROR ('State is missing',11, 5)<br /> return -1<br /> END<br />If @zip is null<br /> BEGIN<br /> RAISERROR ('Zip is missing',11, 6)<br /> return -1<br /> END<br />-- additional validation - Check for empty string or zero value<br />IF LEN(@lastname) > 15 OR LEN (@lastname) < 1<br /> BEGIN<br /> RAISERROR ('Last Name must contain 1 - 15 chracters',11,7) <br /> RETURN -1<br /> END<br />SetFocus Project #3 – Library Phase 2<br />AddAdult stored procedure ( continued )<br />IF LEN(@firstname) > 15 OR LEN (@firstname) < 1<br /> BEGIN<br /> RAISERROR ('First Name must contain 1 - 15 chracters',11,8) <br /> RETURN -1<br /> END<br />IF LEN(@middleinitial) > 1 <br /> BEGIN<br /> RAISERROR ('Middle Initial must contain 1 chracter',11,9) <br /> RETURN -1<br /> END<br />IF LEN(@street) > 15 OR LEN (@street) < 1<br /> BEGIN<br /> RAISERROR ('Street must contain 1 - 15 chracters',11,10) <br /> RETURN -1<br /> END <br />IF LEN(@city) > 15 OR LEN (@city) < 1<br /> BEGIN<br /> RAISERROR ('City must contain 1 - 15 chracters',11,11) <br /> RETURN -1<br /> END <br />IF LEN(@state) > 2 OR LEN (@state) < 2<br /> BEGIN<br /> RAISERROR ('State must contain 2 chracters',11,12) <br /> RETURN -1<br /> END <br />IF LEN(@zip) <> 10 and LEN (@zip) <> 5<br /> BEGIN<br /> RAISERROR ('Zip Code must contain 5 or 10 chracters',11,13) <br /> RETURN -1<br /> END <br />IF LEN(@phone_no) > 13 <br /> BEGIN<br /> RAISERROR ('Telephone must contain less than 13 chracters',11,14) <br /> RETURN -1<br /> END <br />-- do the work<br />-- Calculate the expiration date one year from today<br />set @expiration_date =dateadd(year,1,getdate())<br />BEGIN TRY<br />BEGIN TRANSACTION<br />-- Insert into Member Table first<br />INSERT INTO [library].[dbo].[member]<br /> ([lastname]<br /> ,[firstname]<br /> ,[middleinitial])<br /> VALUES<br /> (@lastname<br /> ,@firstname<br /> ,@middleinitial)<br />-- Get new created MemberID<br />SET @member_no=SCOPE_IDENTITY() <br />SetFocus Project #3 – Library Phase 2<br />AddAdult stored procedure ( continued )<br />-- Insert into Adult Table <br />INSERT INTO [library].[dbo].[adult]<br /> ([member_no]<br /> ,[street]<br /> ,[city]<br /> ,[state]<br /> ,[zip]<br /> ,[phone_no]<br /> ,[expr_date])<br /> VALUES<br /> (@member_no<br /> ,@street<br /> ,@city<br /> ,@state<br /> ,@zip<br /> ,@phone_no<br /> ,@expiration_date)<br /> <br />print 'suceess' <br />COMMIT TRANSACTION <br />return 0 <br />END TRY<br />BEGIN CATCH<br /> if @@TRANCOUNT >0 ROLLBACK TRANSACTION<br /> --local vars<br /> DECLARE @ErrorMessage NVARCHAR(4000);<br /> DECLARE @ErrorSeverity INT;<br /> DECLARE @ErrorState INT;<br /> --populate vars <br /> SELECT @ErrorMessage = ERROR_MESSAGE(), <br /> @ErrorSeverity = ERROR_SEVERITY(), <br /> @ErrorState = ERROR_STATE();<br /> -- rethrow goes to front end c#<br /> RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState);<br /> RETURN -1<br />END CATCH<br />GO<br /> <br />SetFocus Project #3 – Library Phase 2<br />CheckIn.cs C# source code <br />using System;<br />using System.Collections.Generic;<br />using System.ComponentModel;<br />using System.Data;<br />using System.Drawing;<br />using System.Linq;<br />using System.Text;<br />using System.Windows.Forms;<br />using HU.LibraryEntities;<br />using HU.LibraryBusiness;<br /> <br />namespace HU.LibraryWinClient<br />{<br /> /// <summary><br /> /// Check In form is used to check in items<br /> /// </summary><br /> public partial class CheckIn : Form<br /> {<br /> private BusinessLayer bl;<br /> private int isbn;<br /> short copyNumber; <br /> <br /> public CheckIn()<br /> {<br /> InitializeComponent();<br /> }<br /> <br /> private void isbnMaskedTextBox_Validated(object sender, EventArgs e)<br /> {<br /> control_Validated(sender, e);<br /> }<br /> <br /> private void isbnMaskedTextBox_Validating(object sender, CancelEventArgs e)<br /> {<br /> if (isbnMaskedTextBox.Text.Length == 0)<br /> {<br /> e.Cancel = true;<br /> errorProvider.SetError(isbnMaskedTextBox, quot;
ISBN can not be empty.quot;
);<br /> }<br /> else<br /> {<br /> //Convert Copy Number text box to short<br /> bool validInt = Int32.TryParse(isbnMaskedTextBox.Text, out isbn);<br /> if (isbn > 2147483647 || isbn == 0 || !validInt)<br /> {<br /> e.Cancel = true;<br /> errorProvider.SetError(isbnMaskedTextBox, quot;
ISBN should be an Integer between 1 and 2147483647.quot;
);<br /> }<br /> else<br /> {<br /> //Reformat entered digits to a valid Int without spaces <br /> isbnMaskedTextBox.Text = isbn.ToString();<br /> }<br /> }<br /> }<br /> <br /> private void copyNumberMaskedTextBox_Validating(object sender, CancelEventArgs e)<br /> {<br />SetFocus Project #3 – Library Phase 2<br />CheckIn.cs C# source code ( continued )<br /> if (copyNumberMaskedTextBox.Text.Length == 0)<br /> {<br /> e.Cancel = true;<br /> errorProvider.SetError(copyNumberMaskedTextBox, quot;
Copy Number can not be empty.quot;
);<br /> }<br /> else<br /> { //Convert Copy Number text box to short<br /> bool validShort = short.TryParse(copyNumberMaskedTextBox.Text, out copyNumber);<br /> if (copyNumber > 32767 || copyNumber == 0 || !validShort)<br /> {<br /> e.Cancel = true;<br /> errorProvider.SetError(copyNumberMaskedTextBox, quot;
Copy Number should be an Integer between 1 and 32767.quot;
);<br /> }<br /> else<br /> { //Reformat entered digits to a valid short without spaces <br /> copyNumberMaskedTextBox.Text = copyNumber.ToString();<br /> }<br /> }<br /> }<br /> <br /> private void copyNumberMaskedTextBox_Validated(object sender, EventArgs e)<br /> {<br /> control_Validated(sender, e);<br /> }<br /> <br /> private void control_Validated(object sender, EventArgs e)<br /> {<br /> Control ctrl = (Control)sender;<br /> errorProvider.SetError(ctrl, quot;
quot;
);<br /> }<br /> /// <summary><br /> /// Finds the book based on ISBN and Copy number<br /> /// </summary><br /> /// <param name=quot;
senderquot;
></param><br /> /// <param name=quot;
equot;
></param><br /> private void findItemButton_Click(object sender, EventArgs e)<br /> { //Make sure isbn and copy number are valid <br /> if (!this.ValidateChildren(ValidationConstraints.Visible | ValidationConstraints.Enabled))<br /> {<br /> return;<br /> }<br /> // Create a business object<br /> bl = new BusinessLayer();<br /> // Parse the values from the textbox<br /> copyNumber = short.Parse(copyNumberMaskedTextBox.Text);<br /> isbn = Int32.Parse(isbnMaskedTextBox.Text);<br /> try<br /> {<br /> // Call the GetItemInformation() method and pass in isbn and copy number<br /> Item myItem = bl.GetItemInformation(isbn, copyNumber);<br /> // Display the Information<br /> titleTextBox.Text = myItem.Title;<br /> autherTextBox.Text = myItem.Author;<br /> if (myItem.MemberNumber != 0)<br /> {<br />SetFocus Project #3 – Library Phase 2<br />CheckIn.cs C# source code ( continued )<br /> dueDateTextBox.Text = myItem.DueDate.ToString();<br /> checkoutDateTextBox.Text = myItem.CheckoutDate.ToString();<br /> checkoutMemberIDTextBox.Text = myItem.MemberNumber.ToString();<br /> checkInItemButton.Enabled = true;<br /> }<br /> else<br /> {<br /> checkInItemButton.Enabled = false;<br /> dueDateTextBox.Clear(); checkoutDateTextBox.Clear();<br /> checkoutMemberIDTextBox.Clear();<br /> }<br /> checkInItemButton.Focus();<br /> }<br /> catch (LibraryException le)<br /> {<br /> switch (le.LibraryErrorCode)<br /> {<br /> case ErrorCode.ItemNotFound:<br /> MessageBox.Show(le.Message, le.LibraryErrorCode.ToString());<br /> isbnMaskedTextBox.Focus();<br /> break;<br /> default:<br /> break;<br /> }<br /> }<br /> catch (Exception ex)<br /> {<br /> MessageBox.Show(ex.Message);<br /> }<br /> }<br /> <br /> private void cancelButton_Click(object sender, EventArgs e)<br /> {<br /> clearCheckInForm(true,true);<br /> }<br /> /// <summary><br /> /// Check i item<br /> /// </summary><br /> /// <param name=quot;
senderquot;
></param><br /> /// <param name=quot;
equot;
></param><br /> private void checkInItemButton_Click(object sender, EventArgs e)<br /> {<br /> if (checkoutMemberIDTextBox.Text==quot;
quot;
)<br /> {<br /> MessageBox.Show(quot;
This item is not on loanquot;
);<br /> return;<br /> }<br /> try<br /> {<br /> bl.CheckIn(isbnMaskedTextBox.Text, copyNumberMaskedTextBox.Text);<br /> cancelButton.PerformClick();<br /> isbnMaskedTextBox.Focus();<br /> }<br /> catch (LibraryException le)<br /> {<br /> switch (le.LibraryErrorCode)<br /> {<br /> case ErrorCode.CheckInFailed:<br /> MessageBox.Show(quot;
Failed to check in specified item.quot;
);<br />SetFocus Project #3 – Library Phase 2<br />CheckIn.cs C# source code ( continued )<br /> break;<br /> case ErrorCode.GenericException:<br /> MessageBox.Show(le.Message,quot;
Generic Errorquot;
);<br /> break;<br /> case ErrorCode.ItemNotFound:<br /> MessageBox.Show(quot;
No Item with the specified ISBN and copy number was found.quot;
);<br /> break;<br /> case ErrorCode.ItemNotOnLoan:<br /> MessageBox.Show(le.Message,quot;
Item Not On Loanquot;
);<br /> cancelButton.PerformClick();<br /> break;<br /> default:<br /> break;<br /> }<br /> }<br /> catch (Exception ex)<br /> {<br /> MessageBox.Show(ex.Message);<br /> }<br /> }<br /> <br /> private void clearCheckInForm(bool clearISBN, bool clearCopyNumber)<br /> {<br /> if (clearISBN == true)<br /> {<br /> isbnMaskedTextBox.Clear();<br /> }<br /> errorProvider.SetError(isbnMaskedTextBox, quot;
quot;
);<br /> if (clearCopyNumber == true)<br /> {<br /> copyNumberMaskedTextBox.Clear();<br /> isbnMaskedTextBox.Focus();<br /> }<br /> errorProvider.SetError(copyNumberMaskedTextBox, quot;
quot;
);<br /> titleTextBox.Clear(); autherTextBox.Clear();<br /> dueDateTextBox.Clear(); checkoutDateTextBox.Clear();<br /> checkoutMemberIDTextBox.Clear();<br /> checkInItemButton.Enabled = false;<br /> }<br /> private void isbnMaskedTextBox_TextChanged(object sender, EventArgs e)<br /> {<br /> clearCheckInForm(false, true);<br /> }<br /> private void copyNumberMaskedTextBox_TextChanged(object sender, EventArgs e)<br /> {<br /> clearCheckInForm(false, false);<br /> }<br /> private void button1_Click(object sender, EventArgs e)<br /> {<br /> this.Close();<br /> }<br /> private void CheckIn_FormClosing(object sender, FormClosingEventArgs e)<br /> {<br /> e.Cancel = false;<br /> }<br /> }<br />}<br /> <br />SetFocus Project #4 – Library Phase 3<br />Objective<br />Library Phases 1 & 2 created the UI and Data Access layers for a library management system. This project converted the application into a web‐based application utilizing ASP.NET. In addition to<br />Phase 1 & 2’s functionality, Phase 3’s functionality included the ability to renew an expired adult’s membership one more year, the ability to convert a Juvenile member to an Adult member, and implement authentication and authorization to restrict access to the system.<br />Summary<br />This project demonstrates the use of ASP.NET. Some of the techniques used include:<br />• Create and use ASP.NET master pages to provide a consistent look across the website.<br />• Use of Membership Roles to restrict access to pages.<br />• Use of AJAX control to update only checked out items grid.<br />• Utilizing ViewState objects to save data between postbacks.<br />• Databinding through the ObjectDataSource control.<br />• Create a web interface that is intuitive and requires minimal training.<br />• Use various validation controls to validate input before postback.<br />DescriptionEach control had appropriate error validation controls attached such that validation would occur on the client. The code behind files for each page contained the server side validations.The user interface used the same business layer(HU.LibraryBusiness) as the previous phases of the project with additional functionality added to comprehend new requirements.The additional functionality of converting a Juvenile member to an Adult member and renewing an adult’s membership required the addition of several business Layer, Data Access Layer, and Stored Procedures.<br />SetFocus Project #4 – Library Phase 3<br />SetFocus Project #4 – Library Phase 3<br />SetFocus Project #5 – Library Phase 4<br />Objective<br />As the potential to acquire libraries and partnerships with other libraries increase, there is a need to take the library management system to the next level. To do this, Web services must be implemented. The Web service provides access to the business layer of the system. Because of the possibility of interfacing with systems of partner libraries, security must be implemented as well.<br />Summary<br />This project demonstrates the use of Web Service implementation techniques. Some of the techniques used include:<br />• Authentication using ASP.NET membership<br />• Authorization using ASP.NET roles<br />• Usage of Certificates for Security, Signing, and Encryption<br />• True N‐Tier structures<br />• Creation and interpretation of custom SoapException objects<br />DescriptionThe goal of this phase of development was to separate the UI from the business and data layers. Certain business layer methods were overloaded. I reworked these for the web service since web services do not support overloaded methods.The Add Member methods of the business layer simply modified the parameters passed in. Since web services are inherently one‐way, these were rewritten so the appropriate data was passed back to the UI layer. Another obstacle is that web services only throw SoapExceptions. I developed a method of encoding the type of error received from the business layer and encoding all appropriate information into a custom SoapException. <br />SetFocus Project #5 – Library Phase 4<br />Supported Web Service operations:<br />namespace HU.LibraryServiceLibrary<br />{<br /> [ServiceContract]<br /> public interface ILibraryService<br /> {<br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> Member GetMemberInformation(short memberId);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> Item GetItemInformation(Int32 isbn, Int16 copyNumber);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> short GetLastCopyNumner(Int32 isbn);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> ItemsDataSet GetOutstandingLoans(short memberId);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> short AddAdultMember(AdultMember member);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> short AddJuvenileMember(JuvenileMember member);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> void AddItemNumber(Item item);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> void CheckOut(string memberNumberText, string isbnText, string copyNumberText);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> void CheckIn(string isbnText, string copyNumberText);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> void Renew(string memberNumberText);<br /> <br /> [FaultContract(typeof(LibraryFault))]<br /> [OperationContract]<br /> void ConvertJuvenile(string memberNumberText);<br /> <br /> }<br />}<br /> <br />