NancyTuladhar DatabaseCoursework
NancyTuladhar DatabaseCoursework
CC5051NI Databases
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
8. Algorithm .................................................................................................................................. 32
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 Approveditem.cs ....................................................................... 20
Table 3: Method Description of ApprovedItemService.cs ........................................................... 20
Table 4: Method Description of DataAnalytics.cs ........................................................................ 21
Table 5: Method Description of GlobalState.cs ............................................................................ 21
Table 6: Method Description of InventoryItems.cs ...................................................................... 21
Table 7: Method description of Role.cs ........................................................................................ 22
Table 8: Method description of USer.cs ....................................................................................... 22
Table 9: Method description of UserService.cs ............................................................................ 23
Table 10: method description of utils.cs ....................................................................................... 24
Table 11: method description of Withdrwalservice.cs ................................................................. 24
Table 12: Method description of ApprocedLog.razor .................................................................. 25
Table 13: Method description of ChangePassword.razor ............................................................. 25
Table 14: method description of Dataanalysis.razor..................................................................... 25
Table 15:Method description of Horizontal.razor ........................................................................ 26
Table 16: Method description of Index.razor ............................................................................... 26
Table 17: Method description of Invntory.razor ........................................................................... 27
Table 18: Method description of Login.razor ............................................................................... 28
Table 19: Method description of StaffInventory.razor ................................................................ 30
Table 20: Method description of Users.razor ............................................................................... 30
Table 21: Method description of Withdrawl.razor ....................................................................... 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
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
(https://dotnet.microsoft.com/download).
• Download the source code for the application and extract the files to a folder on
your computer.
• 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.
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:
The administrator logs in to the Bike Management system using their username and password.
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.
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.
11
4.5. Withdraw Items
The users can withdraw whatever items in inventory. But did not type the value in negative.
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)
13
Figure 6: validation of Delete 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.
The pie chart displays the total number of items in the 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
InventoryItem.cs This class verify the adding the items and edit
and deleting the items
Utils.cs This class verify the get all path and store the
data into json
WithdrawlService.cs In this class the user can delete the items and
validation of items can’t be null.
19
7. Methods description
1. ApprovedItems.cs
2. ApprovedItemService.cs
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 ApprovedItemService.cs
20
3. DataAnalysis.cs
public string TitleName { get; set; } Getter setter method for Titleaname
public int ValueCount { get; set; } Getter setter method for valuecount
4. GlobalState.cs
public User CurrentUser { get; set; } Getter setter method for Currentuser
5. InventoryItems.cs
Method Name Description
public int Quantity { get; set; } Getter setter method for quantity
public string AddedBy { get; set; } Getter setter method for AddedBy
21
6. Role.cs
7. User.cs
22
8. UserService.cs
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
23
9. Utils.cs
public static string This method store the path of the Json
GetAppDirectoryPath() file
10. Withdrawlservice.cs
public bool IsApproved { get; set; } Getter setter method of IsApproved Item
public Guid TakenBy { get; set; } Getter setter method of taken by item
public DateTime CreatedAt { get; set; } Getter setter of date and time
= DateTime.Now;
Table 11: method description of Withdrwalservice.cs
24
11. ApprocedLog.razor
12. ChangePasword.razor
13. DataAnalysis.rozor
25
14. Horizontalgraph.razor
15. Index.razor
16. Inventory.razor
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 Invntory.razor
27
17. Login.razor
28
18. StaffInventory.razor
private List<User> _users { get; set; } This method holds the data of
users in the list
29
private GlobalState _globalState { get; set; } Getter setter method of
Globalstate
19. Users.razor
30
20. Withdrawl.razor
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.
bool swapped;
do
swapped = false;
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 Chart.js in this
coursework. I have added the Chart.js 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 Chart.js 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 Chart.js
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 Chart.js 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 Chart.js, 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:
https://www.geeksforgeeks.org/bubble-sort/
Thompson, B. (2022, December 31). What is .NET Framework? Explain Architecture &
Components. Retrieved from guru99: https://www.guru99.com/net-
framework.html
36