This document summarizes a library management system project completed in two phases. Phase 1 involved building a Windows Forms frontend to support basic library functions like adding members and checking items in/out. Phase 2 focused on developing the database backend with stored procedures and a new data access layer. Key aspects included checking items in/out transactions, displaying overdue items with LINQ, and allowing additional functions like adding new items.
2. The application must validate user input to make sure data is entered for valid fields and all input meets business rules.
3. Items already checked-out cannot be checked-out by someone else until they have been checked back in.
4.
5. Find the Item the member wishes to check-out. The librarian enters the ISBN & Copy Number of the Item the member wishes to borrow, then clicks on the “Search” button next to the Copy No. field.
6.
7. Convert a juvenile member to an adult member if the date is after their 18th birthday.
11. Use ADO.NET objects to call the stored procedures & read the data returned into the entity objects.
12.
13.
14. A method in the Data Access Layer that returned the ItemOnLoanContext object created by the .dbml file.
15. A method in the Business Layer that performed a Linq query against the ItemOnLoadContext returned by the DataAccessLayer & returned the results of that query.
18. Flag adults whose memberships have expired when looking them up and give the librarian the option to renew their memberships.
19. Detect when a juvenile member’s 18th birthday has passed and automatically promote them into adult members. The librarian must be notified when this promotion is done.
22. The Member look-up page had to use an AJAX UpdatePanel and an Update Progress control. The user has to be able to select books that the member has checked-out and check them in from the Member Look-up page. The Update Progress control must be displayed as the check-ins are done & the page must refresh showing all Items the member still has on loan.
37. Code all error handling in the WCF Service Library so it passed strongly typed FaultException objects to the client when an unrecoverable error occurred.
38. Host the WCF Service Library in a WCF Web Host website.
45. The definition of the service behavior (in the <service> element). This specifies the fully-qualified name of the class that implements the service, and is the linkage between the Service.svc file and the configuration information.
46. The definition of the endpoint for the service, which includes the service’s endpoint, binding and contract in the <endpoint> element.
47. Additional information about the security configuration is included in the <behaviors> element of the web configuration file. Things defined here include:
48. The type of service credentials to use, in this case user name credentials, and the name of the provider class to use to verify the user, in this case AspNetSqlmembershipProvider.
49. The type of service authorization to use, in the <serviceAuthorizaton> tag. The tag has attributes that specify Principal Permission mode (UseAspNetRoles) and the role provider class name (AspNetSqlRoleProvider).
50.
51. Allow the user to create a new session of an existing course of study
56. File: The variable contains the name of an XML file in the XML folder
57.
58. For variables known to contain at least one paragraph of text (as opposed to a couple of words), a multi-line Text Box is displayed.
59. For variables of type Cost, a plain Text Box is used, but the value is formatted properly when the Text Changed event is fired.
60. For variables of type File, a Drop Down List is displayed. The choices provided are a list of all of the XML files in the XML folder, minus the configuration file.
61. For all other variables, a plain, single line, default sized Text Box is displayed.Below is the control’s Bind method, which is where the logic described above is implemented.<br />/// <summary><br />/// The user calls this method to have it display <br />/// </summary><br />/// <param name=quot;
variablequot;
>The Variable object to associate with this <br />/// control.</param><br />/// The list of values to bind the DropDownList's DataSource to<br />public void Bind( Variable variable, List<string> contracts ) {<br /> // Hide all of the child controls<br /> ddlFileValue.Visible = txtDateValue.Visible = <br /> txtTextValue.Visible = false;<br /> // Does this variable's name contain the word quot;
Datequot;
in it?<br /> if ( variable.Name.ToLower().Contains( quot;
datequot;
) ) {<br /> // It does. Set the VariableType to Date<br /> VariableType = VariableTypes.Date;<br /> // Show the txtDateValue control<br /> txtDateValue.Visible = true;<br /> // The name doesn't have quot;
Datequot;
in it. Is it quot;
templatequot;
?<br /> } else if ( variable.Name.ToLower() == quot;
templatequot;
) {<br /> // It is. Set the VariableType to File<br /> VariableType = VariableTypes.File;<br /> // Show the ddlFileValue control<br /> ddlFileValue.Visible = true;<br /> } else {<br /> // It isn't template, either. Switch on the variable's Type<br /> switch ( variable.Type.ToLower() ) {<br /> case quot;
costquot;
:<br /> // Set the VariableType to Cost<br /> VariableType = VariableTypes.Cost;<br /> // Show the txtCostValue control<br /> txtTextValue.Visible = true;<br /> break;<br /> case quot;
filequot;
:<br /> // Set the VariableType to File<br /> VariableType = VariableTypes.File;<br /> // Show the ddlFileValue control<br /> ddlFileValue.Visible = true;<br /> break;<br /> default:<br /> // Set the VariableType to Text<br /> VariableType = VariableTypes.Text;<br /> // Does the variable's name contain quot;
paragraphquot;
?<br /> if ( variable.Name.ToLower().Contains( quot;
paragraphquot;
) ||<br /> variable.Name.ToLower() == quot;
classtimesquot;
) {<br /> // It does. Make the txtTextValue control multiline<br /> txtTextValue.TextMode = TextBoxMode.MultiLine;<br /> txtTextValue.Rows = 5;<br /> txtTextValue.Columns = 35;<br /> }<br /> // Show the txtTextValue control<br /> txtTextValue.Visible = true;<br /> break;<br /> }<br /> }<br /> // Save the VariableType in the ViewState<br /> ViewState[ quot;
VariableTypequot;
] = VariableType;<br /> // Is the list of contracts null or empty?<br /> if ( contracts != null && contracts.Count > 0 ) {<br /> // It is not. Set it up<br /> FileList = contracts;<br /> }<br /> // Now set the proper child control's Text or Value property<br /> Text = variable.Value;<br />}<br />Updating a Contract<br />One of the optional requirements we had was to provide a means for the users to update a contract. The issue is that the contracts are stored as XML files and are translated into PDF files by a custom program, called the Generator. The Generator is an ASP.NET application that is accessible over the web & is used by students to print a copy of the contract for the class they are going to take. They then sign & return the contract to SetFocus before the class starts.<br />We decided to implement this functionality by using an XML Stylesheet Transforms, or XSLTs. The page we designed to accomplish this task is shown below.<br />The user chooses one of the XML files in the XML folder from the drop down & clicks the “Download” button. At that time, the XML file is transformed into a Word 2007 format document and downloaded to the user’s PC. The user may then edit the document and make any changes required.<br />When the user is done editing the file, they return to the above page and click the “Browse” button. This displays a dialog showing all files & folders on their local hard drive. The user locates the file they have edited & select it. Next, the user clicks the “Upload” button. At that time, the file is uploaded back to the server & transformed back into XML.<br />Below is the code that transforms the original XML file into Word 2007 format.<br />public static string Transform( string XmlFile, string TransformXslt, <br /> string TemplateFile ) {<br /> // Is the XmlFileName parameter null or empty?<br /> if ( String.IsNullOrEmpty( XmlFile ) ) {<br /> // It is. Throw an ArgumentException<br /> throw new ArgumentException( <br /> quot;
Must specify the fully-qualified XML file to transformquot;
, <br /> quot;
XmlFilequot;
);<br /> }<br /> // Does the file specified by XmlFile really exist?<br /> FileInfo xmlFile = new FileInfo( XmlFile);<br /> if ( !xmlFile.Exists ) {<br /> // It does not. Throw a FileNotFoundException<br /> throw new FileNotFoundException( <br /> quot;
Cannot find the XmlFile at the specified pathquot;
, XmlFile );<br /> }<br /> // Is the TransformXslt parameter null or empty?<br /> if ( String.IsNullOrEmpty( TransformXslt ) ) {<br /> // It is. Throw an ArgumentException<br /> throw new ArgumentException( <br /> quot;
Must specify a fully-qualified XML file for the transformquot;
,<br /> quot;
TransformXsltquot;
);<br /> }<br /> // Does the file specified by TransforXslt really exist?<br /> FileInfo transformXslt = new FileInfo( TransformXslt );<br /> if ( !transformXslt.Exists ) {<br /> // It does not. Throw a FileNotFoundException<br /> throw new FileNotFoundException( <br /> quot;
Cannot find the XSLT file at the specified pathquot;
, TransformXslt );<br /> }<br /> // Is the TemplateFile parameter null or empty?<br /> if ( String.IsNullOrEmpty( TemplateFile ) ) {<br /> // It is. Throw an ArgumentException<br /> throw new ArgumentException( <br /> quot;
Must specify a fully-qualified Word Template for the transformquot;
, <br /> quot;
TemplateFilequot;
);<br /> }<br /> // Does the file specified by TemplateFile really exist?<br /> FileInfo templateFile = new FileInfo( TemplateFile );<br /> if ( !templateFile.Exists ) {<br /> // It does not. Throw a FileNotFoundException<br /> throw new FileNotFoundException( <br /> quot;
Cannot find the Word template file at the specified pathquot;
, <br /> TemplateFile );<br /> }<br /> // Get a temporary file name to use for the output file<br /> string outputDocument = Path.GetTempFileName();<br /> outputDocument = Path.ChangeExtension( outputDocument, quot;
docxquot;
);<br /> <br /> // Create a writer for the output of the Xsl Transformation.<br /> StringWriter stringWriter = new StringWriter();<br /> XmlWriter xmlWriter = XmlWriter.Create( stringWriter );<br /> // Create the Xsl Transformation object.<br /> XslCompiledTransform transform = new XslCompiledTransform();<br /> transform.Load( TransformXslt );<br /> // Transform the xml data into Open XML 2.0 Wordprocessing format.<br /> transform.Transform( XmlFile, xmlWriter );<br /> // Create an Xml Document of the new content.<br /> XmlDocument newWordContent = new XmlDocument();<br /> newWordContent.LoadXml( stringWriter.ToString() );<br /> // Copy the Word 2007 template document to the output file.<br /> File.Copy( TemplateFile, outputDocument, true);<br /> // Use the Open XML SDK version 2.0 to open the output document in edit mode.<br /> using ( WordprocessingDocument output = <br />WordprocessingDocument.Open( outputDocument, true ) ) {<br /> // Using the body element within the new content XmlDocument, <br /> // create a new Open Xml Body object.<br /> Body updatedBodyContent = <br /> new Body( newWordContent.DocumentElement.InnerXml );<br /> // Replace the existing Document Body with the new content.<br /> output.MainDocumentPart.Document.Body = updatedBodyContent;<br /> // Save the updated output document.<br /> output.MainDocumentPart.Document.Save();<br /> }<br /> // Return the output file's name<br /> return outputDocument;<br />}<br />