Module Code & Module Title
CC5051NI Databases
Assessment Weightage & Type
50% of Individual Coursework
Year and Semester
2022 Autumn
Student Name:
London Met ID:
College ID:
Assignment Submission Date: 2022-JAN-05
Assignment Submission Date:2022-JAN-05
Word Count: 4127
I confirm that I understand my coursework needs to be submitted online via Google Classroom under the
relevant module page before the deadline in order for my assignment to be accepted and marked. I am
fully aware that late submissions will be treated as non-submission and a mark of zero will be awarded.
Table of Contents
1. Introduction ................................................................................................................................. 6
2. System Features .......................................................................................................................... 7
4. User Manuel/Instructions to Run the Program ........................................................................... 8
4.1. Home Screen ........................................................................................................................ 9
4.2. Admin Login ........................................................................................................................ 9
4.3. Add User ............................................................................................................................ 10
4.4. Inventory Items .................................................................................................................. 11
4.5. Withdraw Items .................................................................................................................. 12
4.6. Staff panel .......................................................................................................................... 13
4.7 Data Analytics ..................................................................................................................... 16
4.7.1 Bar Graph ..................................................................................................................... 16
4.7.2 Pie Chart....................................................................................................................... 16
4.8. Change Password ............................................................................................................... 17
5. Software Architecture Diagram ................................................................................................ 18
6. Class Description ...................................................................................................................... 19
7. Methods description .................................................................................................................. 20
8. Algorithm .................................................................................................................................. 32
8.1. Bubble shorting .................................................................................................................. 32
9. Problems Scenario .................................................................................................................... 34
10. Conclusion .............................................................................................................................. 35
11. Bibliography ........................................................................................................................... 36
1
Table of Figures
Figure 1: Login page ....................................................................................................................... 9
Figure 2: Add User Page ............................................................................................................... 10
Figure 3: Inventory Items Page ..................................................................................................... 11
Figure 4: Withdraw item page ...................................................................................................... 12
Figure 5: Withdraw item validation page ..................................................................................... 13
Figure 6: validation of Delete Items ............................................................................................. 14
Figure 7: Validation of Edit Items ................................................................................................ 14
Figure 8: Validation of Json data saved ........................................................................................ 15
Figure 9: Bar Graph of Inventory Items ....................................................................................... 16
Figure 10: pie chart of items in Inventory .................................................................................... 16
2
Table of Tabless
Table 1: Class Description of Bike rental System ........................................................................ 19
Table 2: Method Description of [Link] ....................................................................... 20
Table 3: Method Description of [Link] ........................................................... 20
Table 4: Method Description of [Link] ........................................................................ 21
Table 5: Method Description of [Link] ............................................................................ 21
Table 6: Method Description of [Link] ...................................................................... 21
Table 7: Method description of [Link] ........................................................................................ 22
Table 8: Method description of [Link] ....................................................................................... 22
Table 9: Method description of [Link] ............................................................................ 23
Table 10: method description of [Link] ....................................................................................... 24
Table 11: method description of [Link] ................................................................. 24
Table 12: Method description of [Link] .................................................................. 25
Table 13: Method description of [Link] ............................................................. 25
Table 14: method description of [Link]..................................................................... 25
Table 15:Method description of [Link] ........................................................................ 26
Table 16: Method description of [Link] ............................................................................... 26
Table 17: Method description of [Link] ........................................................................... 27
Table 18: Method description of [Link] ............................................................................... 28
Table 19: Method description of [Link] ................................................................ 30
Table 20: Method description of [Link] ............................................................................... 30
Table 21: Method description of [Link] ....................................................................... 31
3
Acknowledgment
"I would like to express my sincere gratitude to Abhishekh Humagain and Samyush Maharjan for
their invaluable guidance and support throughout this work. Their expertise and encouragement
were instrumental in helping me to complete this project. I am deeply thankful for their mentorship
and guidance."
4
Abstract
This coursework involves designing and implementing a C# desktop application to help a bike
service center manage its inventory records. The application will replace the current paper-based
manual system and allow the staff to request items from the inventory during specific hours (9A9
AMo 4 PM, Monday to Friday). Only an admin can approve these requests and add or remove
items from the inventory. The application will track details about each stock item, including the
staff member who requested titand the admin who approved it. The inventory will only be
accessible to the admin. This project aims to improve the efficiency and organization of the bike
service center's inventory management process.
5
1. Introduction
.NET is a free, cross-platform, open-source developer platform for building a variety of
applications. It provides multiple languages, editors, and libraries that can be used to build
applications for the web, mobile devices, desktops, gaming, internet of things (IoT) devices, and
more. The programming languages that are part of the .NET framework include C#, F#, and Visual
Basic. Blazor Maui is a variant of Blazor that is optimized for building desktop applications. It
allows developers to build desktop applications using C# and Razor syntax, and it includes
additional features such as a native macOS title bar and support for .NET 5.0. Some examples of
applications that can be built using Blazor Maui include desktop productivity tools, data analysis
tools, and business applications (Thompson, 2022).
This coursework involves the creation of a C# desktop application using the .NET framework and
the Blazor Maui library. A bike service center will use the application to manage their inventory
records and improve the organization and efficiency of its inventory management process. Staff
members can request items from the inventory during specific hours (9 AM to 4 PM, Monday to
Friday). Still, only an admin can approve these requests and add or remove items from the
inventory. The application will track details about each stock item, including the staff member
who requested the item and the admin who approved it, and will store the admin login details in a
JSON or CSV file.
The application will also include features such as a system for the admin to approve the removal
of items from the inventory, a system for the admin to add items to the inventory, and a system for
saving and retrieving the addition and removal details of each item and the inventory of the service
center in a CSV or JSON file. There will be a table for the records of items taken from the inventory
for every month, a Data Grid View for displaying all items currently in the inventory, and a Bar
Graph to display the number of each item taken out.
6
2. System Features
The C# desktop application described in the previous message includes the following
features:
• A login system for the admin, with the admin's login details stored in a JSON or CSV file
• A system for the admin to approve the removal of items from the inventory during specific
hours (9 AM to 4 PM, Monday to Friday)
• A system for the admin to add items to the inventory at any time
• A system for saving and retrieving the addition and removal details of each item and the
inventory of the service center in a CSV or JSON file
• A table for the records of items taken from the inventory for every month, including the
item, quantity is taken, a staff member who requested the item, admin who approved it,
and date it was taken
• A Data Grid View for displaying all items currently in the inventory, including the item
name, quantity in the inventory, and date it was last taken
• A Bar Graph to display the number of items taken out, showing the relationship between
the items.
7
4. User Manuel/Instructions to Run the Program
To run the C# desktop application (Bike Rental System) described in the previous messages, you
will need to follow these steps:
• Install the .NET framework on your computer if it is not installed. You can
download and install the latest version of .NET from the official website
([Link]
• Download the source code for the application and extract the files to a folder on
your computer.
• Open the project in Visual Studio or another development environment that
supports the .NET framework and Blazor Maui.
• Build the project to ensure that all dependencies are installed and the application is
ready to run.
• Run the application by pressing the "Start" button in Visual Studio or by selecting
the "Run" option from the menu.
• The application will open in a new window. Follow the prompts and instructions
within the application to use its various features.
• To log in as the admin, you must enter the admin login details stored in the JSON
or CSV file. You can edit or add new login details to this file as needed.
• To approve the removal of items from the inventory or add items to the inventory,
you must be logged in as the admin and follow the prompts within the application.
8
• The table and Data Grid View will display the records and details of the items in
the inventory, and the Bar Graph will display the number of each item taken out.
You can interact with these features to view and analyze the data.
4.1. Home Screen
If the user has issues with the bike rental system's instructions, the instructions may need to be
clarified or completed. The user may need help understanding how to perform certain tasks, follow
certain steps, or have all the necessary information to use the application successfully. so, the
explanation of User Interface (UI) of the Bike Rental System is Explained below:
4.2. Admin Login
The administrator logs in to the Bike Management system using their username and password.
Figure 1: Login page
9
4.3. Add User
The administrator adds a new user to the system and assigns them a username and password. Once
the user has been assigned a username and password, they can log in to the portal.
Figure 2: Add User Page
10
4.4. Inventory Items
A table is kept of all inventory items that are taken from the inventory each month, including the
item name, quantity, and the name of the person who took the item. The table also includes the
date the item was taken. If the request for the item has not been approved by the administrator, the
user will not be able to obtain the item from the inventory.
Figure 3: Inventory Items Page
11
4.5. Withdraw Items
The users can withdraw whatever items in inventory. But did not type the value in negative.
Figure 4: Withdraw item page
12
4.6. Staff panel
The validation of the system the staff can only with draw the item between 9am to 4pm, 5days a
week (From Monday to Friday)
Figure 5: Withdraw item validation page
13
Figure 6: validation of Delete Items
Figure 7: Validation of Edit Items
14
Figure 8: Validation of Json data saved
15
4.7 Data Analytics
4.7.1 Bar Graph
The bar graph displays the number of each item that has been taken from the inventory.
Figure 9: Bar Graph of Inventory Items
4.7.2 Pie Chart
The pie chart displays the total number of items in the inventory.
Figure 10: pie chart of items in Inventory
16
4.8. Change Password
After logging in, the user or administrator can change their password through the system.
17
5. Software Architecture Diagram
18
6. Class Description
Class Name Description
[Link] This class verify the admin approved the items
[Link] This Class Verify the Chart of the Items in
inventory
[Link] This class verify the user getter and setter
[Link] This class verify the adding the items and edit
and deleting the items
[Link] This class verify the Role of admin
[Link] This class verify the Role of user
[Link] This class verify the change of the password
and password validation
[Link] This class verify the get all path and store the
data into json
[Link] This class give the user to withdraw the items
from the inventory and validation of time.
[Link] In this class the user can delete the items and
validation of items can’t be null.
Table 1: Class Description of Bike rental System
19
7. Methods description
1. [Link]
Method Name Description
public Guid Id { get; set; } = Getter setter method of Guid
[Link]();
public string ItemName { get; set; } Getter setter method of item Name
public Guid ItemId { get; set; } Getter Setter method of Item id
public int Quantity { get; set; } Getter setter method of Quantity
public bool IsApproved { get; set; } Getter setter method of IsApproved
public Guid TakenBy { get; set; } Getter setter method of Guid
public string TakerName { get; set; } Getter setter method of TaskerName
public Guid ApprovedBy { get; set; } Getter setter method of Approved By
public string ApproverName { get; set; } Getter Setter method of AproverName
Table 2: Method Description of [Link]
2. [Link]
Method Name Description
The private access modifier means that the
private static void SaveAll(Guid SaveAll method can only be accessed within
userId,List<ApprovedItem> approvedItems) the class in which it is declared.
public static List<ApprovedItem> The public access modifier means that the
Create(Guid userId, string itemName, Guid Create method can be accessed from outside
itemid, int quantity, string takerName, Guid the class in which it is declared.
approverID, string approverName, bool
isApproved)
Table 3: Method Description of [Link]
20
3. [Link]
Method Name Description
public static List<DataAnalysisDTO> The public access modifier means that
DataAnalysisDTO(Guid userId) the DataAnalysisDTO method can be
accessed from outside the class in which
it is declared.
public string TitleName { get; set; } Getter setter method for Titleaname
public int ValueCount { get; set; } Getter setter method for valuecount
Table 4: Method Description of [Link]
4. [Link]
Method Name Description
public User CurrentUser { get; set; } Getter setter method for Currentuser
Table 5: Method Description of [Link]
5. [Link]
Method Name Description
public Guid Id { get; set; } = Getter setter method for Id
[Link]();
public string ItemName { get; set; } Getter setter method for ItemName
public int Quantity { get; set; } Getter setter method for quantity
public string AddedBy { get; set; } Getter setter method for AddedBy
Table 6: Method Description of [Link]
21
6. [Link]
Method Name Description
public enum Role Declares an enumeration type called
{ Role.
User,
Admin
}
Table 7: Method description of [Link]
7. [Link]
Method Name Description
public Guid Id { get; set; } = Getter setter method for Id
[Link]();
public string Username { get; set; } Getter setter for username
public string PasswordHash { get; set; } Getter setter method passwordHash
public Role Role { get; set; } Getter setter method Role
public bool HasInitialPassword { get; Getter setter method HasIntialPassword
set; } = true;
public DateTime CreatedAt { get; set; } Getter setter method of dateTime
= [Link];
public Guid CreatedBy { get; set; } Getter setter method of Guid
Table 8: Method description of [Link]
22
8. [Link]
Method Name Description
private static void SaveAll(List<User> The method stores the users into the lists
users)
public static List<User> GetAll() The method get all the Lists data into
the dataset
public const string SeedUsername = The method stores the admin username
"admin";
public const string SeedPassword = The method stores the admin password
"admin";
public static List<User> Create(Guid The method create the used , username,
userId, string username, string password and Role.
password, Role role)
public static bool MaxAdmin() The method stores the validation of
admin not more than two admin.
public static User GetById(Guid id) The method generate the Guid of of
user.
public static List<User> Delete(Guid id) The method delete the user from id
Table 9: Method description of [Link]
23
9. [Link]
Method Name Description
public static string HashSecret(string The HashSecret method returns a string
input) value.
public static bool VerifyHash(string The VerifyHash method returns a bool
input, string hashString) value. The VerifyHash method is used
to verify the integrity of a hashed secret
value such as a password.
public static string This method store the path of the Json
GetAppDirectoryPath() file
Table 10: method description of [Link]
10. [Link]
Method Name Description
public Guid Id { get; set; } = Getter setter method of Id
[Link]();
public string ItemName { get; set; } Getter setter method of Itemname
public int Quantity { get; set; } Getter setter method of Quantity
public Guid ItemId { get; set; } Getter setter method of ItemId
public bool IsApproved { get; set; } Getter setter method of IsApproved Item
public Guid TakenBy { get; set; } Getter setter method of taken by item
public string TakerName { get; set; } Getter setter method of takerName
public DateTime CreatedAt { get; set; } Getter setter of date and time
= [Link];
Table 11: method description of [Link]
24
11. [Link]
Method Name Description
private GlobalState _globalState { get; Getter setter method of Globalstate
set; }
private List<ApprovedItem> This method store the approved item in
_approvedItems { get; set; } a list using getter setter method
private void ChangePasswordHandler() This method use to change the password
of the user and admin
Table 12: Method description of [Link]
12. [Link]
Method Name Description
private List<ApprovedItem> Getter setter method for Approveditems
_approvedItems { get; set; }
Table 13: Method description of [Link]
13. [Link]
Method Name Description
private GlobalState _globalState { get; Getter setter method for globalstate
set; }
private PieConfig _config; This method call the Piechart
private List<DataAnalysisDTO> This method stores the data into the
_dataAnalysisDTO; dataset
Table 14: method description of [Link]
25
14. [Link]
Method Name Description
private List<DataAnalysisDTO> This method stores the data of inventory
_dataAnalysisDTO; in a list
private GlobalState _globalState { get; Getter setter method of Globalstate
set; }
Table 15:Method description of [Link]
15. [Link]
Method Name Description
protected override void This method is used to access
OnInitialized() modifier and the ‘Overide’ modifier.
Table 16: Method description of [Link]
16. [Link]
Method Name Description
private GlobalState _globalState { get; Getter setter method of
set; } Globalstate
private List<InventoryItems> This method stores the data in a
_inventoryItems { get; set; } list of InventoryItems
private bool _showAddItemDialog { get; Getter setter method of
set; } Showadditemdialog
private bool _showDeleteUserDialog { Getter setter method of Delete
get; set; } user dialouge
26
private string _addUserErrorMessage { Getter setter method of Error
get; set; } message
private string Getter setter fot Delete user
_deleteUserErrorMessage { get; set; } Error message
private User _deleteUser { get; set; } Getter setter for delete user
private List<User> _users { get; set; } This method stores the data of
user in a list
private string _itemName { get; set; } Getter setter method of
Itemname
private int _quantity { get; set; } Getter setter method of Quantity
private GlobalState _globalState { get; Getter setter method of
set; } Globalstate
private List<InventoryItems> This method Stores the data in
_inventoryItems { get; set; } a array of InventoryItems
private bool _showAddItemDialog { get; Getter setter method of Show
set; } Dialogue box
private bool _showDeleteUserDialog { Getter setter method of Show
get; set; } Delete user dialogue
private string _addUserErrorMessage { Getter setter method of Add
get; set; } user Error message
private string Getter setter method of delete
_deleteUserErrorMessage { get; set; } user
protected override void OnInitialized() This method is used to access
modifier and the ‘Overide’
modifier.
Table 17: Method description of [Link]
27
17. [Link]
Method Name Description
private GlobalState _globalState { get; Getter setter method of Global state
set; }
private bool _showDefaultCredentials Getter setter method of
{ get; set; } ShowDefaultCredentials
private string _username { get; set; } Getter setter method of username
private string _password { get; set; } Getter setter method of password
protected override void OnInitialized() This method is used to access modifier
and the ‘Override’ modifier.
private void LoginHandler() This method holds the validation of the
login
Table 18: Method description of [Link]
28
18. [Link]
Method Name Description
private GlobalState _globalState { get; set; } Getter setter method of
Globalstate
private List<InventoryItems> _inventoryItems This method store the data of
{ get; set; } inventory items into the list
private bool _showAddItemDialog { get; set; } Getter setter method of Show
Add item Dialog
private bool _showDeleteUserDialog { get; Getter setter method of Show
set; } Delete user Dialogue
private string _addUserErrorMessage { get; Getter setter method of the add
set; } User Error Message
private string _deleteUserErrorMessage { get; Getter setter method Delete
set; } user Error Message
private User _deleteUser { get; set; } Getter Setter method of
deleting user
private List<User> _users { get; set; } This method holds the data of
users in the list
private string _itemName { get; set; } Getter setter method of Item
name
private string _quantity { get; set; } Getter setter of Quantity
private bool _showWithdrawlInventoryDialog Getter setter of Show
{ get; set; } withdrawal Inventory Dialogue
29
private GlobalState _globalState { get; set; } Getter setter method of
Globalstate
private List<InventoryItems> _inventoryItems This method holds the data of
{ get; set; } InventoryItems into the list
private bool _showAddItemDialog { get; set; } Getter setter method of the
Show Add Item Dialog
private string _editInventoryErrorMessage { Getter setter of Edit Inventory
get; set; } Error Message
Table 19: Method description of [Link]
19. [Link]
Method Name Description
protected override void OnInitialized() This method is used to access modifier
and the ‘Overide’ modifier.
private void OpenAddUserDialog() The private access modifier means that
the OpenAddUserDialog method can
only be accessed within the class in
which it is declared.
private void the method declaration what the
OnAddUserDialogClose(bool isCancel) OnAddUserDialogClose method does,
but it performs action when a dialog
box or user interface element for adding
a user is closed.
Table 20: Method description of [Link]
30
20. [Link]
Method Name Description
private bool Getter setter method of Show Approved
_showApproveItemDialog { get; set; } Item
private bool _showRejectItemDialog { Getter setter method of Reject item
get; set; } dialogue
private string _addUserErrorMessage Getter setter method of User Error
{ get; set; } message
private string Getter setter method of Delete user error
_deleteUserErrorMessage { get; set; } message
private User _deleteUser { get; set; } Getter setter method of Delete user
private List<User> _users { get; set; } This method stores the data of users into
the list
private string _itemName { get; set; } Getter setter method of Item name
protected override void OnInitialized() This method is used to access modifier
and the ‘Override’ modifier.
Table 21: Method description of [Link]
31
8. Algorithm
8.1. Bubble shorting
Bubble sort is an algorithm used to sort a list of items in ascending or descending order. It works
by iterating through the list of items and comparing adjacent pairs of items. If the two items are in
the wrong order, they are swapped. This process is repeated until the list is fully sorted
(rathbhupendra, 2021).
Bubble sort has a time complexity of O(n^2) in the worst-case scenario, which means that it is less
efficient than other sorting algorithms for large lists. However, it is simple to implement and useful
for small lists or as a learning tool. In this coursework Bubble Shorting was used which are
implemented by the following line of the that are taken a reference from the websites.
public static void BubbleSort(int[] array)
bool swapped;
do
swapped = false;
for (int i = 0; i < [Link] - 1; i++)
if (array[i] > array[i + 1])
int temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
swapped = true;
32
}
} while (swapped);
33
9. Problems Scenario
One problem scenario that I may have faced while implementing the chart using [Link] in this
coursework. I have added the [Link] library to my project and have set up the basic structure for
my chart, including the canvas element and the data and options objects. However, when I try to
run my code and display the chart, I encounter an error that says, "Uncaught Reference Error:
Chart is not defined. “Upon further investigation, I realized that the [Link] library is not properly
loaded or recognized by my application. I have checked the file path and the inclusion of the script
tag in my HTML, and both seem to be correct. However, I am still encountering this error. I try
several approaches to fix this issue, such as modifying the file path or re-downloading the [Link]
library, but none seem to work. I cannot display the chart and am trying to figure out how to
proceed.
After trying several different approaches to fix the issue, I realize that the problem may be related
to how I have set up my data and options objects. I review the documentation for [Link] and
realized that I may need to correct some things in my code, such as using the wrong data format
or specifying the wrong options. I spend some time reviewing and debugging my code and
eventually manage to identify and fix the errors in my data and options objects. Once these errors
are resolved, the chart is finally displayed correctly in my application. I am relieved to have finally
solved this issue and am happy with how the chart looks and functions. I make a note to carefully
review the documentation and double-check my code in the future to avoid similar issues.
34
10. Conclusion
In conclusion, the Bike Rental system using C# Blazor Maui was successfully developed with the
help of our teachers and through hard work and coding throughout the coursework. One challenge
we faced was implementing the chart using [Link], as we initially encountered an error that
prevented the chart from being displayed. However, we resolved the issue by reviewing the
documentation and debugging our code and successfully displayed the chart in our application.
This experience emphasized the importance of thorough documentation review and careful code
checking to avoid similar problems in the future.
35
11. Bibliography
rathbhupendra. (2021, January 27). Bubble short. Retrieved from GeeksforGeeks:
[Link]
Thompson, B. (2022, December 31). What is .NET Framework? Explain Architecture &
Components. Retrieved from guru99: [Link]
[Link]
36