Monday 30 May 2016

2.2 Eighth Iteration

For the eighth iteration I had to:

  1. Design and develop an data entry point for my administrations.
Risks:

The main risks in this iteration are data parsing. I need to make sure that the write data value is being entered into the correct column in each row. Failure to achieve this will ultimately corrupt my database. The reason this is that if this project is to a scallable project, there needs to be a minimum amount data that my application needs to function properly. Some companies could have up to 20 columns of data in their employee table in their database. However, my system does not need every single column in the companies database to operate but just a select few. This way, there is a standard that all companies can oblige to when then commit to my system.

For designing the data entry point, I wanted to design a system that could allow administrators to easily transfer large amounts of relevant data needed for system to function correctly while also alternatively able to create a single row in the database tables. The way I envisioned this process is that the administrators of the system would upload a csv file into the web application. The file would match the columns of the appropriate table in the database. The program would then parse the file and create objects for the table. These objects would then be saved into the database. This would allow my system to have a mirror representation of that data in the companies database, which as I have mentioned in the previous iteration, is essential for my application to authenticate users. 

To design the entry point, I needed to research how to create an file upload button in ASP.NET. After some time researching, I was able to locate a forum that depicted how to create such a button. Once I was able to make the button upload a file, I have to create a method that would parse the data into temporary string variables. These variables matched the column names of the table that data was being saved to. The file was parsed by splitting the input file string at each comma and storing this into a string array. Then using a "foreach" loop, I was able to instantiate an instance of the reverent object and populate the that object through it's constructor. After each iteration of the loop, I would save that data to the appropriate table using the method "saveChanges()".  A series of error handling had to be incorporated into this parsing method as at many stages, the file could be either corrupted, not in the right format or even the right file type. The end result was a web app with two data entry points. One location was for uploading employee data to the employee table and another was for creating shifts and again, adding them to the shift table in the database. 

Once this was complete, I created a log in system for the web application that mirrored my application log in. However, as administrators and standard employees will be using the web application, I had to add sufficient logic to examine the position of the user logging in so that the web app could direct them to the appropriate web pages. I managed this aspect of the log in element by creating an "if" statement that would examine the users "JobTitle" attribute. If the job title was set to "Floor Staff", then the user would be directed to an EmployeeController that managed all appropriate views and functions that are associated with the standard user. Similarly, if the user's job title was labeled "HR", then that user was redirected to the AdminController where all the administrator functionality lay.

After this iteration was complete, I successful create a web application that acted as a data entry point for my administrators while also creating a log in fuctionality that can detect the type of user trying to gain access and redirect each user type to their appropiate webpage.

For my next iteration, I plan to start adapting some of the feedback that my application received from going live on the app store.

Citations: http://stackoverflow.com/questions/15680629/mvc-4-razor-file-upload

No comments:

Post a Comment