Professional Documents
Culture Documents
Ioop Documentation An C Coding Assignment With Competely Done
Ioop Documentation An C Coding Assignment With Competely Done
Intake Code :
Lecturer Name :
Hand in Date :
Tutorial No. :
Group No. :
Group Leader :
TABLE OF CONTENTS
Content 3
STORYBOARD 3
LOGIN 3
PROFILE UPDATE 4
RECEPTIONIST 6
TECHNICIAN 17
CUSTOMER 23
Use-Case Diagram 36
Class Diagram 37
Explanation of codes 39
Receptionist 39
Class user 40
Method login 41
Method prof 43
Method updateProfile 43
Method getNewID 44
Method addUser 44
Method searchCust 45
Method getRole 46
Class request 47
Method addRequest 47
Method getNewID 48
Method getPA 49
Method disCustHis 51
Method getRD 52
Method acceptPay 53
Technician 53
Class Request1 54
Method disCustReq 54
Method updateRequest 55
Customer 57
Class Customer 58
Method disCustTrade 60
Method updateRequest 61
Admin 63
Class employee 63
Method getNewID 65
Method clear 66
Method addEmployee 66
Test Plan and test cases 68
Conclusion 71
References 71
Workload Matrix 72
1. Content
a. STORYBOARD
LOGIN
Label 3 Label3
PROFILE UPDATE
Label 2 Label 2
Label 4 Label 4
Label 5 Label 5
Label 6 Label 6
Label 7 Label 7
Label 8 Label 8
Label 9 Label 9
Label 10 Label 10
Label 13 lblIden
Label 14 lblGender
Label 15 lblDOB
RECEPTIONIST
Label 2 Label 2
Label 4 Label 4
Label 5 Label 5
Label 6 Label 6
Label 7 Label 7
Label 8 Label 8
Label 9 Label 9
Label 2 Label 2
Label 4 Label 4
Label 5 Label 5
Label 6 Label 6
Label 2 Label 2
Label 2 Label 2
Label 2 Label 2
Label 4 Label 4
Label 5 Label 5
Label 6 Label 6
Label 7 Label 7
Label 8 Label 8
Label 9 Label 9
Label 10 Label 10
Label 11 Label 11
Label 12 Label 12
Label 13 Label 13
Label 16 lblCustID
Label 17 lblEmail
Label 18 lblTel
Label 19 lblDescript
Label 20 lblOdrDate
Label 21 lblPayAmount
Label 22 lblCollectDate
Label 23 lblPayStatus
TECHNICIAN
Label 2 Label 2
Label 2 Label 2
Label 4 Label 4
Label 5 Label 5
Label 6 Label 6
Label 7 Label 7
Label 8 Label 8
Label 9 Label 9
Label 10 Label 10
Label 11 Label 11
Label 12 Label 12
Label 13 Label 13
Label 16 lblCustID
Label 17 lblEmail
Label 18 lblTel
Label 19 lblService
Label 20 lblOdrDate
Label 21 lblPayAmount
Label 22 lblPayStatus
description
CUSTOMER
Label 2 Label 2
Label 2 Label 2
Label 4 Label 4
Label 5 Label 5
Label 6 Label 6
Label 7 Label 7
Label 8 Label 8
Label 9 Label 9
Label 10 Label 10
Label 11 Label 11
Label 12 Label 12
Label 13 Label 13
Label 16 lblCustID
Label 17 lblEmail
Label 18 lblTel
Label 19 lblDescript
Label 20 lblOdrDate
Label 21 lblPayAmount
Label 22 lblCollectDate
Label 23 lblPayStatus
ADMIN
Label 2 Label 2
Label 4 Label 4
Label 5 Label 5
Label 6 Label 6
Label 7 Label 7
Label 8 Label 8
Label 9 Label 9
Label 10 Label 10
Label 11 Label 11
Label 2 Label 2
Label 4 Label 4
Label 5 Label 5
Use-Case Diagram
Class Diagram
Employee
private int userID;
private string password;
private string name;
private string role;
private bool gender;
private string tel;
private string email;
private string address;
private string dob;
private int newID;
Customer
private int receiptID
private int userID
private string service
private string urgency
private int payAmount
public Customer()
public Customer(int uid)
public Customer(int uid,int rid)
public DataTable disCustTrade()
public string updateRequest(string x, string y, int z)
request1
private int receiptID
public request1()
public request1(int uid,int rid)
public DataTable disCustReq()
public string updateRequest(string x, string y)
request
private int receiptID;
private int custID;
private string service;
private string urgency;
private string description;
private string orderDate;
private string collectionDate;
private int payAmount;
private string payStatus;
private int newID;
private int serviceNo;
private int urgencyNo;
private string custName;
private string tel;
private string email;
public request(int ID, string sv, int pa, string od, string ugc)
public request()
public request(int sn, int un)
public request(int ID)
public string addRequest()
public static void getNewID(request o2)
public int getPA()
public DataTable disCustHis()
public static void getRD(request o1)
public string accpectPay()
user
Explanation of codes
Receptionist
For the Login and profile update function as well as those function for receptionist. I had
created and utilize 2 classes, which are user and request. There are also countless method and
object used for these functions to fully work.
Class user
Figure 1.0.0
From the figure 1.0.0 above, we are able to see all variable used in the class had been
with the suitable data type. SQL Connection string of CS has been called by object ‘con’ and
made static, so all method in class are able to access to it. Some variable has used the ‘get’ and
‘set’ to get the variable value and set it to the parameter accordingly as public in order for the
accessibility from forms used since all the variable were declared in private where they can be
only accessible within class.
Figure 1.0.1
In figure 1.0.1, there are 3 constructors for the class user. The first one takes in 2
arguments with their data type, which is (int x, string y) to set them as userID and password. The
second one takes in an argument of (int x) and set it as userID. Lastly, the third constructor takes
in 8 arguments of (string nm, string pass, string rl, bool gen, string date, string num, string em,
string adrs) and set those accordingly.
Method login
Figure 1.1.0
Figure 1.1.1
Figure 1.1.2
The method used for user login. In figure 1.1.0, object obj1 was created for class user and
value of ID and password input from user were passed, then obj1 called method login in class
user and the value returned from the method was set to ‘stat’. In figure 1.1.1, the constructor was
used by obj1 to set value receive to the variable userID and password. In figure 1.1.2, ‘status’
was declared with string and default value of null. Connection string of ‘con’ was open and
object ‘cmd’ used to get the count of all data in table users where the userID and password were
same with what the user entered. If there was data that fulfil the conditions, object ‘cmd2’ will be
used to get the role of the user then defined which menu they will be navigated to. Else if there
was no data of user that meets the conditions, the status will be set to "Incorrect
userID/password". After the if else, the connection was closed and value of status was returned.
Method prof
Figure 1.2.0
Figure 1.2.1
Figure 1.2.2
The method used to get the current profile of user to be display. In figure 1.2.0, object
‘o1’ was created for class user and value of userID were passed then method prof was called and
passing the object ‘o1’. In figure 1.2.1, the value received was set to userID in class. In figure
1.2.2, the connection of ‘con’ was open and close at the beginning and ending of codes. Object
‘cmd’ used to get all the data from table users where userID = the userID object ‘o1’ had. These
data were then read by sql data reader ‘rd’ and set to the relevant variable in object ‘o1’ in order
to be use in form.
Method updateProfile
Figure 1.3.0
Figure 1.3.1
The method was used to update user profile. In figure 1.3.0, object ‘o1’ was created for
class user and value of userID was passed then o1 called the method updateProfile while passing
the new telephone numbers, email and address. The value returned by method updateProfile was
show in a message box. In figure 1.3.1, status was declared, values receive were set to tel, email
and address. Connection string ‘con’ was open and close in the begining and ending of codes. Sql
command ‘cmd’ has updated the data in table users by setting the tel, email and address to the
new ones where the data’s userID is the currently used account’s userID. Update process was
checked and set the status to successful or unable accordingly. Status was returned.
Method getNewID
Figure 1.4.0
Figure 1.4.1
The method was used to get the new user ID. In figure 1.4.0, object ‘o2’ was created for
class user and value userID was passed then method getNewID was called and passing the object
‘o2’. In figure 1.4.1, ‘cmd’ get the max userID in table users. The value get from ‘cmd’ was
added by 1 and the result value was set to newID in object ‘o2’.
Method addUser
Figure 1.5.0
Figure 1.5.1
Figure 1.5.2
The method was used to add new user to the database. In figure 1.5.0, object ‘obj1’
created for class user passing name, password, role, gender, date of birth, telephone, email,
address of new user then obj1 called method addUser and value returned by the method was
display in a message box. In figure 1.5.1, the constructor set the value it receives to the related
variables to be use in class. In figure 1.5.2, status was declared, ‘cmd’ insert the data of new user
into table users accordingly. Changes of database was checked to notice user that the new user
was added successfully or not by setting related value to status and return it.
Method searchCust
Figure 1.6.0
Figure 1.6.1
The method was used to search the existence of customer. In figure 1.6.0, obj1 created for
class user passing the ID searched. Returned value from the call of method searchCust by obj1
was set to stat. In figure 1.6.1, status was declared with default value of null. ‘cmd’ get the count
of data from table users where userID = the ID searched and the role of user searched is
customer. If there is no data that fulfil the conditions, the status will be set to ‘ID searched do not
exist or ID searched not customer.’ After if, status was returned.
Method getRole
Figure 1.7.0
Figure 1.7.1
The method was used to define the user’s role. In figure 1.7.0, o1 was created for class
user passing userID. ‘role’ was declared and set to the value returned by method getRole that call
by o1. In figure 1.7.1, ‘cmd’ get the role from table users where userID = the current user’s
userID. The result get from ‘cmd’ was set to role and returned.
Class request
Figure 1.8.0
Figure 1.8.0 does about the same with figure 1.0.0 in Class user.
Method addRequest
Figure 1.9.0
Figure 1.9.1
Figure 1.9.2
The method was used by receptionist to add new request. In figure 1.9.0, object ‘obj2’
was created for class request and value of the details for new request were passed to class
request, such as customer ID, service chosen, urgency of service, order date as well as total
payment amount. In figure 1.9.1, constructor was assigning the value it receives to related
variables. In figure 1.9.2, sql command ‘cmd2’ get the role of the customer from table users
where userID = customer ID entered by receptionist. If the role retrieve is not ‘customer’ status
will be set and return to notice receptionist that the id entered is not a customer. If the role is
customer, ‘cmd’ will insert the details of the new request into table request accordingly. After
inserting new request, changes of table will be checked and status will be set and return to notice
the receptionist that it was a successful registration or not.
Method getNewID
Figure 1.10.0
Figure 1.10.1
The method was used to get new receipt id. In figure 1.10.0, the class request was called
by object ‘o2’ then the method getNewID in class request was called and passing the o2. In
figure 1.10.1, ‘cmd’ get the max receiptID from table request. The result got by cmd was then try
to added by 1 and set to newID for object ‘o2’. If any error happened during trying, the newID
for o2 will be set to 1.
Method getPA
Figure 1.11.0
Figure 1.11.1
Figure 1.11.2
Figure 1.11.3
The method was used to get the total payment amount. In figure 1.11.0, object
‘obj1’created for class request and passed the representation number for service and urgency.
Object obj1 called method getPA in class request, and the value returned was then set to variable
pa. In figure 1.11.1, constructor set the value receives accordingly. In figure 1.11.2 and figure
1.11.3, there are usage of if else to determine the payment amount, then set and returned as pa. If
there are no payment amount base on the representation number of service and urgency, the pa
will be set as -1 and returned.
Method disCustHis
Figure 1.12.0
Figure 1.12.1
The method was used to get customer’s request data and form a data table with those
data. In figure 1.12.0, object ‘o1’ created for class request and value of customer ID was passed
then what returned from the call of method disCustHis by o1 was set to be the data source for
data grid view of ‘dgv1’. In figure 1.12.1, sql data adapter ‘da’ get all the data from table request
where the custID= the customer ID while in the descending order base on payStatus. Data table
‘custHis’ created and fill by sql data adapter ‘da’then the custHis was returned.
Method getRD
Figure 1.13.0
Figure 1.13.1
The method was used to get the request details of specific request. In figure 1.13.0, o1
created for class request and value of receiptID was pass then the method getRD was called
passing o1. In figure 1.13.1, ‘cmd’ get the data of customer ID, service chosen, urgency chosen,
description of request, order date, collection date, payment amount and payment status from data
table request where the receiptID = the receipt ID received by class constructor. The data got
from cmd was then read and set to related variables for object o1 accordingly by using sql data
reader ‘rd’, in order that those value can be access by forms. ‘Cmd2’ will be used to get data of
customer name, telephone number and email from table users where userID = customer ID get
from ‘cmd’. The data got from cmd2 will go through the same process with cmd but instead of
sql data reader ‘rd’, this time will be using ‘rd2’.
Method acceptPay
Figure 1.14.0
Figure 1.14.1
The method was used to accept payment from customer and update the payment status of
request to ‘Completed’ by receptionist. In figure 1.14.0, object o2 create for class request passing
value of receiptID then o2 called the method acceptpay from class request and what returned was
display in a message box. In figure 1.14.1, sql command ‘cmd’ used to update data table request
by setting payStatus to ‘Completed’ where receiptID = what receiptID it received. The changes
were checked and status was set and returned accordingly to notice user that the update is
successful or not.
Technician
In the technician part, I have created and used 2 classes which are named request and
request1. Since the request class is also used in the receptionist, therefore I will not explain the
class request again since the request class has been explained in the receptionist. Hence, the
explanation of class request can be referred back in the receptionist part. In class request1,
Multiple methods and objects are used so the function in request1 can work smoothly. The
images below are the codes of class request1.
Class Request1
Figure 2.0.0
Figure 2.0.1
1 constructor has been made in figure 2.0.1. Constructors are made to initialise the class's
private fields during the instance creation process. The constructor that is made is named as
request1. This constructor takes in 2 arguments with their data type, which is (int uid, string rid)
to set them as userID and receiptID. The initial value of uid is userID while the initial value of
rid is receiptID.
Method disCustReq
Figure 2.1.0
Figure 2.1.1
A method has been created and it is named as disCustReq. This method is used to request
data of the customers’ request so a data table with those data can be formed. In figure 2.2.0,
object ‘o1’ was created for class request but no values have been passed in the constructor named
as request1. This constructor does not pass any parameter and it is named as a parameterless
constructor which will be triggered whenever an object is created using the new operator without
any parameters. After that, everything that is returned from the call of method disCustReq by o1
was set to be the data source for the data grid view that is named ‘ServiceList’.
In figure 2.1.1, the Connection string ‘con’ was open and close in the beginning and
ending of codes. After that, SqlDataAdapter ‘da’ serve as a link between the database and
dataset by being used to get data from table request where the payStatus is ‘Incomplete’ and in
descending order based on urgency. After getting the data from the table request, a data table
named as ‘custReq’ will be created and the SqlDataAdapter ‘da’ will fill the data table by using
the data provided by DataTable custReq. Finally, after connection string ‘con’ is closed, custReq
is returned.
Method updateRequest
Figure 2.2.0
Figure 2.2.1
A method has been created and it is named as updateRequest. This method is used to
update the description and collection Date of the customer request. In figure 2.2.0, object ‘o1’
was created for class request1 and the value of userID, and receiptID were passed. After that, stat
was set to o1 to call the method updateRequest when passing the new description and collection
date a. A message box will be shown when the values are returned.
In figure 2.2.1, the status will be declared as a string. After that, the values received will
be set to description and collectionDate. Connection string ‘con’ was opened and closed in the
start and end of the codes. Other than that, a Sql command named ‘cmd’ has updated the data in
table request by using the new description and collection date to replace the previous data. The
update process will be checked and the status will be changed to ‘update successfully’ if the
update process works. If the update process failed, the status will be changed to ‘Unable to
update’. Finally, the status was returned.
Customer
For the customer part, I have created and used 2 classes which are “request” and
Asia Pacific University
60
“Customer”. Since the request class has utilized in the receptionist, therefore I will not be
explaining about the request class again since request class has already been explained in
receptionist. Methods as well as objects have been used.
Class Customer
Figure 3.0
Referring to figure 3.0 we are able to see all of the variables such as receiptID, userID,
service, urgency and payAmount have been used in the class with the appropriate data type
which consists of int and string. Not only that, Connection string of CS is known to be called by
object ‘con’ as well as it is made static which then makes it possible for all the method in class to
be able to access it.
Figure 3.0.1
Referring to figure 3.0.1 we are able to see that there are two constructors for the class
Customer. The first constructor is known to take in 1 argument with its data type that is (int uid)
in order to set it as userID. On the other hand, the second constructor is known to take in 2
arguments with its data type that is (int uid,int rid) in order to set them as userID as well as
receiptID.
Method disCustTrade
Figure 3.1.0
Figure 3.1.1
A method has been created and it is named as disCustTrade. This method has been used
in order to show the data of the requests in the dataGridView table. In figure 3.1.0, object ‘f1’
was created for class Customer and userID value has been passed in the constructor named as
Customer. After that, whatever returned from the call of method disCustTrade by f1 was set to be
the data source for data grid view of ‘dgv1’
In figure 3.1.1, we are able to see that the Connection string ‘con’ was open and close in
the starting and ending of codes. After that, SqlDataAdapter ‘da’ serve as a link between the
database and dataset by being used to get data from table request where the custID = the current
user’s userID. After getting the data from table request, DataTable named as ‘custTrade’ will
create a new data table. Data table ‘custTrade’ created and SqlDataAdapter ‘da’ will fill the rows
by using the data which has been provided by DataTable custTrade. Finally, after connection
string ‘con’ is closed, custTrade is returned.
Method updateRequest
Figure 3.2.0
Figure 3.2.1
The updateRequest method was used in order to update the service, urgency as well as
payAmount. As shown in figure 3.2.0 an object ‘o1’ was created for class Customer as well as
the value of the userID and receiptID was passed. We can also see that a variable named stat has
been created as a string data type. Then, cbService.Text as well as 2 variables which are urgency
and fee are passed to the updateRequest method where the updateRequest method will then
return the value and store it into stat. The message box displays the value returned by the
updateRequest method which is known to be stored in stat.
Figure 3.2.1 shows that the status has been declared as a string. The values which were
received are then set to service, urgency and payAmount. As we are able to see that the
Connection string ‘con’ was open and close in the starting and ending of codes. Other than that,
as we are able to see that a Sql command known as ‘cmd’ has updated the data in table request
by using the new service, urgency as well as payAmount to replace the previous data where the
the data’s receiptID belongs to the currently used account’s receiptID. The update process will be
checked and the status will be changed to ‘Update successfully’ if the update process works. On
the other hand, If the update process fails then the status will be changed to ‘Unable to update’.
The status was returned at the end.
Admin
For the admin part, I have created 1 class which is named “employee”. In this class, I
have used multiple methods and objects.
Class employee
Figure 4.0.0
From the diagram above, we can clearly see the class name, which is “employee”, the
variable which I have declared with different data types such as int, string and bool and private
access specifier is used which can only be used in this class only. Besides, I have also created an
object “con”, which is used to connect to the database “CS”.
Figure 4.0.1
In figure 4.0.1, I have declared all variables with their data types and set it to public. I
have also used “get” and “set” methods so it can updates the values of the private field which I
explained in figure 4.0.0.
Figure 4.0.2
In the diagram above, I have created 3 constructors and their arguments accordingly. The
constructors will run when the class is created. It can help us to set initial values. All constructors
are using the same name as the class which is “employee” and have no return type. The first
constructor takes 2 arguments (int x, string y), where I set the initial value for x as userID and y
as password. The second constructor takes only 1 argument which is (int x), I have also set its
initial values as userID. The third constructor takes a total of 8 arguments with their data types
and I have set their initial values accordingly.
Method getNewID
Figure 4.1.0
Figure 4.1.1
From the figure 4.1.0 above, that is a method that I have created to get a new ID for my
employee when I register a new employee. The method is named as “getNewID” and I have also
created an object which is named as “o2”. The object will call the employee class to get a new
ID. In figure 4.1.1, connection string “con” used open methods, which is used to connect to the
database. Then, object “cmd” was created to select the max userID from the database column
“users”. Next, the object o2 will call the ExecuteScalar method to execute the query and select
the first column of the first row and add 1 to it to get a new ID which will be returned as a string
data type. Then, the close method was called by object “con” to close the connection to the
database.
Method clear
Figure 4.2.0
From the diagram above, a clear method was created to clear all the textbox, date time
picker and radio button from the form. Void keyword is also being used, it is used to specify that
this method does not return any value and has no arguments needed.
Method addEmployee
Figure 4.3.0
In the diagram above, method addEmployee was created to save employee details to the
database which has an access specifier, public. The keyword public ensures that it can be
accessed by outside or global. I have also set the data type for this method which is string data
type. I will first declare a variable which is “status” and its data type, string. Then, the object
“con” will call the open() functions to get a connection with the database. Object “cmd” would
be called out to insert values into table users with column name, name, password, role, gender,
date of birth, telephone number, email and address. Then, the object “cmd” will execute insert
into statement where it will write the values into the database. Since I am using insert into
statement, I would need to use the ExecuteNonQuery method as well which is used for executing
query data that does not return any values. In order to know that I have successfully registered a
new employee, I write a number value, i. If it is successful, it will return 1 and will show with a
message box “Registration Successful”, else it will show “Unable to register”. Lastly, the object
“con” will then call the close function to close the connection with the database and then return
the status.
Able to login
User able to
with an
login to their
existing As an
own account
1. Login account and
and access to
expected None
navigate to result.
their role-
role-related
related menu
menu
To check if it
shows User is able
encrypted to show the
As an
password encrypted
2. Show Password
when the password
expected None
result.
checkbox is after ticking
checked or the checkbox.
else it hides
Receptionist
User should As an
is able to add
3. Add Customer be able to add
new
expected None
new customer result.
customer.
Admin is able
to add new
User should employee As an
4. Add Employee be able to add with either expected None
employee Technician or result.
Receptionist
as the role.
Receptionist
User should is able to add As an
5. Add Request be able to add new request expected None
request from the result.
customer.
Customer is
Able to able to
As an
change change his
8. Change Request
existing incomplete
expected None
result.
request request to a
new request.
Receptionist
Able to view
is able to
the existing
view existing As an
View Customer customer
9. Trading History trading
customer expected None
trading result.
activity
activity
history
history.
Receptionist,
Technician
Able to view
and customer As an
the details of
10. View Request Detail
the existing
can view the expected None
details of the result.
request
existing
request.
Receptionist
Able to is able to As an
11. Generate Receipt generate a generate expected None
receipt receipt for his result.
customer.
Receptionist
is able to
accept
Able to As an
payment and
13. Accept Payment accept the
update the
expected None
payment result.
payment
status for the
request.
Able to Technician is
update the able to update
description description As an
Update Description
14. and Collection Date
and collection and collection expected None
date for an date of the result.
existing selected
request request.
Receptionist
Able to
is able to
search for a
search for a As an
Search Customer specific or
15. Request every
specific or expected None
every result.
customer
customer
request
request.
2. Conclusion
In conclusion, the programme that we have designed for the laptop service management
has come out to be a success. The programme that was designed is fully functional and very
user-friendly, but not all functions have effective coding as we have a limited amount of
knowledge as well as the interface design is not as visually attractive as what we have in the
current market. Moreover, The security level for the data is not sufficient to be used as a real
business management system, as it has many vulnerabilities from the cybersecurity point of
view.
In our opinion, in order to improve the management system, the interface design should
be improved in terms of visual attractiveness by applying proper designing knowledge which has
been obtained by us. We should also emphasize on learning more system developing modules
and skills, as well as putting extra attention on which system developing tool is booming in the
current market. The security can also be greatly enhanced with the implementation of more
useful and currently used security protocols.
3. References
a. datagridview cell click event c#, Get Selected Row Values From
DataGridView Into TextBox. (2018). Www.youtube.com.
https://www.youtube.com/watch?v=V4IQQt5PIxo
b. 6: How To Create Classes And Objects In C# | C# Tutorial For Beginners | C
Sharp Tutorial. (2018). Www.youtube.com.
https://www.youtube.com/watch?v=t2SPg6IuT3k&start=28
c. winforms search filter records from date and to date c#4.6. (2018).
Www.youtube.com. https://www.youtube.com/watch?
v=i2oj3WMw4fE&t=626s&ab_channel=HarithaComputers%26Technology
4. Workload Matrix
Completion
No. Assigned Task & Brief Description Assigned Member Name Status /
Comment
Login
Profile Update
1. Receptionist Completed
Documentation
Storyboard details
Admin
2. Documentation Completed
Storyboard details
Technician
Design and Draw Storyboard
3. Completed
Storyboard details
Documentation
Customer
4. Storyboard details Completed
Documentation