To understand and increase my knowledge using C# and other languages to successfully, transfer, delete and manipulate data using an online database.
Two weeks holiday, a fantastic opportunity to kill two birds with one stone and educate my brain further in terms of C# and do a task that is semi-relative to my practice dissertation, for University. Quick note, my practice based dissertation is based upon a management system that enables users to control other devices connected to the internet, with the touch of one button.
Anyhow, using Google’s awesome searching algorithm, I searched for C# tasks and quickly stumbled upon a blog post, posted by Udemy, that talked about six different C# tasks that I could tackle. My decision was pretty swift, and I decided to embark on the journey of creating an application for Blood Bank Management Software task, why? You may ask, mainly due to the fact that my girlfriend is a Nurse, and wanted to somewhat impress her. Any questions that that relate to her I could possibly fire against her and also get some pretty good critism in terms of usability. Oh yeah! Not forgetting that I could modify the task a little bit so that the data was accessible online – in correlation to gaining experience / preparing my self for my dissertation.
In this project, you’ll create a Windows-based blood bank management software. The software must meet the following requirements:
Register a new user
Store key data such as blood group, Rh factor (positive/negative), donor’s name, address, telephone number
Retrieve above data through search
Find appropriate match for a particular blood group AND Rh factor type
Display amount of different blood types currently in storage
You can make this application much more complex by asking for the donor’s prior medical history and showing a positive match only if certain medical conditions are found to be absent, sending a message to the donor if storage levels for his/her blood type are low, etc.
Upon writing this you could say article, I realised that I have so much to say but at the same time so much that I just completely bore the reader, so instead, I’m just going to explain what I have done in terms of meeting the criteria for the task (in a semi bullet style way) with semi-task as a subheading.
Semi-Task: Register a new user, store key data such as blood group, Rh factor (positive / negative), donor’s name, address, telephone number
I have a windows form that consists of texts / combo boxes and buttons that require the user to fill in and submit. When the user hits register, using C#, T-SQL and ado.net the application reads the fields, check if the criteria is correct for example does the telephone field have any invalid characters, if all the fields passes the criteria, the application sends its first query to the database to check if the user does not already exist. The query string looks somewhat similar to this:
SELECT COUNT(*) FROM dbo.Donors WHERE Firstname=’Bob’ AND LastName=’Hunter’ AND Postcode=’24 Coder Lane’
This query will then send back the amount users that meet that query, if there was no match, the application can assume that the user doesn’t exist and therefore creates another query string based upon the inputted information in text fields and combo-boxed and registers / adds a new user to the database using a query string similar to the one below.
INSERT INTO dbo.Donors (FirstName, LastName, Address, Postcode, Telephone, Email) VALUES (‘Bob’, ‘Hunter’, ‘8737 Coders Lane’, ’24 CODER Lane’, ‘1617779999’, ‘firstname.lastname@example.org’); DECLARE @donorID int; SET @donorID = SCOPE_IDENTITY(); INSERT INTO dbo.BloodType (DonorID, BloodType, RHFactor, BloodStorage) VALUES(@donorID, ‘AB’, ‘Positive’, 0);
This query string simply, creates a new data entry into the table dbo.Donors based upon that entry, the application uses the ID to form a relationship and build a new entry into dbo.BloodType table.
Semi-Task: Retrieve above data through search, find appropriate match for a particular blood group AND Rh factor type
Based upon that I then decided to merge the two into one, and create a grid table in which the user can create their own semi-type T-SQL statement, inputting the correct data within the tables enabling them to search the database using certain criteria’s for example inputting hunter in the LastName: text field, hitting update to, which will then return all the results of the users / donor’s on the database with the last name Hunter also enabling the user to find Donor’s by their blood group and RH factor which was part of the criteria.
Finding the appropriate match for a particular blood group and rh factor type is just as straight forward, all the user has to do is select the items both in BType: and RHF: fields, hit update and if you haven’t already guessed, the table shows all the registered users that match the users criteria, upon reading this I have identified an improvement which I could implement in the future, which is to merely add another field that if selected, the datagrid will only show users with blood that have donated blood and is in stock.
Semi-Task: Display amount of different blood types currently in storage.
This task wasn’t really clear on how specific they want me to bet in terms of displaying this information so instead, I have implemented another form, which sole purpose is to display the amount of blood in storage, the user has to simple select an item from each the Blood Type and RH Factor and then hit submit, when the user hits submit the application creates a T-SQL statement which would be similar to this SELECT Sum(BloodStorage) From dbo.BloodType WHERE BloodType=’AB’ AND RHFActor=’Positive’ which in return adds up all the entries where their blood type and rhfactor match and teturn the total.
I’ve also provided the opportunity for the user to be more specific and display the amount of blood each person has donated and how much is in currently in stock, specific to that user and which can be viewed when using the main database screen (for example when searching for registered users on the database with last name ‘hunter’) the results returned back from this will also include how much each entry / user have in stock in terms of blood.
Semi-Task: Sending a message to the donor if storage levels for his/her blood type are low, etc.
This was not a requirement of the task but merely an extra to make a more complicated application as stated further above anyhow, I challenged myself further and decided to provide a solution for this, you could say side task. I have modified the application so that when the user is for example withdrawing blood from the storage which in return if not already obvious decreases the amount of blood in storage from a specific donor and therefore is an opportunity for me to complicate my application further. I created an algorithm that simply identifies this and then sends the donor an email, if they have an email, stated that the blood that the donor has been put to good use and has almost been depleted.
Need to Add
Need to Add