brandon miller portfolio

20
Brandon Miller – Programming Portfolio Table of Contents Framework Project.........................................................2 Objective...............................................................2 Solution................................................................2 Library Project...........................................................6 Objective...............................................................6 Phase 1.................................................................6 Objective.............................................................6 Solution..............................................................6 Phase 2.................................................................8 Objective.............................................................8 Solution..............................................................8 Phase 3.................................................................9 Objective.............................................................9 Solution..............................................................9 Phase 4................................................................11 Objective............................................................11 Solution.............................................................11 XML Contract Parsing Project.............................................13 Objective..............................................................13 Solution...............................................................13

Upload: brandonmiller3

Post on 14-Jun-2015

536 views

Category:

Documents


4 download

DESCRIPTION

My Portfolio of the work I have completed.

TRANSCRIPT

Page 1: Brandon Miller Portfolio

Brandon Miller – Programming Portfolio

Table of ContentsFramework Project...................................................................................................................................................2

Objective.............................................................................................................................................................2

Solution...............................................................................................................................................................2

Library Project.........................................................................................................................................................6

Objective.............................................................................................................................................................6

Phase 1................................................................................................................................................................6

Objective.........................................................................................................................................................6

Solution...........................................................................................................................................................6

Phase 2................................................................................................................................................................8

Objective.........................................................................................................................................................8

Solution...........................................................................................................................................................8

Phase 3................................................................................................................................................................9

Objective.........................................................................................................................................................9

Solution...........................................................................................................................................................9

Phase 4...............................................................................................................................................................11

Objective.......................................................................................................................................................11

Solution.........................................................................................................................................................11

XML Contract Parsing Project...............................................................................................................................13

Objective...........................................................................................................................................................13

Solution.............................................................................................................................................................13

Page 2: Brandon Miller Portfolio

Framework Project

Objective

The goal of this project was to create a business tier for a retail company. All of the code was for creating class libraries containing information related to products and their suppliers. No actual user interface code was to be created in this project, merely the foundations for data communication within the different layers of a larger scale project.

There were to be two assemblies within the project called Foundation and AppTypes. The Foundation assembly was to contain interfaces and base classes to be used in the AppTypes assembly. The AppTypes assembly was to contain various entity, collection, and exception classes.

Solution

The project solution was not too difficult. We were given diagrams displaying the required functionality for each class, and it was only a small step to take that information and create the necessary classes. Below is the diagram for the structure of the Foundation.

Page 2

Page 3: Brandon Miller Portfolio

The Foundation assembly is a group of interfaces that are used to create the Contact class. As the interfaces only contain the information displayed above, I have not included code for them at this point.

The real work for this project was done within the AppTypes assembly. This assembly contained multiple classes that would be used predominantly as an entities tier for a business level application. The largest of the classes were the Supplier, Suppliers, Product, and Products. Supplier and Product were used to store supplier and product information. The Suppliers and Products classes were custom collections of suppliers and products respectively. Below is a code snippet from the completed Products Class.

This is the code for two of the methods within the class. The RemoveAt method accepts an index into the collection, and removes the entry at that index. The code within the method is fairly straightforward except for the OnCollectionModified call. Within the project, we created an event logger to record all called methods that could alter the collection. The event logger will be discussed a little further down.

The second method shown is an indexer into the collection. This allowed the programmer to use a products [index] syntax with the custom collection. As you can see, this method also uses the event logger when setting a new value in the collection. However within the “get” section, it does not use the event logger, as there are no changes being made to the collection.

The Suppliers custom collection is similar to the Products collection and shares a similar implementation. Below you will see a snippet from the Suppliers class.

Page 3

Page 4: Brandon Miller Portfolio

There isn't a whole lot to explain here, as this class is very straight forward.

Page 4

Page 5: Brandon Miller Portfolio

The event logger mentioned earlier has several different small classes that oversee its functionality.

This class inherits from event args and is passed around whenever the list is modified.

The actual event logger class itself is used to add new logs anytime the collection is modified.

Page 5

Page 6: Brandon Miller Portfolio

The framework project required us to code very strictly along the guidelines that were given to us, as it was graded by a program provided with the project instruction. As we were only creating class libraries, and not an executable program, this was the most effective way to grade the project. However, given how strict the grading program was, code customization opportunities were limited. All in all, this project was primarily to get us more used to programming in C# than in our actual problem solving abilities.

Library Project

Objective

The library project was a four phase project. The end result was to be a three tier designed application written to interface with an SQL database. The first layer was to be a front end UI project, two of which were written in different phases of the project. The first was a Windows forms interface. The second was an ASP website. There was a middle tier business layer, responsible for business logic and a third tier data access layer that would access stored procedures I had written on an SQL server. [I didn't understand the last 4 sentences.] The required functionality for the project was to add new adult and juvenile members, retrieve a member's information, and check in and check out a book.

Phase 1

Objective

The first phase of the library project was to create a Windows Forms UI to the library database. I was given a prewritten data access layer to be used for all database operations. The first phase goal was to provide functionality for the above mentioned procedures, along with proper error handling.

Solution

In order to complete phase 1 of this project, I decided to use a tabbed panel to create an easy-to-maneuver user interface. Following are screen shots of each tab and descriptions of their functionality.

This above image shows the Get Member Information tab of my solution. The only editable field on this tab is the member ID text box. When the user enters a valid member ID, the database is accessed, and returns an object with all of the member's information. Below the tab panel is a grid view which shows the books currently checked out by the member. When the user selects a book from the grid view, they have the option of

Page 6

Page 7: Brandon Miller Portfolio

checking that book in from this page. If the member ID is invalid, an error will appear below the check in selected books button, but above the grid view.

Because the database tracks member information by member type (adult versus juvenile), two additional data points are collected for juveniles: birth date and adult member ID fields. When a tab is populated with member data, the birth date and adult member ID fields are hidden for juvenile members.

The add juvenile tab contains all the information that must be entered to enroll a juvenile member. As they are treated as a juvenile only if they are under 18, the date time picker above prevents any entry with a birth date more than 18 years prior to the current date. Once the member reaches 18 years of age, they are automatically converted to an adult member (although this functionality was not fully implemented until phase 2 of the project). Once the member is successfully added, a message label appears to confirm the addition, and to show the member ID of the new member.

This is the add adult member tab. As you can see, there are more fields than on the add juvenile member tab. The address and phone number of the adult member listed on the add juvenile page is used to provide the juvenile's address. Each field has validators present in order to ensure that all information entered is in a proper format. Whenever you mouse over one of the red circles next to an improper field, a small box appears telling you what is wrong with the format. Every field on all tabs that have a required format perform validation on them.

This tab permits data entry in only three fields. Once you tab out of the member ID text box, it validates the ID and if it is proper, will show the member information panel. Once the check out button is clicked, if the ISBN and copy number are correct, and the book is not already checked out, the item information will appear on the right, allowing the user to confirm or cancel the checkout.

Page 7

Page 8: Brandon Miller Portfolio

The last tab is the check in book tab. Its set up very similar to the check out book tab, except that the member ID text box is not present. On this tab, the user has the option to enter the ISBN and copy number to check in the book, or they can simply select the title to be checked in in the grid view and click the check in button.

Phase 2

Objective

The objective for the second phase of the library project was to create a data access layer to interface with the previously designed Windows forms application. The data access layer was to use ADO.net to access the stored procedures we wrote on the SQL server. As before, we had to ensure that all exceptions were handled properly.

Solution

With the front end already designed, I created the data access layer.

You will notice that I am using several using blocks within this method so that it will dispose of the resource automatically.

First I created the connection using the connection string property I configured. Next, using statements are in all of my data access layer methods, I created a new SQL command to establish the connection and load the command up with all required values to be passed to the stored

Page 8

Page 9: Brandon Miller Portfolio

procedure. After loading all variables, the command is executed and returns the new members' member ID using an output variable.

Due to a problem I encountered during the process of taking screen shots of my code, this is the only picture I have of my ADO.net code, however all methods were written in a very similar format. The only differences come based upon how I executed the command. Sometimes I had to read one record, such as on a get member method, in which case I used a reader to get the information. Other times I would use a data adapter.

Phase 3

Objective

Phase 3 of the library project was to create a new UI for library access using ASP. All previous functionality was required, along with the implementation of web site security. There was to be a login page that required proper credentials before receiving access to the library itself.

Solution

As the data access layer and stored procedures for the database were written in the previous phase, this phase involved creating a website to manage the library database. The functionality of the web site is the same as the previous windows forms project, however there were a few additional features that were to be added. This program had to automatically update a juvenile to an adult whenever they turned eighteen. It also offers a member with an expired account to renew their account.

Below are a group of pictures to show the structure of my site.

As you can see, the get member information page displays the user information of the member ID entered into the text box. There is a grid view at the button that shows the books currently checked out to that member. If the member's account is expired, the user will be presented with an option to renew the account just above the grid view.

Page 9

Page 10: Brandon Miller Portfolio

The add adult and add juvenile member pages maintain all the same functionality previously established in the previous phases. Validator controls were used on all of the editable fields so that the user can only enter information in a valid format.

You will notice that this page shows less information than the check in book page in phase 1. I chose to create the website this way in order to minimize clutter on the page. You will notice that I have a get members books button next to the member ID, whereas I do not have that button on the check out book page below. As it is more important to know which books the member currently has checked out on this page, I felt it would be helpful to be able to pull up the grid view before the ISBN and Copy Numbers had to be entered.

Page 10

Page 11: Brandon Miller Portfolio

This page is almost identical to the check in book page, but as you can see, there is no get members books button.

Phase 4

Objective

Phase 4 of the library project was of a much smaller scope than the other phases. I was to modify my existing ASP website to use a WCF (Windows Communication Framework) service instead of directly calling the data access layer that was created in phase 2. We were to create a service contract, and then host our service online implementing SSL for security.

Solution

As all of the UI for the website was completed in phase 3 of the project, this shorter phase involved converting the website to use a WCF service. As a vast majority of configuring a WCF service is done through settings, this phase has far less code than the other phases. Below are a few screen shots and descriptions of the code within them.

This interface is used to create the service contract between the service host and the client. This does not show all of the methods of the service, however it does show the various attributes being properly applied to the methods to allow for security and to use my custom fault.

Page 11

Page 12: Brandon Miller Portfolio

Here are two simple methods from the service. As the service was added as yet another layer of abstraction from the user, the service calls my existing business layer functions, which call the data access layer. The only really new code within the service is within the catch blocks. As an exception cannot be passed from the service to the client, I had to create a custom fault class, and instead of throwing a new exception, I throw a Library fault, so that the program can pass relevant information to the client side code. At the very top of this code segment I declare a private variable that is populated with the connection to the service in the page load event. The service uses SSL for security, and as the website already has its own authentication, so in order to access any of the pages, they must already be logged in. Because of that I simply set the user name and password for the SSL within the page load as well, and create the proxy.

During the page unload, I check to see if the proxy has been faulted, and if it has it aborts the faulted connection, as trying to close a faulted connection could cause problems.

Page 12

Page 13: Brandon Miller Portfolio

This is a exert the add member page. The difference between this one and the previously shown example is within the try block. As this phase implemented a service instead of a direct call to the business layer, you can see that instead of my call to the business layer, I call the proxy's add adult member method. These past two changes were made to all of the pages on my website so that it now uses the service.

XML Contract Parsing Project

Objective

This was a group project in which we were to create an ASP website to manage the construction of contracts that were stored in various XML files. We were to parse the XML, read in the data, and then provide the ability to update, or add new information to the XML documents. The actual parsing of XML was done with queries using LINQ to XML. The website was to have the functionality of being able to update existing sessions (used to describe an instance of a particular class) and to create new ones.

Solution

At the beginning of this project, as none of my team had any experience with LINQ to XML, we spend the first few hours simply learning the subtleties of LINQ to XML. However it was not a very difficult process

Page 13

Page 14: Brandon Miller Portfolio

and soon we had our first method written. At this point in order to get a more hands on experience with it for myself, I wrote one of the functions we would need for the project.

As the structure of the XML we were parsing for this project is of utmost importance to actually understanding my part in the solution, I will briefly explain the structure of the XML we were working with.

Everything within the XML document is broken down into Sessions. Each session can have a name and a type, as well as contain several variables within it. The sessions themselves are in reference to a particular session of a class, so an example of a session would be the quarter 2 .Net master's course (that being the session that I was currently a part of). A type would be either consulting, or tuition, which were the two ways of paying for the class. Within the session itself is a list of variables, which can each have a name and a type as well, along with a value. An example of a variable that all sessions share would be the start date of the class. Having explained briefly about the structure of the XML, I will move on to proving snippets from the code.

This is the section of the LINQ to XML layer that I personally wrote. This method is to return a list of all the current session names within the list, with the type of the session concatenated to the end. The config path for the XML document itself is passed from a higher level. You can see that the program loads the document into an Xelement variable, and then uses LINQ to query the document, selecting all of the session names and types, returning a string list of the name and types to the front end.

The rest of the LINQ was written by another teammate, so I will move on to the front end page that I worked on. I began by creating a masterpage for the website, and then soon moved on to creating the update default session page. The default sessions were simply there to contain default information that would be used when a specific class session did not contain the associated variable. Below you will see the design for my page, which is positioned within the masterpage.

Page 14

Page 15: Brandon Miller Portfolio

This is the structure I created for the masterpage, as well as the update default page. I was not logged into the web page at the time ( I was testing the page, and so I had temporarily disabled the authentication to make it easier to maneuver through the page). Were I to have been logged in, you would see a list of hyperlinks to the other pages of the site where the Please log in is displayed.

At the top of the page you will see there is a drop down list where you can select the session type, Tuition or Consulting. Depending upon which one you select, only the fields associated with that type will be displayed. Each text box and drop down list below are then populated with the value from the corresponding variables within the default session. The user is then free to make changes as they see fit. All errors and messages appear in the long white box at the bottom.

Page 15