You are on page 1of 77

EVENT

MANAGEMENT
5/27/2020

SYSTEM
XXXXX XXXXX - XXXXXXX
XXXXX XXXXX - XXXXXXX
XXXXX XXXXX - XXXXXXX
XXXXX XXXXX - XXXXXXX

GROUP NAME: THE MAKERS


UNIVERSITY OF BEDFORDSHIRE
Contents
Introduction...........................................................................................................................................2
Project Definition (Task Description).....................................................................................................2
REQUIREMENT ANALYSIS......................................................................................................................2
System Design.......................................................................................................................................3
Use Case Diagram..............................................................................................................................3
Database Design................................................................................................................................4
Implementation.....................................................................................................................................5
Event Management System...................................................................................................................6
Tests (Administrator).............................................................................................................................6
Login..................................................................................................................................................6
Events................................................................................................................................................7
Bookings............................................................................................................................................8
Requests............................................................................................................................................8
Students............................................................................................................................................9
Logout..............................................................................................................................................10
Tests (students)...............................................................................................................................10
Register............................................................................................................................................10
Login In............................................................................................................................................10
View Event.......................................................................................................................................14
Update Event...................................................................................................................................14
Delete Event....................................................................................................................................14
Booking Event..................................................................................................................................15
Settings............................................................................................................................................15
Profile..............................................................................................................................................16
Discussion / Reflection........................................................................................................................16
List of Group Members........................................................................................................................18
Conclusion...........................................................................................................................................18
Appendix.............................................................................................................................................18

1
Introduction
This report aims to document the development process of the project, Event Management
System. In this project, we expected to implement a Graphical Users Interface and also the
use of JDBC. It seeks to discuss the various basic stages of the development of the system.
The group was given a task to design the project with the brief information and Use Case
diagram provided, to have a clear vision of what the system should be doing. Initial
assumptions were made first by the group members before carrying out the task. 
As a group, we agreed and concluded to use JavaFX which is a software that aids the
programmer and the developers create, test and execute applications. JavaFX is a graphic and
media package use in creating GUIs.
JavaFX has some benefits that’s why we as a group decided to use it to implement our GUIs
and one of the benefits is that it makes use of less code, makes the code readable and makes it
short and simple when creating GUIs. It’s engrossing to learn when it’s something new and
because it’s short and simple. It is more attractive and more presentable.

Project Definition (Task Description)


As required in the assignment brief, a project idea is to contribute to the creation of a Java
Desktop application to manage student-led activities at the university/school. The project is
an Event Management System that allows students to register on the system, once registered
they can book and post events (given they have permission to do so). To register, they
required to provide their name and student ID. Once registered they need to login to use the
system. The Administrator manages and monitors the whole actions going on the system and
is responsible for permitting a student to post events.

REQUIREMENT ANALYSIS
The requirement analysis for the project is as follows:
 UML/Use Case Diagram
 Database 
 Graphical Users Interface
 Implementation of the key functions given
 
 
 
System Design
Use Case Diagram 
The use case diagram was given as part of the assignment brief and it was made to show a
core functionality of the program. The use case diagram was used to show the relationship
between the student (who can also be an Event Organiser if an Organisation Right is been
granted by the Administrator )and the administrator, in other words, it’s the relationship
between three actors which are the students, the event organiser and the Administrator. Use
case diagrams were used to analyse and view the endpoint or the outcome of the system.
The use case diagram below shows that a Students can log in, Register, Re-set Password,
Book Event, View Profile, View Events, View own Booking, Cancel Booking, and Logout,
likewise the Event Organiser but with the inclusion to Post Event, View Own Event, Edit
Event and to Cancel Event while the Administrator Grants Organisers Rights, Revoke
Organisers Rights and is in charge of the system and monitors and controls the actions of the

2
Students and the Event organisers and all that happens in the system to ensure the smooth and
excellent running of the system.
Fig1.0

Database Design
The database that was used to execute the Event Management System is PHP My Admin
(MY SQL). With the Use Case diagram, we were able to deduce four (4) tables in the
database which are as follows: Student, Administrator, Bookings and Events. 
According to the task given, a student can book an event from different Event organisers and
each event has a limited number of spaces provided by the event organisers. Available space
will be shown to the student when booking if they all have not been booked. if an Event is to
be joined online the Event organiser will also provide the URL for the event. A student can
book an event, view all events, view own bookings, cancel bookings. 
In the student table student ID is the primary key, but it is the foreign key in every other
table. In the event table, the event ID is the primary key, but it is the foreign key in every
other table. In the booking table, booking ID is the primary key, but foreign key in other
tables. According to the Entity-Relationship Diagram (ERD), the relationship between the
tables, we can say that student can book many events, many events have one student.
Fig1.1

3
Implementation
As a group, we looked at the project description individually and pointed out our opinions
and views of what the project description is talking about. Everyone’s view was discussed,
and various assumptions were made on how to accomplish and create an excellent project
with the help of the Use Case Diagram which was also provided. Having considered our
assumptions and individual opinions, as a team we decided to use a week in making
researches and gathering resources, as well as solutions to some of the pointed out problems
or what we saw that might be a problem and big difficulty towards the progress and success
of our project and on how we might be able to carry out these features with the inclusion of
determining what data may be needed to support the functionality in each case. We sketched
manually with pen and paper the database and made some corrections on it to get a good but
simple table needed before developing an appropriate database to store all the needed Event
Management System information and to retrieve it once needed for operations and
communication. We created the requested GUI-driven system that holds and handles
appropriate requests.
Regarding our research, we studied using programming resources of Java language such as
JDBC, JavaFX and so on. We created GUIs for all the forms we need to use within the
system as the user interface. We assumed and considered having two different users but
appears to be three, which are: Administrator and Students who can also be an Event
Organiser only when the Organisation right is been granted by the Administrator. Our
database was created using our database design and SQL skills.
We had a meeting which all the team members concurred to work closely together with full
determination and to share ideas on what needs to be done on the project. The task was
allocated to each member of the group. Because the Use case diagram has been provided as

4
part of the task description, we decided that we will start the project by designing the
database together and this was done through a conference video(Skype) where we see each
other and share our screens so that we can see what each person is doing. After the database
has been created the group leader asked for the opinion of the team and wanted to know what
each person wants to do because we were all at the same pace and we were not familiar with
programming languages and with the little knowledge we gathered from the lectures, we
decided to split the coding among us so that everyone will partake in the coding and help
each other when next we meet on our conference call. The remaining group member will
handle every aspect of the group report.

Event Management System

Tests (Administrator)

Login
Figure1.2 below is showing you the Administrator logging with the incorrect credentials.

Fig1.2 Fig 1.3

Figure1.3 shows the Administrator logging in with the accurate credentials, which grants admittance
into the application.

Once Administrator has been granted admittance into the application, it opens the screenshot
below. fig1.4

5
Zoom in for a vibrant view

Events
The screenshot below is showing you all the possible events which have been created by the event
organizers. The Administrator can view all the events and cancel whichever event needs cancelling.

F1g1.5

Administrator cancel an event by hovering around the table and selecting what event would
like to be cancelled.
Fig1.6

6
Bookings
The screenshot below is showing all the Bookings which have been booked by the event
organizers and the students. The Administrator can view all the bookings and cancel
whichever event has been booked. (see fig 1.7)
Fig1.7 fig1.8

The Administrator can cancel the booked event by selecting what event has been booked and then
clicks on the cancel booking button. See fig 1.8

Requests
The screenshot below is showing you all the students who have requested for Organisation
Rights. The Administrator can view all students who has requested and choses to delete the
request. (see fig1.9, zoom in for vibrant view)

7
Fig1.9 fig 2.0

The Administrator can delete requests by selecting on the students it wants to delete and
then clicking on the Delete Request button to delete the request.

Students
The screenshot below is showing the Administrator all the student’s information from their
Student ID, First Name, Last Name and if they have been granted Organization Rights. But,
most of all it checks to verify what student is granted with Organisation Rights. If not
granted, then the Admin can either Grant Rights or Revoke the Rights given to the student.
(see fig2.1)

Fig 2.1 fig2.2

For the Administrator to Grant Organisation Right, it must select from the tables and verify if
the student doesn’t have rights and grants it. But, only once the student has requested to
have Organisation rights. Then, the Amin can check from the student ID and Grant Rights.
(see fig 2.2, Zoom in for vibrant view)
The Administrator can Revoke the Rights of the student who has been granted with
Organisation Rights by selecting on the Student ID and revoking the rights given . (see fig2.3)

8
Fig2.3

Zoom in for vibrant view

Logout
Administrator can logout of the application by clicking the logout button. And, once it’s clicked it will
direct you to the login page. (see 2.4)

Fig2.4

Tests (students)
Register
A student must register before they can be granted access into the Event Management
System. (see 2.5). Zoom in for clear view.

Fig 2.5 fig 2.6

Student gets notified once registration is successful. (see fig 2.6, Zoom in for clear view)

Login In
The screenshot below showcases the Login In page which the database recognises the
student ID and password as the field demands the input of Correct details which will grant a
student access into the application (see fig 2.7) Zoom in for clear view.

9
Fig 2.7 fig 2.8

Ac
cess into the application will be denied if the user inputs Incorrect details . (see fig 2.8)

Forget Password
If there be any case students forget their password, they can reset it in Forget Password
page by clicking on the hyperlink “Forgot Password” beneath the Login button which opens
forget password pane with heading inscription, Trouble logging in? (see fig 2.9)
Fig 2.9 fig 3.0

The page then requests students to input their “Student ID, New Password and Confirm Password”
If the Student ID is in the database, then it recognizes the student and updates their password.
An alert pane then pops up that says, “Password Successfully Changed.” (see fig 3.0)

Home (See All Events)

10
Once logged In, it opens the screenshot below. This page presents to the students the events which
has been created by the event organisers. The registered users are able to view and book events.
(see fig 3.1)

Fig 3.1

Manage Event
The Event management pane Shows activated to students who has been granted an organisational
rights by the administrator. This pane shows as an organizer workspace to “Add Event, View Event,
Update Event and Delete Event.” (See fig3.2)

Fig 3.2

Add Event
As an organizer, to add any event requires Text fields such as “Event Title, Description, Date, Time,
No. Of Space, URL (that is, if it is an online event), Organisation, Location (that is, if the event is
external), Campus, Room No. (that is if the event is held on the university campus)” to input an
event into the database system. Refusal of any of the information input will print out an error
message “All fields are required” (see fig 3.3)

11
Fig 3.3(zoom in for clear view)

With the exception of the Radio button options which if the Online Event is selected, activates only
the URL text field and deactivates the External visit’s Organisation and Location Text field.
The Same validation assignments are also given to the External Visit radio button and Internal Event
radio button to activate the text fields on each of its row when selected and deactivates when not
selected. (see figs 3.4, 3.5, 3.6)

Fig 3.4

Fig 3.5

Fig 3.6

If all field requirement is met, an alert pane pops up “Event added successfully”
Which then adds up your event to the Events Pane where your event can be seen by all students to
be booked. (see figs 3.7 and 3.8)
Fig 3.7 Fig3.8

12
View Event
In the view event page, the event organizer can view all event created. (see fig3.9)

Fig 3.9

Update Event
Once an event has been added by the organiser and he notices a mistake made or change of
information, the organiser can click back on the View Event button on the Manage Event pane,
select the event to make changes to then click on the Update Event button to update. After the
information has been added or made changes to, an alert box pops up “Event updated successfully.”
(see Figs 4.0 and 4.1)
Fig 4.0 Fig4.1

Delete Event
The event organizer can delete an event by selecting the event from the list and confirming
it by clicking the delete button. (see Fig4.2)
Fig4.2

13
Booking Event
Once a student is interested in an event he can click on the event and see the event description with
the option to complete booking if interested. Once you are no longer satisfied with an event you
book and want to delete it, all the student has to do is select the booked event and click the delete
button. (see Figs4.3, 4.4 and 4.5, zoom in for clear view)
Fig4.3 Fig4.4

Fig 4.5

Settings
The student uses this page to request for organization rights from the Administrator. (see fig
4.6)
Fig 4.6 Fig 4.7

14
Once the Organisation Right is granted by the administrator the student gets notified that the
request was successful and automatically becomes an Event Organiser. (see fig 4.7)

Profile
Students are able to view their individual profile as well as check if they have been granted with
organization rights. (see fig 4.8)
Fig4.8

Discussion / Reflection
Were all required specifications achieved on the assignment?
All the essential stipulations and specifications were all accomplished on this assignment.
Problems Encountered and how we overcame them. 
The Problems we as a group encountered in the assignment lead to some dissimilarity
amongst us. By this, I mean certain individual’s in the group couldn’t put together themselves
to come to a close concerning a particular task that allocated to them because they were not
familiar with java and other programming languages. Whilst, the other individuals were
having difficulties understanding the information we ought to include in the database. This
got to a point where some of us misunderstood each other and everything was not falling into
places like we expected it to be. So, to resolve the matter at hand, the group leader suggested
we all individually explain and specify each of our understanding on what we have to do on
the assignment making it much easier for the other group members to grasp the concept
behind that individual's opinion on it. Also, the other group members who weren’t familiar
with java and other programming languages had to do their research on how java
programming works so that it can give them a glimpse
on what to expect when creating this assignment. After all has been said and done we all were
able to understand ourselves in the end without any problems and everything was running
smoothly.

15
Moreover, due to the current situations in the world which led to the global restrictions and
lockdowns nations we were not able to meet in person and to access some of the school
resources. this led to our meetings on the conference video calls (skype) which sometimes
seems bad because of the poor network and some member will find it difficult to hear. And
meeting our lecturers in person was restricted and made us ask all questions through email
which at times some of the questions needs to talk about for more clarifications other than
texts.
Did you give yourselves enough time to accomplish this work? Was it harder than expected?
What have you learned from tackling this assignment? 
Yes, enough time was given but was harder than what we expected because we were learning
and also gathering resources while working on the project which led to slow progression of
the work.
We learnt how to use JavaFX and Scene Builder which helps in designing the graphics of the
GUI, etc.
Did we work well together? What did we learn about the dynamics of group work?
We all worked extremely well together creating the project. Different team members
contributed dissimilar perspective and standpoints towards the assignment, and the synergy
between team members help produced inventive and creative results.
The dynamics of a group work consists of team members trusting each other and working
towards a collective and cooperative conclusion holding one another accountable for making
things transpire. Working in a group makes learning more pleasurable and resourceful.
Working with other individuals in a group permits you to pool your thoughts/ideas and
understand complications from dissimilar perspectives and viewpoint as well as attempting
responsibilities that could not be proficient by an individual, merging a diversity of skills and
proficiency to challenge more multifaceted and greater scale problems. Furthermore, group
work gives you the chance to study and learn from one another which is what we as a group
have learnt throughout the progression of the assignment.
Did this work enhance our understanding of java programming language? Did it motivate us
to learn more on java and other programming languages?
During the duration of the assignment, we were all forced to leave our comfort zone to
acquire the required knowledge to successfully carry out this task. We all had to enhance our
java and SQL skills to carry out this assignment. It allowed us to learn together through skype
and other platforms due to the pandemic. It motivated us to learn a lot more on java and SQL
even unrequired knowledge to help us in the future.
If you had to undertake this or something similar again would you tackle it differently 
If we had the opportunity to take this again, we wouldn’t change much other than better time
management. Because we tackled the assignment quite decently.
What improvements or enhancement would we recommend for a future iteration of this
project?
In the future, as a team, we could be more understanding of each other as well as being more
attentive and responsible. By this I mean, if you have no idea on a particular task which has
been assigned to you and you don’t know anything about, the best approach would be to ask
for an assistant or in your spare time do you own research on it. This is one of the things we
lacked as a group. Some team members would go on to do their task without asking on how
to undergo the task, Then, when there is a problem, that is when it would be the time, they
need help. So, surely this would be a future improvement which needs to be considered. 

16
List of Group Members
The group comprises of five (5) people. The group members know each other’s strength
when it comes to learning so with that we came together to team together in other to produce
an excellent result.
The names of the team members are;
 
The task was allocated to every one according to what they wanted and what their interest
was but since the Use Case Diagram was given in the task description and everyone was
eager and willing to learn new things about java led to the splitting of the programming part
of the assignment. The team members work closely together and helped each and made sure
that strength is pulled together to help anyone who gets confused stuck with his task.
 
XXXXX was left to design the Administrators page while the XXXXXX was given the task
to design the manage event and home page with the backup and help of XXXXXX who was
also assigned to design the login, logout and forget password page. XXXXXX was given the
role to design the Register, setting and profile page and was backed up and helped by
XXXXXXX who designed the booking page and checks all the validations of the
programming codes.
The whole member pulled in strength to write the report on what they did and sent it to
XXXXXX for the documentation.
 
Conclusion
In this report, we analysed the creation and implementation of the Event Management
System; the designs of a database and graphical user interface (GUI) was accomplished in
this project. There is also an overview of the work done during the project and an explanation
of how the work was done over time and how the challenges were dealt with. This report also
centres on how the project was tackled as a team, as well as the fair allocation of the task
amongst the team members. Working on this project strengthened our skills individually and
as a group. We’ve learned various other programs such as Eclipse and Scene Builder. It gives
us reasons for further work more advantage in the real world when opportunities arise.
 

Appendix
Validation Code
For – AddEventsController

package app.ManageEvents;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

import app.Model.Database;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;

17
import javafx.scene.control.Button;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;

public class AddEventsController implements Initializable


{

@FXML
private AnchorPane acpAddEvents;

@FXML
private Button AddEvent;

@FXML
private TextField txtEventTitle;

@FXML
private TextField txtURL;

@FXML
private DatePicker dtDate;

@FXML
private TextArea txtDescription;

@FXML
private TextField txtTime;

@FXML
private TextField txtNoOfSpace;

@FXML
private RadioButton rbtOnlineEvent;

@FXML
private RadioButton rbtExternalVisit;

@FXML
private RadioButton rbtInternalVisit;

@FXML
private TextField txtOrganisation;

@FXML
private TextField txtLocation;

@FXML
private TextField txtCampus;

@FXML
private TextField txtRoomNo;

@FXML
private Label lblErrorMessage;

18
Database database = new Database();

@Override
public void initialize(URL location, ResourceBundle resources)
{
lblErrorMessage.setText("");
}

@FXML
private void AddEvent(ActionEvent event) throws IOException
{
String title = txtEventTitle.getText();
String description = txtDescription.getText();
String location = txtLocation.getText();
String organisation = txtOrganisation.getText();
String url = txtURL.getText();
String campus = txtCampus.getText();
String roomNo = txtRoomNo.getText();
String time = txtTime.getText();
String noOfSpace = txtNoOfSpace.getText();

// if text boxes are empty


if(title.isEmpty() || description.isEmpty() || time.isEmpty()
|| noOfSpace.isEmpty())
{
lblErrorMessage.setText("All fields are required");
return; // kicks you out of the method
}

// date must not be empty


String date;
try
{
date = dtDate.getValue().toString();
}
catch (Exception e) {
lblErrorMessage.setText("Date required");
return; // kicks you out of the method
}

// no of space must be a number


int totalNoOfSpace = 0;
try
{
totalNoOfSpace = Integer.parseInt(noOfSpace);
}
catch (NumberFormatException ex) {
lblErrorMessage.setText("Number of space must be a number");
return; // kicks you out of the method
}

// url, organization, location, campus and roomNo text box must


not be empty
if(url.isEmpty() && organisation.isEmpty() &&
location.isEmpty()
&& campus.isEmpty() && roomNo.isEmpty())
{

19
lblErrorMessage.setText("Select either an Online,
External or Internal Event");
return; // kicks you out of the method
}

// -------------- all validations above has been fulfilled


------------

int noOfSpaceAvailable = totalNoOfSpace;


int studentId = Database.STUDENTID;

// clear error message


lblErrorMessage.setText("");

// add details to database


database.onAddEvent(title, description, location, organisation,
url, campus, roomNo, time, date, totalNoOfSpace, noOfSpaceAvailable,
studentId);

// confirmation message box


Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Event Managemet System - UOB");
alert.setContentText("Event added successfully.");
alert.setHeaderText(null);
alert.showAndWait();

// go to View Events page


AnchorPane pane =
FXMLLoader.load(getClass().getResource("ViewEvents.fxml"));
acpAddEvents.getChildren().setAll(pane);
}

// ----- radio box validation ------


@FXML
private void radioButtonOnSelect(ActionEvent event)
{
// online event radio button
if(rbtOnlineEvent.isSelected())
{
txtURL.setEditable(true);

txtOrganisation.setText("");
txtOrganisation.setEditable(false);

txtLocation.setText("");
txtLocation.setEditable(false);

txtCampus.setText("");
txtCampus.setEditable(false);

txtRoomNo.setText("");
txtRoomNo.setEditable(false);
}

// external event radio button


if(rbtExternalVisit.isSelected())

20
{
txtOrganisation.setEditable(true);
txtLocation.setEditable(true);

txtURL.setText("");
txtURL.setEditable(false);

txtCampus.setText("");
txtCampus.setEditable(false);

txtRoomNo.setText("");
txtRoomNo.setEditable(false);
}

// external event radio button


if(rbtInternalVisit.isSelected())
{
txtCampus.setEditable(true);
txtRoomNo.setEditable(true);

txtURL.setText("");
txtURL.setEditable(false);

txtOrganisation.setText("");
txtOrganisation.setEditable(false);

txtLocation.setText("");
txtLocation.setEditable(false);
}

@FXML
private void ViewEvents(ActionEvent event) throws IOException
{
// View Events page
AnchorPane pane =
FXMLLoader.load(getClass().getResource("ViewEvents.fxml"));
acpAddEvents.getChildren().setAll(pane);
}

For – UpdateEventsController

package app.ManageEvents;

import java.io.IOException;
import java.net.URL;
import java.time.LocalDate;
import java.util.ResourceBundle;
import app.Model.Database;
import app.Model.SharedModel;

21
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;

public class UpdateEventsController implements Initializable


{

@FXML
private AnchorPane acpUpdateEvents;

@FXML
private TextField txtEventTitle;

@FXML
private TextField txtURL;

@FXML
private DatePicker dtDate;

@FXML
private TextArea txtDescription;

@FXML
private TextField txtTime;

@FXML
private TextField txtNoOfSpace;

@FXML
private RadioButton rbtOnlineEvent;

@FXML
private RadioButton rbtExternalVisit;

@FXML
private RadioButton rbtInternalVisit;

@FXML
private TextField txtOrganisation;

@FXML
private TextField txtLocation;

@FXML
private TextField txtCampus;

@FXML
private TextField txtRoomNo;

@FXML
private Label lblErrorMessage;

22
Database database = new Database();

@Override
public void initialize(URL location, ResourceBundle resources)
{
lblErrorMessage.setText("");

txtEventTitle.setText(SharedModel.TITLE);
txtDescription.setText(SharedModel.DESCIPTION);
txtLocation.setText(SharedModel.LOCATION);
txtOrganisation.setText(SharedModel.ORGANISATION);
txtURL.setText(SharedModel.URL);
txtCampus.setText(SharedModel.CAMPUS);
txtRoomNo.setText(SharedModel.ROOM_NO);
txtTime.setText(SharedModel.TIME);

String noOfSpace =
Integer.toString(SharedModel.TOTAL_NO_OF_SPACE);
txtNoOfSpace.setText(noOfSpace);

LocalDate date = LocalDate.parse(SharedModel.DATE);


dtDate.setValue(date);

@FXML
private void Update(ActionEvent event) throws IOException
{
String title = txtEventTitle.getText();
String description = txtDescription.getText();
String location = txtLocation.getText();
String organisation = txtOrganisation.getText();
String url = txtURL.getText();
String campus = txtCampus.getText();
String roomNo = txtRoomNo.getText();
String time = txtTime.getText();
String noOfSpace = txtNoOfSpace.getText();

// if text boxes are empty


if(title.isEmpty() || description.isEmpty() || time.isEmpty()
|| noOfSpace.isEmpty())
{
lblErrorMessage.setText("All fields are required");
return; // kicks you out of the method
}

// date must not be empty


String date;
try
{
date = dtDate.getValue().toString();
}
catch (Exception e) {
lblErrorMessage.setText("Date required");
return; // kicks you out of the method

23
}

// no of space must be a number


int newTotalNoOfSpace = 0;
try
{
newTotalNoOfSpace = Integer.parseInt(noOfSpace);
}
catch (NumberFormatException ex) {
lblErrorMessage.setText("Number of space must be a number");
return; // kicks you out of the method
}

// url, organization, location, campus and roomNo text box must


not be empty
if(url.isEmpty() && organisation.isEmpty() &&
location.isEmpty()
&& campus.isEmpty() && roomNo.isEmpty())
{
lblErrorMessage.setText("Select either an Online,
External or Internal Event");
return; // kicks you out of the method
}

// -------------- all validations above has been fulfilled


------------
int eventid = SharedModel.EVENT_ID;

// clear error message


lblErrorMessage.setText("");

// add details to database


database.onUpdateEvent(eventid, title, description, location,
organisation, url, campus, roomNo, time, date, newTotalNoOfSpace);

// confirmation message box


Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Event Managemet System - UOB");
alert.setContentText("Event updated successfully.");
alert.setHeaderText(null);
alert.showAndWait();

// go to View Events page


AnchorPane pane =
FXMLLoader.load(getClass().getResource("ViewEvents.fxml"));
acpUpdateEvents.getChildren().setAll(pane);
}

// ----- radio box validation ------


@FXML
private void radioButtonOnSelect(ActionEvent event)
{
// online event radio button
if(rbtOnlineEvent.isSelected())
{
txtURL.setEditable(true);

24
txtOrganisation.setText("");
txtOrganisation.setEditable(false);

txtLocation.setText("");
txtLocation.setEditable(false);

txtCampus.setText("");
txtCampus.setEditable(false);

txtRoomNo.setText("");
txtRoomNo.setEditable(false);
}

// external event radio button


if(rbtExternalVisit.isSelected())
{
txtOrganisation.setEditable(true);
txtLocation.setEditable(true);

txtURL.setText("");
txtURL.setEditable(false);

txtCampus.setText("");
txtCampus.setEditable(false);

txtRoomNo.setText("");
txtRoomNo.setEditable(false);
}

// external event radio button


if(rbtInternalVisit.isSelected())
{
txtCampus.setEditable(true);
txtRoomNo.setEditable(true);

txtURL.setText("");
txtURL.setEditable(false);

txtOrganisation.setText("");
txtOrganisation.setEditable(false);

txtLocation.setText("");
txtLocation.setEditable(false);
}

@FXML
private void Delete(ActionEvent event) throws IOException
{
int eventid = SharedModel.EVENT_ID;

database.onDeleteEvent(eventid);

// View Events page

25
AnchorPane pane =
FXMLLoader.load(getClass().getResource("ViewEvents.fxml"));
acpUpdateEvents.getChildren().setAll(pane);
}

Admin.BookingsController.java

1. package admin.Bookings;  
2.   
3.   
4. import java.io.IOException;  
5. import java.net.URL;  
6. import java.util.ResourceBundle;  
7. import app.Model.Bookings;  
8. import app.Model.Database;  
9. import javafx.collections.FXCollections;  
10. import javafx.collections.ObservableList;  
11. import javafx.event.ActionEvent;  
12. import javafx.fxml.FXML;  
13. import javafx.fxml.FXMLLoader;  
14. import javafx.fxml.Initializable;  
15. import javafx.scene.control.Alert;  
16. import javafx.scene.control.TableColumn;  
17. import javafx.scene.control.TableView;  
18. import javafx.scene.control.Alert.AlertType;  
19. import javafx.scene.control.cell.PropertyValueFactory;  
20. import javafx.scene.layout.AnchorPane;  
21.   
22. public class BookingsController implements Initializable   
23. {  
24.     @FXML  
25.     private AnchorPane acpBookings;  
26.     @FXML private TableView<Bookings> bookingTable;  
27.     @FXML private TableColumn<Bookings, Integer> BookingID;  
28.     @FXML private TableColumn<Bookings, Integer> EventID;  
29.     @FXML private TableColumn<Bookings, String> Title;  
30.     @FXML private TableColumn<Bookings, String> BookingDate;  
31.     @FXML private TableColumn<Bookings, Integer> NoOfSpace;  
32.       
33.     Database database = new Database();  
34.       
35.     public ObservableList<Bookings> listOfBookings = FXCollections.observableArra
yList();           
36.       

26
37.     @Override  
38.     public void initialize(URL location, ResourceBundle resources)  
39.     {  
40.         listOfBookings.addAll(database.allBookedEventsTableData());  
41.   
42.         initialseTableColumns();  
43.           
44.         bookingTable.setItems(listOfBookings);  
45.           
46.     }  
47.       
48.     private void initialseTableColumns()  
49.     {  
50.         BookingID.setCellValueFactory(new PropertyValueFactory<Bookings, Integer>
("BookingID"));  
51.         EventID.setCellValueFactory(new PropertyValueFactory<Bookings, Integer>("
EventID"));  
52.         Title.setCellValueFactory(new PropertyValueFactory<Bookings, String>("Title"
));  
53.         BookingDate.setCellValueFactory(new PropertyValueFactory<Bookings, String
>("BookingDate"));  
54.         NoOfSpace.setCellValueFactory(new PropertyValueFactory<Bookings, Integer>
("NoOfSpace"));  
55.     }  
56.   
57.       
58.       
59.     @FXML  
60.     private void cancelbooking(ActionEvent event) throws IOException   
61.     {  
62.         if (!bookingTable.getSelectionModel().isEmpty())  
63.         {  
64.             int bookingID = bookingTable.getSelectionModel().getSelectedItem().getBoo
kingID();  
65.             int eventId = bookingTable.getSelectionModel().getSelectedItem().getEventID
();  
66.             int noOfSpace = bookingTable.getSelectionModel().getSelectedItem().getNoO
fSpace();  
67.               
68.             database.onDeleteBooking(bookingID, eventId, noOfSpace);  
69.               
70.             // refresh itself  
71.             AnchorPane pane = FXMLLoader.load(getClass().getResource("Bookings.fx
ml"));  
72.             acpBookings.getChildren().setAll(pane);  
73.         }  
74.         else   
75.         {  
76.             // error message box  
77.             Alert alert = new Alert(AlertType.ERROR);  

27
78.             alert.setTitle("Event Managemet System - UOB");  
79.             alert.setContentText("Select from the table to delete.");  
80.             alert.setHeaderText(null);  
81.             alert.showAndWait();  
82.         }  
83.     }  
84.   
85.   
86. }  

Admin.EventsController.java

 package admin.Events;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.util.ResourceBundle;  
   
 import app.Model.Database;  
 import app.Model.Events;  
 import javafx.collections.FXCollections;  
 import javafx.collections.ObservableList;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.TableColumn;  
 import javafx.scene.control.TableView;  
 import javafx.scene.control.Alert.AlertType;  
 import javafx.scene.control.cell.PropertyValueFactory;  
 import javafx.scene.layout.AnchorPane;  
   
 public class EventsController implements Initializable   
 {  
   
     @FXML  
     private AnchorPane acpEvents;  
     @FXML private TableView<Events> eventsTable;  
     @FXML private TableColumn<Events, Integer> eventid;  
     @FXML private TableColumn<Events, String> title;  
     @FXML private TableColumn<Events, String> date;  
     @FXML private TableColumn<Events, String> time;  
     @FXML private TableColumn<Events, Integer> noOfSpaceAvailable;  
   
     Database database = new Database();  
       
               

28
     public ObservableList<Events> listOfEvents = FXCollections.observableArrayList();  
               
               
       
     @Override  
     public void initialize(URL arg0, ResourceBundle arg1)   
     {  
         listOfEvents.addAll(database.eventsTableData());  
           
         initialseTableColumns();  
           
         eventsTable.setItems(listOfEvents);  
           
     }  
       
       
     private void initialseTableColumns()  
     {  

eventid.setCellValueFactory(new PropertyValueFactory<Events, Integer>("eventid"));  
         title.setCellValueFactory(new PropertyValueFactory<Events, String>("title"));  

date.setCellValueFactory(new PropertyValueFactory<Events, String>("date"));             
         time.setCellValueFactory(new PropertyValueFactory<Events, String>("time"));     

noOfSpaceAvailable.setCellValueFactory(new PropertyValueFactory<Events, Integer>("noO
fSpaceAvailable"));    
     }  
       
       
       
     @FXML  
     private void cancelevent(ActionEvent event) throws IOException   
     {  
         if (!eventsTable.getSelectionModel().isEmpty())   
         {  
             int eventid = eventsTable.getSelectionModel().getSelectedItem().getEventid();  
               
             database.onDeleteEvent(eventid);  
               
             // refresh itself  
             AnchorPane pane = FXMLLoader.load(getClass().getResource("Events.fxml"));  
             acpEvents.getChildren().setAll(pane);  
         }  
         else   
         {  
             // error message box  
             Alert alert = new Alert(AlertType.ERROR);  
             alert.setTitle("Event Managemet System - UOB");  
             alert.setContentText("Select from the table to cancel event.");  

29
             alert.setHeaderText(null);  
             alert.showAndWait();  
         }  
     }  

Admin.HomeController.java

 package admin.Home;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.util.ResourceBundle;  
   
 import app.Model.Database;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Button;  
 import javafx.scene.layout.AnchorPane;  
 import javafx.scene.text.Text;  
   
   
 public class HomeController implements Initializable  
 {  
   
     @FXML  
     private AnchorPane acpHome;  
   
     @FXML  
     private Text lblWelcome;  
   
     @FXML  
     private AnchorPane acpHomeBody;  
   
     @FXML  
     private Button btnevents;  
   
     @FXML  
     private Button btnbookings;  
   
     @FXML  
     private Button btnrequests;  
   
     @FXML  

30
     private Button btnlogout;  
   
     @FXML  
     private Button btnstudents;  
   
      
       
     @Override  
     public void initialize(URL location, ResourceBundle resources)   
     {  
         // welcomes the user  
         lblWelcome.setText("Welcome " + Database.EMAIL);  
           
         // opens events page  
                 try  
                 {  
                     AnchorPane pane = FXMLLoader.load(getClass().getResource("../Events/
Events.fxml"));  
                     acpHomeBody.getChildren().setAll(pane);  
                 } catch (IOException e)  
                 {  
                     e.printStackTrace();  
                 }  
                   
             }  
               
       
           
       
       
     @FXML  
     private void events(ActionEvent event) throws IOException   
     {  
         //  Events page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Events/
Events.fxml"));  
         acpHomeBody.getChildren().setAll(pane);  
           
           
     }  
       
       
       
     @FXML  
     private void bookings(ActionEvent event) throws IOException   
     {  
         //  bookings page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Bookings/
Bookings.fxml"));  
         acpHomeBody.getChildren().setAll(pane);  

31
     }  
       
       
       
   
     @FXML  
     private void requests(ActionEvent event) throws IOException   
     {  
         //  Request page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Requests/
Requests.fxml"));  
         acpHomeBody.getChildren().setAll(pane);  
     }  
       
   
     @FXML  
     private void students(ActionEvent event) throws IOException   
     {  
         //  student page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Students/
Students.fxml"));  
         acpHomeBody.getChildren().setAll(pane);  
     }  
       
     @FXML  
     private void logout(ActionEvent event) throws IOException   
     {  
         // logs out and opens login page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../../app/Login/
Login.fxml"));  
         acpHome.getChildren().setAll(pane);  
     }  
       
 } 

Admin.RequestController.java

1. package admin.Requests;  
2.   
3. import java.io.IOException;  
4. import java.net.URL;  
5. import java.util.ResourceBundle;  
6. import app.Model.Database;  
7. import app.Model.Requests;  
8. import javafx.collections.FXCollections;  
9. import javafx.collections.ObservableList;  
10. import javafx.fxml.FXML;  

32
11. import javafx.fxml.FXMLLoader;  
12. import javafx.fxml.Initializable;  
13. import javafx.scene.control.Alert;  
14. import javafx.scene.control.TableColumn;  
15. import javafx.scene.control.TableView;  
16. import javafx.scene.control.Alert.AlertType;  
17. import javafx.scene.control.cell.PropertyValueFactory;  
18. import javafx.scene.layout.AnchorPane;  
19.   
20. public class RequestsController implements Initializable  
21. {  
22.   
23.     @FXML  
24.     private AnchorPane acpRequests;  
25.   
26.     @FXML  
27.     private TableView<Requests> requestTable;  
28.   
29.     @FXML  
30.     private TableColumn<Requests, Integer> id;  
31.   
32.     @FXML  
33.     private TableColumn<Requests, Integer> studentID;  
34.       
35.       
36.     Database database = new Database();  
37.       
38.     public ObservableList<Requests> listOfRequests = FXCollections.observableArray
List();  
39.   
40.       
41.     @Override  
42.     public void initialize(URL location, ResourceBundle resources)  
43.     {  
44.         listOfRequests.addAll(database.requestsTableData());  
45.           
46.         initialseTableColumns();  
47.           
48.         requestTable.setItems(listOfRequests);  
49.     }  
50.       
51.       
52.     private void initialseTableColumns()  
53.     {  
54.         id.setCellValueFactory(new PropertyValueFactory<Requests, Integer>("id"));  
55.         studentID.setCellValueFactory(new PropertyValueFactory<Requests, Integer>("
studentID"));  
56.     }  
57.       
58.       

33
59.     @FXML  
60.     private void deleteRequest() throws IOException   
61.     {  
62.         if (!requestTable.getSelectionModel().isEmpty())   
63.         {  
64.             int studentID = requestTable.getSelectionModel().getSelectedItem().getStuden
tID();  
65.               
66.             database.onDeleteRequest(studentID);  
67.               
68.             // refresh itself  
69.             AnchorPane pane = FXMLLoader.load(getClass().getResource("Requests.fxm
l"));  
70.             acpRequests.getChildren().setAll(pane);  
71.         }  
72.         else   
73.         {  
74.             // error message box  
75.             Alert alert = new Alert(AlertType.ERROR);  
76.             alert.setTitle("Event Managemet System - UOB");  
77.             alert.setContentText("Select from the table to delete request.");  
78.             alert.setHeaderText(null);  
79.             alert.showAndWait();  
80.         }  
81.     }  
82.       
83.   
84. }  

Admin.StudentController.java

1. package admin.Students;  
2.   
3. import java.io.IOException;  
4. import java.net.URL;  
5. import java.util.ResourceBundle;  
6. import app.Model.Database;  
7. import app.Model.Students;  
8. import javafx.collections.FXCollections;  
9. import javafx.collections.ObservableList;  
10. import javafx.fxml.FXML;  
11. import javafx.fxml.FXMLLoader;  
12. import javafx.fxml.Initializable;  
13. import javafx.scene.control.Alert;  
14. import javafx.scene.control.TableColumn;  
15. import javafx.scene.control.TableView;  
16. import javafx.scene.control.Alert.AlertType;  
17. import javafx.scene.control.cell.PropertyValueFactory;  
18. import javafx.scene.layout.AnchorPane;  
34
19.   
20. public class StudentsController implements Initializable   
21. {  
22.   
23.     @FXML  
24.     private AnchorPane acpStudents;  
25.   
26.     @FXML  
27.     private TableView<Students> studentsTable;  
28.   
29.     @FXML  
30.     private TableColumn<Students, Integer> studentID;  
31.   
32.     @FXML  
33.     private TableColumn<Students, String> firstName;  
34.   
35.     @FXML  
36.     private TableColumn<Students, String> lastName;  
37.   
38.     @FXML  
39.     private TableColumn<Students, String> organnisationRights;  
40.       
41.       
42.     Database database = new Database();  
43.       
44.       
45.     public ObservableList<Students> listOfStudents = FXCollections.observableArray
List();  
46.               
47.               
48.       
49.     @Override  
50.     public void initialize(URL arg0, ResourceBundle arg1)   
51.     {     
52.         listOfStudents.addAll(database.studentsTableData());  
53.           
54.         initialseTableColumns();  
55.           
56.         studentsTable.setItems(listOfStudents);  
57.           
58.     }  
59.       
60.     private void initialseTableColumns()  
61.     {  
62.         studentID.setCellValueFactory(new PropertyValueFactory<Students, Integer>("s
tudentID"));  
63.         firstName.setCellValueFactory(new PropertyValueFactory<Students, String>("fi
rstName"));  
64.         lastName.setCellValueFactory(new PropertyValueFactory<Students, String>("la
stName"));           

35
65.         organnisationRights.setCellValueFactory(new PropertyValueFactory<Students, 
String>("organisationRights"));      
66.     }  
67.       
68.       
69.       
70.     @FXML  
71.     private void grantRights() throws IOException   
72.     {  
73.         if (!studentsTable.getSelectionModel().isEmpty())   
74.         {  
75.             int studentID = studentsTable.getSelectionModel().getSelectedItem().getStude
ntID();  
76.             String firstName = studentsTable.getSelectionModel().getSelectedItem().getFi
rstName();  
77.             String lastName = studentsTable.getSelectionModel().getSelectedItem().getLa
stName();  
78.               
79.             // grants organisation right  
80.             database.onGrantOrganisationRights(studentID);  
81.               
82.             // deletes request from database after granting rights  
83.             database.onDeleteRequest(studentID);  
84.               
85.             // confirmation message box  
86.             Alert alert = new Alert(AlertType.CONFIRMATION);  
87.             alert.setTitle("Event Managemet System - UOB");  
88.             alert.setContentText("Organisation Rights has been Granted to " + firstName 
+ " " + lastName + ".");  
89.             alert.setHeaderText(null);  
90.             alert.showAndWait();  
91.                           
92.             // refresh itself  
93.             AnchorPane pane = FXMLLoader.load(getClass().getResource("Students.fxm
l"));  
94.             acpStudents.getChildren().setAll(pane);  
95.         }  
96.         else   
97.         {  
98.             // error message box  
99.             Alert alert = new Alert(AlertType.ERROR);  
100.             alert.setTitle("Event Managemet System - UOB");  
101.             alert.setContentText("Select from the table to grant organisation rights.
");  
102.             alert.setHeaderText(null);  
103.             alert.showAndWait();  
104.         }  
105.     }  
106.       
107.       

36
108.       
109.     @FXML  
110.     private void revokeRights() throws IOException   
111.     {  
112.         if (!studentsTable.getSelectionModel().isEmpty())   
113.         {  
114.             int studentID = studentsTable.getSelectionModel().getSelectedItem().g
etStudentID();  
115.             String firstName = studentsTable.getSelectionModel().getSelectedItem
().getFirstName();  
116.             String lastName = studentsTable.getSelectionModel().getSelectedItem(
).getLastName();  
117.               
118.             //database  
119.             database.onRevokeOrganisationRights(studentID);  
120.               
121.             // confirmation message box  
122.             Alert alert = new Alert(AlertType.CONFIRMATION);  
123.             alert.setTitle("Event Managemet System - UOB");  
124.             alert.setContentText(firstName + " " + lastName + "'s Organisation Rig
hts has been Revoked.");  
125.             alert.setHeaderText(null);  
126.             alert.showAndWait();  
127.                           
128.             // refresh itself  
129.             AnchorPane pane = FXMLLoader.load(getClass().getResource("Stude
nts.fxml"));  
130.             acpStudents.getChildren().setAll(pane);  
131.               
132.         }  
133.         else   
134.         {  
135.             // error message box  
136.             Alert alert = new Alert(AlertType.ERROR);  
137.             alert.setTitle("Event Managemet System - UOB");  
138.             alert.setContentText("Select from the table to revoke organisation right
s.");  
139.             alert.setHeaderText(null);  
140.             alert.showAndWait();  
141.         }  
142.     }  
143.       
144.       
145.       
146.       
147.       
148.   
149. }  

App.BookingsController.java

37
 package app.Bookings;  
   
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.util.ResourceBundle;  
 import app.Model.Bookings;  
 import app.Model.Database;  
 import app.Model.SharedModel;  
 import javafx.collections.FXCollections;  
 import javafx.collections.ObservableList;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.TableColumn;  
 import javafx.scene.control.TableView;  
 import javafx.scene.control.Alert.AlertType;  
 import javafx.scene.control.cell.PropertyValueFactory;  
 import javafx.scene.layout.AnchorPane;  
   
 public class BookingsController implements Initializable   
 {  
     @FXML  
     private AnchorPane acpBookings;  
     @FXML private TableView<Bookings> bookingTable;  
     @FXML private TableColumn<Bookings, Integer> BookingID;  
     @FXML private TableColumn<Bookings, Integer> EventID;  
     @FXML private TableColumn<Bookings, String> Title;  
     @FXML private TableColumn<Bookings, String> BookingDate;  
     @FXML private TableColumn<Bookings, Integer> NoOfSpace;  
       
     Database database = new Database();  
       

public ObservableList<Bookings> listOfBookings = FXCollections.observableArrayList();     
      
       
     @Override  
     public void initialize(URL location, ResourceBundle resources)  
     {  
         listOfBookings.addAll(database.bookedEventsTableData());  
   
         initialseTableColumns();  
           
         bookingTable.setItems(listOfBookings);  
           
     }  

38
       
     private void initialseTableColumns()  
     {  

BookingID.setCellValueFactory(new PropertyValueFactory<Bookings, Integer>("BookingI
D"));  

EventID.setCellValueFactory(new PropertyValueFactory<Bookings, Integer>("EventID"));  
         Title.setCellValueFactory(new PropertyValueFactory<Bookings, String>("Title"));  

BookingDate.setCellValueFactory(new PropertyValueFactory<Bookings, String>("Booking
Date"));  

NoOfSpace.setCellValueFactory(new PropertyValueFactory<Bookings, Integer>("NoOfSpac
e"));  
     }  
       
       
     @FXML  
     private void update(ActionEvent event) throws IOException  
     {  
         if (!bookingTable.getSelectionModel().isEmpty())   
         {  

SharedModel.BOOKING_ID = bookingTable.getSelectionModel().getSelectedItem().getBoo
kingID();  

SharedModel.NO_OF_SPACE = bookingTable.getSelectionModel().getSelectedItem().getN
oOfSpace();  
             int eventID = bookingTable.getSelectionModel().getSelectedItem().getEventID();  
               
             // get selected event details from database  
             database.getEventsDetails(eventID);  
                           
             // go to Update Event page  

AnchorPane pane = FXMLLoader.load(getClass().getResource("UpdateBookings.fxml"));  
             acpBookings.getChildren().setAll(pane);  
         }  
         else   
         {  
             // error message box  
             Alert alert = new Alert(AlertType.ERROR);  
             alert.setTitle("Event Managemet System - UOB");  
             alert.setContentText("Select from the table to update.");  
             alert.setHeaderText(null);  
             alert.showAndWait();  
         }  
     }  
   

39
       
       
     @FXML  
     private void delete(ActionEvent event) throws IOException   
     {  
         if (!bookingTable.getSelectionModel().isEmpty())  
         {  

int bookingID = bookingTable.getSelectionModel().getSelectedItem().getBookingID();  
             int eventId = bookingTable.getSelectionModel().getSelectedItem().getEventID();  

int noOfSpace = bookingTable.getSelectionModel().getSelectedItem().getNoOfSpace();  
               
             database.onDeleteBooking(bookingID, eventId, noOfSpace);  
               
             // refresh itself  

AnchorPane pane = FXMLLoader.load(getClass().getResource("Bookings.fxml"));  
             acpBookings.getChildren().setAll(pane);  
         }  
         else   
         {  
             // error message box  
             Alert alert = new Alert(AlertType.ERROR);  
             alert.setTitle("Event Managemet System - UOB");  
             alert.setContentText("Select from the table to delete.");  
             alert.setHeaderText(null);  
             alert.showAndWait();  
         }  
     }  
   
       
       
       
       
   
 } 

App.UpdateBookingsController.java

 package app.Bookings;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.text.SimpleDateFormat;  
 import java.util.Date;  
 import java.util.ResourceBundle;  
 import app.Model.Database;  
 import app.Model.SharedModel;  

40
 import javafx.collections.FXCollections;  
 import javafx.collections.ObservableList;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.Alert.AlertType;  
 import javafx.scene.control.ComboBox;  
 import javafx.scene.control.Label;  
 import javafx.scene.control.TextArea;  
 import javafx.scene.control.TextField;  
 import javafx.scene.layout.AnchorPane;  
   
 public class UpdateBookingsController implements Initializable  
 {  
   
     @FXML  
     private AnchorPane acpUpdateBookings;  
   
     @FXML  
     private TextField txtEventTitle;  
   
     @FXML  
     private TextField txtURL;  
   
     @FXML  
     private TextArea txtDescription;  
   
     @FXML  
     private TextField txtTime;  
       
     @FXML  
     private TextField txtDate;  
   
     @FXML  
     private TextField txtOrganisation;  
   
     @FXML  
     private TextField txtLocation;  
   
     @FXML  
     private TextField txtCampus;  
   
     @FXML  
     private TextField txtRoomNo;  
       
     @FXML  
     private ComboBox<Integer> cmbNoOfSpace;  
       

41
     @FXML  
     private Label lblErrorMessage;  
       
       
     Database database = new Database();  
   
       

ObservableList<Integer> listOfNumbers = FXCollections.observableArrayList(1,2,3,4,5,6,7,
8,9,10);  
       
       
     @Override  
     public void initialize(URL location, ResourceBundle resources)   
     {  
         lblErrorMessage.setText("");  
         cmbNoOfSpace.setItems(listOfNumbers);  
           
         txtEventTitle.setText(SharedModel.TITLE);  
         txtDescription.setText(SharedModel.DESCIPTION);  
         txtLocation.setText(SharedModel.LOCATION);  
         txtOrganisation.setText(SharedModel.ORGANISATION);  
         txtURL.setText(SharedModel.URL);  
         txtCampus.setText(SharedModel.CAMPUS);  
         txtRoomNo.setText(SharedModel.ROOM_NO);  
         txtTime.setText(SharedModel.TIME);  
         txtDate.setText(SharedModel.DATE);  
         cmbNoOfSpace.setValue(SharedModel.NO_OF_SPACE);  
           
     }  
       
       
     @FXML  
     private void Complete(ActionEvent event) throws IOException   
     {  
         if (cmbNoOfSpace.getValue() == null)   
         {  
             lblErrorMessage.setText("Select the number of space you would like.");  
             return;  
         }  
           
         // -------------- all validations above has been fulfilled ------------  
           
         // clear error message  
         lblErrorMessage.setText("");  
           
         // get current date  
         Date date = new Date();  
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");  
           

42
         String bookingDate = dateFormat.format(date);  
         int bookingID = SharedModel.BOOKING_ID;  
         int eventId = SharedModel.EVENT_ID;  
         int newNoOfSpace = cmbNoOfSpace.getValue();   
           
         // update booking - database  
         database.onUpdateBooking(bookingID, eventId, bookingDate, newNoOfSpace);  
           
         // confirmation message box  
         Alert alert = new Alert(AlertType.CONFIRMATION);  
         alert.setTitle("Event Managemet System - UOB");  
         alert.setContentText("Booking updated successfully.");  
         alert.setHeaderText(null);  
         alert.showAndWait();  
           
         // go to Bookings page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("Bookings.fxml"));  
         acpUpdateBookings.getChildren().setAll(pane);  
     }  
       
       
   
 }  
  

App.EventDetailsController.java

 package app.Events;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.text.SimpleDateFormat;  
 import java.util.Date;  
 import java.util.ResourceBundle;  
 import app.Model.Database;  
 import app.Model.SharedModel;  
 import javafx.collections.FXCollections;  
 import javafx.collections.ObservableList;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.Alert.AlertType;  
 import javafx.scene.control.ComboBox;  
 import javafx.scene.control.Label;  
 import javafx.scene.control.TextArea;  
 import javafx.scene.control.TextField;  
 import javafx.scene.layout.AnchorPane;  

43
   
 public class EventDetailsController implements Initializable  
 {  
   
     @FXML  
     private AnchorPane acpEventDetails;  
   
     @FXML  
     private TextField txtEventTitle;  
   
     @FXML  
     private TextField txtURL;  
   
     @FXML  
     private TextArea txtDescription;  
   
     @FXML  
     private TextField txtTime;  
       
     @FXML  
     private TextField txtDate;  
   
     @FXML  
     private TextField txtOrganisation;  
   
     @FXML  
     private TextField txtLocation;  
   
     @FXML  
     private TextField txtCampus;  
   
     @FXML  
     private TextField txtRoomNo;  
       
     @FXML  
     private ComboBox<Integer> cmbNoOfSpace;  
       
     @FXML  
     private Label lblErrorMessage;  
       
       
     Database database = new Database();  
   
       

ObservableList<Integer> listOfNumbers = FXCollections.observableArrayList(1,2,3,4,5,6,7,
8,9,10);  
       
       
     @Override  

44
     public void initialize(URL location, ResourceBundle resources)   
     {  
         lblErrorMessage.setText("");  
         cmbNoOfSpace.setItems(listOfNumbers);  
           
         txtEventTitle.setText(SharedModel.TITLE);  
         txtDescription.setText(SharedModel.DESCIPTION);  
         txtLocation.setText(SharedModel.LOCATION);  
         txtOrganisation.setText(SharedModel.ORGANISATION);  
         txtURL.setText(SharedModel.URL);  
         txtCampus.setText(SharedModel.CAMPUS);  
         txtRoomNo.setText(SharedModel.ROOM_NO);  
         txtTime.setText(SharedModel.TIME);  
         txtDate.setText(SharedModel.DATE);  
           
     }  
       
       
     @FXML  
     private void Complete(ActionEvent event) throws IOException   
     {  
         if (cmbNoOfSpace.getValue() == null)   
         {  
             lblErrorMessage.setText("Select the number of space you would like.");  
             return;  
         }  
           
         // -------------- all validations above has been fulfilled ------------  
           
         // clear error message  
         lblErrorMessage.setText("");  
           
         // get current date  
         Date date = new Date();  
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");  
           
         String bookingDate = dateFormat.format(date);  
         int eventId = SharedModel.EVENT_ID;  
         int studentId = Database.STUDENTID;  
         int noOfSpace = cmbNoOfSpace.getValue();          
           
         // book event - database  
         database.onBookEvent(eventId, noOfSpace, bookingDate, studentId);  
           
         // confirmation message box  
         Alert alert = new Alert(AlertType.CONFIRMATION);  
         alert.setTitle("Event Managemet System - UOB");  
         alert.setContentText("Event booked successfully.");  
         alert.setHeaderText(null);  
         alert.showAndWait();  

45
           
         // go to Bookings page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Bookings/
Bookings.fxml"));  
         acpEventDetails.getChildren().setAll(pane);  
     }  
       
       
   
 } 

App.EventsController.java
 package app.Events;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.util.ResourceBundle;  
 import app.Model.Database;  
 import app.Model.Events;  
 import javafx.collections.FXCollections;  
 import javafx.collections.ObservableList;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.TableColumn;  
 import javafx.scene.control.TableView;  
 import javafx.scene.control.Alert.AlertType;  
 import javafx.scene.control.cell.PropertyValueFactory;  
 import javafx.scene.layout.AnchorPane;  
   
 public class EventsController implements Initializable   
 {  
     @FXML  
     private AnchorPane acpEvents;  
     @FXML private TableView<Events> eventsTable;  
     @FXML private TableColumn<Events, Integer> eventid;  
     @FXML private TableColumn<Events, String> title;  
     @FXML private TableColumn<Events, String> date;  
     @FXML private TableColumn<Events, String> time;  
     @FXML private TableColumn<Events, Integer> noOfSpaceAvailable;  
       
     Database database = new Database();  
       
       
 //  public ObservableList<Events> list = FXCollections.observableArrayList(  
 //          new Events ("E01", "London tower", "Excursion", "07/04/20", "London", "NULL"
, "18:20" ,30),  
46
 //          new Events ("E02", "Eatry", "Food Competition", "08/04/20", "Luton", "NULL", "
21:30", 25),  
 //          new Events ("E03", "Lecture", "Maths", "30/07/20", "NULL", "www.i.com", "9:3
0", 30)  
 //          );  
               
     public ObservableList<Events> listOfEvents = FXCollections.observableArrayList();  
               
               
       
     @Override  
     public void initialize(URL arg0, ResourceBundle arg1)   
     {  
         listOfEvents.addAll(database.eventsTableData());  
           
         initialseTableColumns();  
           
         eventsTable.setItems(listOfEvents);  
           
     }  
       
       
     private void initialseTableColumns()  
     {  

eventid.setCellValueFactory(new PropertyValueFactory<Events, Integer>("eventid"));  
         title.setCellValueFactory(new PropertyValueFactory<Events, String>("title"));  

date.setCellValueFactory(new PropertyValueFactory<Events, String>("date"));             
         time.setCellValueFactory(new PropertyValueFactory<Events, String>("time"));     

noOfSpaceAvailable.setCellValueFactory(new PropertyValueFactory<Events, Integer>("noO
fSpaceAvailable"));    
     }  
       
       
       
     @FXML  
     private void bookEvent(ActionEvent event) throws IOException   
     {  
         if (!eventsTable.getSelectionModel().isEmpty())   
         {  
             int eventid = eventsTable.getSelectionModel().getSelectedItem().getEventid();  
               
             // get selected event details from database  
             database.getEventsDetails(eventid);  
                           
             // go to Update Event page  

AnchorPane pane = FXMLLoader.load(getClass().getResource("EventDetails.fxml"));  

47
             acpEvents.getChildren().setAll(pane);  
         }  
         else   
         {  
             // error message box  
             Alert alert = new Alert(AlertType.ERROR);  
             alert.setTitle("Event Managemet System - UOB");  
             alert.setContentText("Select from the table to book.");  
             alert.setHeaderText(null);  
             alert.showAndWait();  
         }  
     }  
       
       
       
       
   
 } 

App.ForgetPasswordController.java

 package app.ForgetPassword;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.util.ResourceBundle;  
   
 import app.Model.Database;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.Label;  
 import javafx.scene.control.PasswordField;  
 import javafx.scene.control.TextField;  
 import javafx.scene.control.Alert.AlertType;  
 import javafx.scene.layout.AnchorPane;  
   
 public class ForgetPasswordController implements Initializable  
 {  
       
     @FXML  
     private AnchorPane acpForgetPassword;  
   
     @FXML  
     private TextField txtStudentID;  
   

48
     @FXML  
     private PasswordField txtNewPassword;  
   
     @FXML  
     private PasswordField txtConfirmPassword;  
   
     @FXML  
     private Label lblErrorMessage;  
       
     Database database = new Database();  
       
     @Override  
     public void initialize(URL location, ResourceBundle resources)   
     {         
         lblErrorMessage.setText("");  
     }  
       
       
     public void submit(ActionEvent event) throws IOException  
     {  
         String studentID = txtStudentID.getText();  
         String newPassword = txtNewPassword.getText();  
         String confirmPassword = txtConfirmPassword.getText();  
           
         // if text boxes are empty  
         if(studentID.isEmpty() || newPassword.isEmpty() || confirmPassword.isEmpty())   
         {  
             lblErrorMessage.setText("All fields are required");  
             return; // kicks you out of the method  
         }  
           
         // if both password do not match  
         if (!newPassword.equals(confirmPassword))   
         {  
             lblErrorMessage.setText("Password does not match");  
             return; // kicks you out of the method  
         }  
           
         // if student id does not exist in the database  
         if (database.doesStudentIDExistInDataBase(studentID) == false)  
         {  
             lblErrorMessage.setText("Student ID does not exist");  
             return;  
         }  
           
         // if the above condition has been met  
         // update student's password  
         database.PasswordUpdate(studentID, newPassword);  
           
         // confirmation message box  

49
         Alert alert = new Alert(AlertType.CONFIRMATION);  
         alert.setTitle("Event Managemet System - UOB");  
         alert.setContentText("Password Successfully Changed.");  
         alert.setHeaderText(null);  
         alert.showAndWait();  
                   
         // opens login page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Login/
Login.fxml"));  
         acpForgetPassword.getChildren().setAll(pane);  
   
     }  
   
       
       
     public void goToLogin(ActionEvent event) throws IOException  
     {  
         // opens login page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Login/
Login.fxml"));  
         acpForgetPassword.getChildren().setAll(pane);  
     }  
   
   
   
   
 } 

App.HomeController.java
 package app.Home;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.util.ResourceBundle;  
 import app.Model.Database;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Button;  
 import javafx.scene.layout.AnchorPane;  
 import javafx.scene.text.Text;  
   
   
 public class HomeController implements Initializable  
 {  
     @FXML  
     private AnchorPane acpHome;  
   
50
     @FXML  
     private AnchorPane acpHomeBody;  
   
     @FXML  
     private Text lblWelcome;  
       
     @FXML  
     private Button btnManageEvents;  
       
       
     Database database = new Database();  
       
   
     @Override  
     public void initialize(URL location, ResourceBundle resources)   
     {  
         // welcomes the user  

lblWelcome.setText("Welcome " + Database.FIRST_NAME + " " + Database.LAST_NAME
);  
           
           
         // disable manage events button if student does not have organization right  
         boolean result = database.doesStudentHaveOrganisationRight();  
         if (result == false)  
         {  
             btnManageEvents.setDisable(true);  
         }   
           
         // opens events page  
         try  
         {  
             AnchorPane pane = FXMLLoader.load(getClass().getResource("../Events/
Events.fxml"));  
             acpHomeBody.getChildren().setAll(pane);  
         } catch (IOException e)  
         {  
             e.printStackTrace();  
         }  
           
     }  
       
       
       
     @FXML  
     private void logout(ActionEvent event) throws IOException   
     {  
         // logs out and opens login page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Login/
Login.fxml"));  

51
         acpHome.getChildren().setAll(pane);  
     }  
       
     @FXML  
     private void profile(ActionEvent event) throws IOException   
     {  
         // profile page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Profile/
Profile.fxml"));  
         acpHomeBody.getChildren().setAll(pane);  
     }  
   
     @FXML  
     private void bookings(ActionEvent event) throws IOException   
     {  
         // Bookings page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Bookings/
Bookings.fxml"));  
         acpHomeBody.getChildren().setAll(pane);  
     }  
   
       
     @FXML  
     private void settings(ActionEvent event) throws IOException   
     {  
         // Settings page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Settings/
Settings.fxml"));  
         acpHomeBody.getChildren().setAll(pane);  
     }  
       
       
     @FXML  
     private void manageevents(ActionEvent event) throws IOException   
     {  
         // Events Management page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../ManageEvents/
AddEvents.fxml"));  
         acpHomeBody.getChildren().setAll(pane);  
     }  
       
       
     @FXML  
     private void events(ActionEvent event) throws IOException   
     {  
         //  Events page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Events/
Events.fxml"));  
         acpHomeBody.getChildren().setAll(pane);  
     }  

52
       
       
       
       
       
       
 } 

app.LoginController.java
 package app.Login;  
   
 import java.net.URL;  
 import java.util.ResourceBundle;  
 import app.Model.Database;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Label;  
 import javafx.scene.control.PasswordField;  
 import javafx.scene.control.TextField;  
 import javafx.scene.layout.AnchorPane;  
   
 public class LoginController implements Initializable  
 {  
       
     @FXML  
     private AnchorPane acpLogin;  
   
     @FXML  
     private TextField txtID;  
   
     @FXML  
     private PasswordField txPassword;  
   
     @FXML  
     private Label lblErrorMessage;  
       
       
     Database database = new Database();  
       
   
     @Override  
     public void initialize(URL location, ResourceBundle resources)   
     {  
         lblErrorMessage.setText("");  
           
     }  

53
   
     // login button  
     @FXML  
     private void Login(ActionEvent event) throws Exception   
     {  
         String id = txtID.getText();  
         String password = txPassword.getText();  
           
         if (database.onLoginSuccess(id, password) == true)  
         {     
             // opens home page  
             AnchorPane pane = FXMLLoader.load(getClass().getResource("../Home/
Home.fxml"));  
             acpLogin.getChildren().setAll(pane);  
         }  
         else   
         {  
             if (database.onAdminLoginSuccess(id, password) == true)  
             {     
                 // opens admin home page  
                 AnchorPane pane = FXMLLoader.load(getClass().getResource("../../admin/
Home/Home.fxml"));  
                 acpLogin.getChildren().setAll(pane);  
             }  
             else   
             {  
                 // error message  
                 lblErrorMessage.setText("Incorrect Student ID or Admin ID Password");  
             }     
         }     
           
     }  
   
       
     // Forget password link  
     @FXML  
     private void ForgetPassword(ActionEvent event) throws Exception   
     {  
         // opens forget password page  
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../ForgetPassword/
ForgetPassword.fxml"));  
         acpLogin.getChildren().setAll(pane);  
     }  
       
       
     // Register link  
     @FXML  
     private void Register(ActionEvent event) throws Exception   
     {  
         // opens register page  

54
         AnchorPane pane = FXMLLoader.load(getClass().getResource("../Register/
Register.fxml"));  
         acpLogin.getChildren().setAll(pane);  
     }  
       
       
   
   
   
   
   
   
   
   
 } 

App.EventsController.java
 package app.ManageEvents;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.util.ResourceBundle;  
   
 import app.Model.Database;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.Alert.AlertType;  
 import javafx.scene.control.Button;  
 import javafx.scene.control.DatePicker;  
 import javafx.scene.control.Label;  
 import javafx.scene.control.RadioButton;  
 import javafx.scene.control.TextArea;  
 import javafx.scene.control.TextField;  
 import javafx.scene.layout.AnchorPane;  
   
 public class AddEventsController implements Initializable  
 {  
   
     @FXML  
     private AnchorPane acpAddEvents;  
   
     @FXML  
     private Button AddEvent;  
   
     @FXML  
     private TextField txtEventTitle;  

55
   
     @FXML  
     private TextField txtURL;  
   
     @FXML  
     private DatePicker dtDate;  
   
     @FXML  
     private TextArea txtDescription;  
   
     @FXML  
     private TextField txtTime;  
   
     @FXML  
     private TextField txtNoOfSpace;  
   
     @FXML  
     private RadioButton rbtOnlineEvent;  
   
     @FXML  
     private RadioButton rbtExternalVisit;  
   
     @FXML  
     private RadioButton rbtInternalVisit;  
   
     @FXML  
     private TextField txtOrganisation;  
   
     @FXML  
     private TextField txtLocation;  
   
     @FXML  
     private TextField txtCampus;  
   
     @FXML  
     private TextField txtRoomNo;  
       
     @FXML  
     private Label lblErrorMessage;  
       
       
     Database database = new Database();  
   
       
     @Override  
     public void initialize(URL location, ResourceBundle resources)   
     {  
         lblErrorMessage.setText("");  
     }  
       

56
       
     @FXML  
     private void AddEvent(ActionEvent event) throws IOException   
     {  
         String title = txtEventTitle.getText();  
         String description = txtDescription.getText();  
         String location = txtLocation.getText();  
         String organisation = txtOrganisation.getText();  
         String url = txtURL.getText();  
         String campus = txtCampus.getText();  
         String roomNo = txtRoomNo.getText();  
         String time = txtTime.getText();  
         String noOfSpace = txtNoOfSpace.getText();  
           
          // if text boxes are empty  
         if(title.isEmpty() || description.isEmpty() || time.isEmpty() || noOfSpace.isEmpty())   
         {  
             lblErrorMessage.setText("All fields are required");  
             return; // kicks you out of the method  
         }  
           
         // date must not be empty  
         String date;  
         try   
         {  
             date = dtDate.getValue().toString();  
         }   
         catch (Exception e) {  
             lblErrorMessage.setText("Date required");  
             return; // kicks you out of the method  
         }  
           
         // no of space must be a number  
         int totalNoOfSpace = 0;  
         try  
         {  
             totalNoOfSpace = Integer.parseInt(noOfSpace);  
         }  
         catch (NumberFormatException ex) {  
             lblErrorMessage.setText("Number of space must be a number");  
             return; // kicks you out of the method  
         }  
           
         // url, organization, location, campus and roomNo text box must not be empty  
         if(url.isEmpty() && organisation.isEmpty() && location.isEmpty()  
                 && campus.isEmpty() && roomNo.isEmpty())   
         {  
             lblErrorMessage.setText("Select either an Online, External or Internal Event");  
             return; // kicks you out of the method  
         }  

57
           
           
         // -------------- all validations above has been fulfilled ------------  
           
         int noOfSpaceAvailable = totalNoOfSpace;  
         int studentId = Database.STUDENTID;  
           
         // clear error message  
         lblErrorMessage.setText("");  
           
         // add details to database  

database.onAddEvent(title, description, location, organisation, url, campus, roomNo, time, da
te, totalNoOfSpace, noOfSpaceAvailable, studentId);  
           
         // confirmation message box  
         Alert alert = new Alert(AlertType.CONFIRMATION);  
         alert.setTitle("Event Managemet System - UOB");  
         alert.setContentText("Event added successfully.");  
         alert.setHeaderText(null);  
         alert.showAndWait();  
           
         // go to View Events page  

AnchorPane pane = FXMLLoader.load(getClass().getResource("ViewEvents.fxml"));  
         acpAddEvents.getChildren().setAll(pane);  
     }  
       
       
     // ----- radio box validation ------  
     @FXML  
     private void radioButtonOnSelect(ActionEvent event)  
     {  
         // online event radio button   
         if(rbtOnlineEvent.isSelected())  
         {  
             txtURL.setEditable(true);  
               
             txtOrganisation.setText("");  
             txtOrganisation.setEditable(false);  
               
             txtLocation.setText("");  
             txtLocation.setEditable(false);  
               
             txtCampus.setText("");  
             txtCampus.setEditable(false);  
               
             txtRoomNo.setText("");  
             txtRoomNo.setEditable(false);  
         }  

58
           
         // external event radio button   
         if(rbtExternalVisit.isSelected())  
         {  
             txtOrganisation.setEditable(true);  
             txtLocation.setEditable(true);  
               
             txtURL.setText("");  
             txtURL.setEditable(false);  
               
             txtCampus.setText("");  
             txtCampus.setEditable(false);  
               
             txtRoomNo.setText("");  
             txtRoomNo.setEditable(false);  
         }  
           
         // external event radio button   
         if(rbtInternalVisit.isSelected())  
         {  
             txtCampus.setEditable(true);  
             txtRoomNo.setEditable(true);  
               
             txtURL.setText("");  
             txtURL.setEditable(false);  
               
             txtOrganisation.setText("");  
             txtOrganisation.setEditable(false);  
               
             txtLocation.setText("");  
             txtLocation.setEditable(false);  
         }  
           
     }  
   
   
       
     @FXML  
     private void ViewEvents(ActionEvent event) throws IOException   
     {  
         // View Events page  

AnchorPane pane = FXMLLoader.load(getClass().getResource("ViewEvents.fxml"));  
         acpAddEvents.getChildren().setAll(pane);  
     }  
       
   
   
 } 

59
UpdateEventController
 package app.ManageEvents;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.time.LocalDate;  
 import java.util.ResourceBundle;  
 import app.Model.Database;  
 import app.Model.SharedModel;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.Alert.AlertType;  
 import javafx.scene.control.DatePicker;  
 import javafx.scene.control.Label;  
 import javafx.scene.control.RadioButton;  
 import javafx.scene.control.TextArea;  
 import javafx.scene.control.TextField;  
 import javafx.scene.layout.AnchorPane;  
   
   
 public class UpdateEventsController implements Initializable  
 {  
   
     @FXML  
     private AnchorPane acpUpdateEvents;  
   
     @FXML  
     private TextField txtEventTitle;  
   
     @FXML  
     private TextField txtURL;  
   
     @FXML  
     private DatePicker dtDate;  
   
     @FXML  
     private TextArea txtDescription;  
   
     @FXML  
     private TextField txtTime;  
   
     @FXML  
     private TextField txtNoOfSpace;  
   
     @FXML  
     private RadioButton rbtOnlineEvent;  

60
   
     @FXML  
     private RadioButton rbtExternalVisit;  
   
     @FXML  
     private RadioButton rbtInternalVisit;  
   
     @FXML  
     private TextField txtOrganisation;  
   
     @FXML  
     private TextField txtLocation;  
   
     @FXML  
     private TextField txtCampus;  
   
     @FXML  
     private TextField txtRoomNo;  
       
     @FXML  
     private Label lblErrorMessage;  
       
       
     Database database = new Database();  
   
       
     @Override  
     public void initialize(URL location, ResourceBundle resources)   
     {  
         lblErrorMessage.setText("");  
           
         txtEventTitle.setText(SharedModel.TITLE);  
         txtDescription.setText(SharedModel.DESCIPTION);  
         txtLocation.setText(SharedModel.LOCATION);  
         txtOrganisation.setText(SharedModel.ORGANISATION);  
         txtURL.setText(SharedModel.URL);  
         txtCampus.setText(SharedModel.CAMPUS);  
         txtRoomNo.setText(SharedModel.ROOM_NO);  
         txtTime.setText(SharedModel.TIME);  
           
         String noOfSpace = Integer.toString(SharedModel.TOTAL_NO_OF_SPACE);  
         txtNoOfSpace.setText(noOfSpace);  
           
         LocalDate date = LocalDate.parse(SharedModel.DATE);  
         dtDate.setValue(date);  
           
     }  
       
       
     @FXML  

61
     private void Update(ActionEvent event) throws IOException   
     {  
         String title = txtEventTitle.getText();  
         String description = txtDescription.getText();  
         String location = txtLocation.getText();  
         String organisation = txtOrganisation.getText();  
         String url = txtURL.getText();  
         String campus = txtCampus.getText();  
         String roomNo = txtRoomNo.getText();  
         String time = txtTime.getText();  
         String noOfSpace = txtNoOfSpace.getText();  
           
          // if text boxes are empty  
         if(title.isEmpty() || description.isEmpty() || time.isEmpty() || noOfSpace.isEmpty())   
         {  
             lblErrorMessage.setText("All fields are required");  
             return; // kicks you out of the method  
         }  
           
         // date must not be empty  
         String date;  
         try   
         {  
             date = dtDate.getValue().toString();  
         }   
         catch (Exception e) {  
             lblErrorMessage.setText("Date required");  
             return; // kicks you out of the method  
         }  
           
         // no of space must be a number  
         int newTotalNoOfSpace = 0;  
         try  
         {  
             newTotalNoOfSpace = Integer.parseInt(noOfSpace);  
         }  
         catch (NumberFormatException ex) {  
             lblErrorMessage.setText("Number of space must be a number");  
             return; // kicks you out of the method  
         }  
           
         // url, organization, location, campus and roomNo text box must not be empty  
         if(url.isEmpty() && organisation.isEmpty() && location.isEmpty()  
                 && campus.isEmpty() && roomNo.isEmpty())   
         {  
             lblErrorMessage.setText("Select either an Online, External or Internal Event");  
             return; // kicks you out of the method  
         }  
           
           

62
         // -------------- all validations above has been fulfilled ------------  
         int eventid = SharedModel.EVENT_ID;  
           
         // clear error message  
         lblErrorMessage.setText("");  
           
         // add details to database  

database.onUpdateEvent(eventid, title, description, location, organisation, url, campus, room
No, time, date, newTotalNoOfSpace);  
           
         // confirmation message box  
         Alert alert = new Alert(AlertType.CONFIRMATION);  
         alert.setTitle("Event Managemet System - UOB");  
         alert.setContentText("Event updated successfully.");  
         alert.setHeaderText(null);  
         alert.showAndWait();  
           
         // go to View Events page  

AnchorPane pane = FXMLLoader.load(getClass().getResource("ViewEvents.fxml"));  
         acpUpdateEvents.getChildren().setAll(pane);  
     }  
       
       
       
     // ----- radio box validation ------  
     @FXML  
     private void radioButtonOnSelect(ActionEvent event)  
     {  
         // online event radio button   
         if(rbtOnlineEvent.isSelected())  
         {  
             txtURL.setEditable(true);  
               
             txtOrganisation.setText("");  
             txtOrganisation.setEditable(false);  
               
             txtLocation.setText("");  
             txtLocation.setEditable(false);  
               
             txtCampus.setText("");  
             txtCampus.setEditable(false);  
               
             txtRoomNo.setText("");  
             txtRoomNo.setEditable(false);  
         }  
           
         // external event radio button   
         if(rbtExternalVisit.isSelected())  

63
         {  
             txtOrganisation.setEditable(true);  
             txtLocation.setEditable(true);  
               
             txtURL.setText("");  
             txtURL.setEditable(false);  
               
             txtCampus.setText("");  
             txtCampus.setEditable(false);  
               
             txtRoomNo.setText("");  
             txtRoomNo.setEditable(false);  
         }  
           
         // external event radio button   
         if(rbtInternalVisit.isSelected())  
         {  
             txtCampus.setEditable(true);  
             txtRoomNo.setEditable(true);  
               
             txtURL.setText("");  
             txtURL.setEditable(false);  
               
             txtOrganisation.setText("");  
             txtOrganisation.setEditable(false);  
               
             txtLocation.setText("");  
             txtLocation.setEditable(false);  
         }  
           
     }  
   
   
       
     @FXML  
     private void Delete(ActionEvent event) throws IOException   
     {  
         int eventid = SharedModel.EVENT_ID;  
           
         database.onDeleteEvent(eventid);  
           
         // View Events page  

AnchorPane pane = FXMLLoader.load(getClass().getResource("ViewEvents.fxml"));  
         acpUpdateEvents.getChildren().setAll(pane);  
     }  
       
   
   
 }  

64
   

ViewEventsController.java
 package app.ManageEvents;  
   
 import java.io.IOException;  
 import java.net.URL;  
 import java.util.ResourceBundle;  
 import app.Model.Database;  
 import app.Model.Events;  
 import javafx.collections.FXCollections;  
 import javafx.collections.ObservableList;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.fxml.FXMLLoader;  
 import javafx.fxml.Initializable;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.TableColumn;  
 import javafx.scene.control.TableView;  
 import javafx.scene.control.Alert.AlertType;  
 import javafx.scene.control.cell.PropertyValueFactory;  
 import javafx.scene.layout.AnchorPane;  
   
 public class ViewEventsController implements Initializable   
 {  
     @FXML  
     private AnchorPane acpViewEvents;  
       
     @FXML private TableView<Events> viewEventsTable;  
     @FXML private TableColumn<Events, Integer> eventid;  
     @FXML private TableColumn<Events, String> title;  
     @FXML private TableColumn<Events, String> date;  
     @FXML private TableColumn<Events, String> time;  
     @FXML private TableColumn<Events, Integer> noOfSpaceAvailable;  
       
     Database database = new Database();  
               
     public ObservableList<Events> listOfEvents = FXCollections.observableArrayList();  
               
               
       
     @Override  
     public void initialize(URL arg0, ResourceBundle arg1)   
     {  
         listOfEvents.addAll(database.viewEventsTableData());  
           
         initialseTableColumns();  
           

65
         viewEventsTable.setItems(listOfEvents);  
           
     }  
       
       
     private void initialseTableColumns()  
     {  

eventid.setCellValueFactory(new PropertyValueFactory<Events, Integer>("eventid"));  
         title.setCellValueFactory(new PropertyValueFactory<Events, String>("title"));  

date.setCellValueFactory(new PropertyValueFactory<Events, String>("date"));             
         time.setCellValueFactory(new PropertyValueFactory<Events, String>("time"));     

noOfSpaceAvailable.setCellValueFactory(new PropertyValueFactory<Events, Integer>("noO
fSpaceAvailable"));    
     }  
       
       
       
     @FXML  
     private void UpdateEvent(ActionEvent event) throws IOException  
     {  
         if (!viewEventsTable.getSelectionModel().isEmpty())   
         {  

int eventid = viewEventsTable.getSelectionModel().getSelectedItem().getEventid();  
               
             // get selected event details from database  
             database.getEventsDetails(eventid);  
                           
             // go to Update Event page  

AnchorPane pane = FXMLLoader.load(getClass().getResource("UpdateEvents.fxml"));  
             acpViewEvents.getChildren().setAll(pane);  
         }  
         else   
         {  
             // error message box  
             Alert alert = new Alert(AlertType.ERROR);  
             alert.setTitle("Event Managemet System - UOB");  
             alert.setContentText("Select from the table to update.");  
             alert.setHeaderText(null);  
             alert.showAndWait();  
         }  
     }  
           
       
     @FXML  
     private void DeleteEvent(ActionEvent event) throws IOException  

66
     {  
         if (!viewEventsTable.getSelectionModel().isEmpty())   
         {  

int eventid = viewEventsTable.getSelectionModel().getSelectedItem().getEventid();  
               
             database.onDeleteEvent(eventid);  
               
             // refresh itself  

AnchorPane pane = FXMLLoader.load(getClass().getResource("ViewEvents.fxml"));  
             acpViewEvents.getChildren().setAll(pane);  
         }  
         else   
         {  
             // error message box  
             Alert alert = new Alert(AlertType.ERROR);  
             alert.setTitle("Event Managemet System - UOB");  
             alert.setContentText("Select from the table to delete.");  
             alert.setHeaderText(null);  
             alert.showAndWait();  
         }  
     }  
       
       
       
       
   
 } 

Bookings.java
 package app.Model;  
   
 import javafx.beans.property.SimpleIntegerProperty;  
 import javafx.beans.property.SimpleStringProperty;  
   
 public class Bookings   
 {  
     private final SimpleIntegerProperty BookingID;  
     private final SimpleIntegerProperty EventID;  
     private final SimpleStringProperty Title;  
     private final SimpleStringProperty BookingDate;  
     private final SimpleIntegerProperty NoOfSpace;  
       

public Bookings(Integer bookingID, Integer eventID, String title, String bookingDate, Integer 
noOfSpace)   
     {  

67
         super();  
         this.BookingID = new SimpleIntegerProperty(bookingID);  
         this.EventID = new SimpleIntegerProperty(eventID);  
         this.Title = new SimpleStringProperty(title);  
         this.BookingDate = new SimpleStringProperty(bookingDate);  
         this.NoOfSpace = new SimpleIntegerProperty(noOfSpace);  
     }  
       
       
     public Integer getBookingID()  
     {  
         return BookingID.get();  
     }  
       
     public Integer getEventID()   
     {  
         return EventID.get();  
     }  
   
     public String getTitle()  
     {  
         return Title.get();  
     }  
       
     public String getBookingDate()  
     {  
         return BookingDate.get();  
     }  
       
     public Integer getNoOfSpace()   
     {  
         return NoOfSpace.get();  
     }  
   
 }

Events.java
 package app.Model;  
   
 import javafx.beans.property.SimpleIntegerProperty;  
 import javafx.beans.property.SimpleStringProperty;  
   
 public class Events   
 {  
     private final SimpleIntegerProperty eventid;  
     private final SimpleStringProperty title;  
     private final SimpleStringProperty date;  
     private final SimpleStringProperty time;  

68
     private final SimpleIntegerProperty noOfSpaceAvailable;  
   
   
   

public Events (int eventid, String title, String date, String time, Integer noOfSpaceAvailable)  
 {  
     this.eventid = new SimpleIntegerProperty(eventid);  
     this.title = new SimpleStringProperty(title);  
     this.date = new SimpleStringProperty(date);  
     this.time = new SimpleStringProperty(time);  
     this.noOfSpaceAvailable = new SimpleIntegerProperty(noOfSpaceAvailable);  
       
 }  
     public Integer getEventid() {  
         return eventid.get();  
     }  
   
   
     public String getTitle() {  
         return title.get();  
     }  
   
     public String getDate() {  
         return date.get();  
     }  
   
       
     public String getTime() {  
         return time.get();  
     }  
   
   
     public Integer getNoOfSpaceAvailable() {  
         return noOfSpaceAvailable.get();  
     }  
 } 

Requests.java
 package app.Model;  
   
 import javafx.beans.property.SimpleIntegerProperty;  
   
 public class Requests   
 {  
     private final SimpleIntegerProperty id;  
     private final SimpleIntegerProperty studentID;  
       

69
     public Requests (int id, int studentID)  
     {  
         this.id = new SimpleIntegerProperty(id);  
         this.studentID = new SimpleIntegerProperty(studentID);  
     }  
       
       
     public Integer getId() {  
         return id.get();  
     }  
   
   
     public Integer getStudentID() {  
         return studentID.get();  
     }  
   
       
   
 } 

SharedModel.java
 package app.Model;  
   
 public class SharedModel   
 {     
     public static int EVENT_ID = 0;  
     public static String TITLE = "";  
     public static String DESCIPTION = "";  
     public static String LOCATION = "";  
     public static String ORGANISATION = "";  
     public static String URL = "";  
     public static String CAMPUS = "";   
     public static String ROOM_NO = "";  
     public static String TIME = "";   
     public static String DATE = "";  
     public static int TOTAL_NO_OF_SPACE = 0;  
     public static int NO_OF_SPACE_AVAILABLE = 0;  
       
     public static int BOOKING_ID = 0;  
     public static int NO_OF_SPACE = 0;  
   
 }

Students.java
 package app.Model;  
   
 import javafx.beans.property.SimpleIntegerProperty;  

70
 import javafx.beans.property.SimpleStringProperty;  
   
 public class Students   
 {  
     private final SimpleIntegerProperty studentID;  
     private final SimpleStringProperty firstName;  
     private final SimpleStringProperty lastName;  
     private final SimpleStringProperty organisationRights;  
   

public Students (Integer studentID, String firstName, String lastName, String organisationRig
hts)  
     {  
         this.studentID = new SimpleIntegerProperty(studentID);  
         this.firstName = new SimpleStringProperty(firstName);  
         this.lastName = new SimpleStringProperty(lastName);  
         this.organisationRights = new SimpleStringProperty(organisationRights);  
     }  
       
     public Integer getStudentID() {  
         return studentID.get();  
     }  
   
   
     public String getFirstName() {  
         return firstName.get();  
     }  
   
     public String getLastName() {  
         return lastName.get();  
     }  
   
     public String getOrganisationRights() {  
         return organisationRights.get();  
     }  
   
   
 } 

App.ProfileController.java
 package app.Profile;  
   
 import java.net.URL;  
 import java.util.ResourceBundle;  
   
 import app.Model.Database;  
 import javafx.fxml.FXML;  
 import javafx.fxml.Initializable;  
 import javafx.scene.text.Text;  

71
   
   
 public class ProfileController implements Initializable  
 {  
     @FXML  
     private Text lblFirstName;  
   
     @FXML  
     private Text lblLastName;  
   
     @FXML  
     private Text lblStudentID;  
   
     @FXML  
     private Text lblOrganisationRight;  
       
       
     @Override  
     public void initialize(URL location, ResourceBundle resources)   
     {  
         lblFirstName.setText(Database.FIRST_NAME);  
         lblLastName.setText(Database.LAST_NAME);  
         lblOrganisationRight.setText(Database.ORGANISATION_RIGHT);  
           
         String studentID = Integer.toString(Database.STUDENTID);  
         lblStudentID.setText(studentID);  
           
     }  
           
   
 }

App.RegisterController.java

1. package app.Register;  
2.   
3. import java.io.IOException;  
4. import java.net.URL;  
5. import java.util.ResourceBundle;  
6. import app.Model.Database;  
7. import javafx.event.ActionEvent;  
8. import javafx.fxml.FXML;  
9. import javafx.fxml.FXMLLoader;  
10. import javafx.fxml.Initializable;  
11. import javafx.scene.control.Alert;  
12. import javafx.scene.control.Label;  
13. import javafx.scene.control.PasswordField;  
14. import javafx.scene.control.TextField;  

72
15. import javafx.scene.control.Alert.AlertType;  
16. import javafx.scene.layout.AnchorPane;  
17.   
18.   
19. public class RegisterController implements Initializable  
20. {     
21.     @FXML  
22.     private AnchorPane acpRegister;  
23.   
24.     @FXML  
25.     private Label lblErrorMessage;  
26.   
27.     @FXML  
28.     private TextField txtFirstName;  
29.       
30.     @FXML  
31.     private TextField txtLastName;  
32.       
33.     @FXML  
34.     private TextField txtStudentID;  
35.       
36.     @FXML  
37.     private PasswordField txtNewPassword;  
38.   
39.     @FXML  
40.     private PasswordField txtConfirmPassword;  
41.       
42.     Database database = new Database();  
43.       
44.   
45.     @Override  
46.     public void initialize(URL location, ResourceBundle resources)   
47.     {  
48.         lblErrorMessage.setText("");  
49.     }  
50.       
51.       
52.     @FXML  
53.     private void register(ActionEvent event) throws Exception  
54.     {  
55.          String studentID = txtStudentID.getText();  
56.          String firstname = txtFirstName.getText();  
57.          String lastname = txtLastName.getText();  
58.          String newPassword = txtNewPassword.getText();  
59.          String confirmPassword = txtConfirmPassword.getText();  
60.            
61.          // if text boxes are empty  
62.         if(studentID.isEmpty() || firstname.isEmpty() || lastname.isEmpty() ||   
63.                 newPassword.isEmpty() || confirmPassword.isEmpty())   
64.         {  

73
65.             lblErrorMessage.setText("All fields are required");  
66.             return; // kicks you out of the method  
67.         }  
68.            
69.         // if student id does not exist in the database  
70.         if (database.doesStudentIDExistInDataBase(studentID) == true)  
71.         {  
72.             lblErrorMessage.setText("Student ID already exist");  
73.             return;  
74.         }  
75.           
76.         // if both password do not match  
77.         if (!newPassword.equals(confirmPassword))   
78.         {  
79.             lblErrorMessage.setText("Password does not match");  
80.             return; // kicks you out of the method  
81.         }  
82.           
83.         int studentId = 0;  
84.         // if student id is a number  
85.         try  
86.         {  
87.             studentId = Integer.parseInt(studentID);  
88.         } catch (NumberFormatException ex)  
89.         {  
90.             lblErrorMessage.setText("Student ID must be a number");  
91.             return; // kicks you out of the method  
92.         }  
93.           
94.   
95.         // if the above condition has been met  
96.         // register new student  
97.         database.onRegisterSuccess(studentId, firstname, lastname, newPassword);  
98.           
99.         // confirmation message box  
100.         Alert alert = new Alert(AlertType.CONFIRMATION);  
101.         alert.setTitle("Event Managemet System - UOB");  
102.         alert.setContentText("Registration Successful.");  
103.         alert.setHeaderText(null);  
104.         alert.showAndWait();  
105.           
106.         // opens login page  
107.         AnchorPane pane = FXMLLoader.load(getClass().getResource("../
Login/Login.fxml"));  
108.         acpRegister.getChildren().setAll(pane);  
109.           
110.     }  
111.       
112.       
113.     @FXML  

74
114.     private  void goToLogin(ActionEvent event) throws IOException   
115.     {  
116.         // opens login page  
117.         AnchorPane pane = FXMLLoader.load(getClass().getResource("../
Login/Login.fxml"));  
118.         acpRegister.getChildren().setAll(pane);  
119.     }  
120.   
121.   
122.       
123. }  

App.SettingsController.java
 package app.Settings;  
   
 import app.Model.Database;  
 import javafx.event.ActionEvent;  
 import javafx.fxml.FXML;  
 import javafx.scene.control.Alert;  
 import javafx.scene.control.Alert.AlertType;  
   
 public class SettingsController  
 {  
     Database database = new Database();  
   
       
     @FXML  
     private void request(ActionEvent event)  
     {  
         // checks if a student already has organization right  
         boolean result = database.doesStudentHaveOrganisationRight();  
         if (result == true)  
         {  
             // error message box  
             Alert alert = new Alert(AlertType.ERROR);  
             alert.setTitle("Event Managemet System - UOB");  
             alert.setContentText("You have already been granted organisation right.");  
             alert.setHeaderText(null);  
             alert.showAndWait();  
         }  
         else   
         {  
             // checks if a student has already sent request before  
             boolean result1 = database.isRequestAlreadySent();  
             if (result1 == true)   
             {  
                 // error message box  

75
                 Alert alert = new Alert(AlertType.ERROR);  
                 alert.setTitle("Event Managemet System - UOB");  
                 alert.setContentText("You have already sent a request.");  
                 alert.setHeaderText(null);  
                 alert.showAndWait();  
             }  
             else   
             {  
                 // send request to database  
                 database.requestForOrganisationRight();  
                   
                 // confirmation message box  
                 Alert alert = new Alert(AlertType.CONFIRMATION);  
                 alert.setTitle("Event Managemet System - UOB");  
                 alert.setContentText("Your request has successfully been sent.");  
                 alert.setHeaderText(null);  
                 alert.showAndWait();  
             }  
               
         }  
     }  
       
       
       
       
       
       
 }

76

You might also like