diff --git a/mysql-connector-j-9.1.0.jar b/mysql-connector-j-9.1.0.jar deleted file mode 100644 index b764ad6..0000000 Binary files a/mysql-connector-j-9.1.0.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index 5e0aeca..6ca5ef7 100644 --- a/pom.xml +++ b/pom.xml @@ -43,8 +43,8 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 14 + 14 diff --git a/Guest.java b/src/Entities/Guest.java similarity index 98% rename from Guest.java rename to src/Entities/Guest.java index b72b8b7..7f578e6 100644 --- a/Guest.java +++ b/src/Entities/Guest.java @@ -1,4 +1,6 @@ +package Entities; import java.time.LocalDate; + public class Guest extends Person { public long id_number; diff --git a/src/Entities/Member.java b/src/Entities/Member.java index bd5d664..f2a100a 100644 --- a/src/Entities/Member.java +++ b/src/Entities/Member.java @@ -1,3 +1,5 @@ +package Entities; + import java.time.LocalDate; public class Member extends Person { diff --git a/src/Entities/People.java b/src/Entities/Person.java similarity index 98% rename from src/Entities/People.java rename to src/Entities/Person.java index 9c783b5..f844a49 100644 --- a/src/Entities/People.java +++ b/src/Entities/Person.java @@ -1,3 +1,5 @@ +package Entities; + import java.time.LocalDate; public class Person { diff --git a/src/Entities/Status.java b/src/Entities/Status.java index 8ba12e2..79b361e 100644 --- a/src/Entities/Status.java +++ b/src/Entities/Status.java @@ -1,3 +1,5 @@ +package Entities; + public enum Status { STAFF, CLUB_MANAGER diff --git a/LogIn.java b/src/LogIn.java similarity index 93% rename from LogIn.java rename to src/LogIn.java index 0146919..3ceb188 100644 --- a/LogIn.java +++ b/src/LogIn.java @@ -1,3 +1,6 @@ +import Pages.LoginPage; + +import Entities.Guest; import javax.swing.*; public class LogIn { diff --git a/src/Main.java b/src/Main.java index f797cbd..6931837 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,3 +1,5 @@ +import Entities.*; + public class Main { public static void main(String[] args) { LogIn login = new LogIn(); diff --git a/src/Pages/CreateForm/CreateForm.form b/src/Pages/CreateForm.form similarity index 98% rename from src/Pages/CreateForm/CreateForm.form rename to src/Pages/CreateForm.form index 9719c6b..6771800 100644 --- a/src/Pages/CreateForm/CreateForm.form +++ b/src/Pages/CreateForm.form @@ -1,201 +1,201 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Pages/CreateForm/CreateForm.java b/src/Pages/CreateForm.java similarity index 99% rename from src/Pages/CreateForm/CreateForm.java rename to src/Pages/CreateForm.java index 883a0ee..3f182a3 100644 --- a/src/Pages/CreateForm/CreateForm.java +++ b/src/Pages/CreateForm.java @@ -1,3 +1,6 @@ +package Pages; + +import Entities.Member; import javax.swing.*; import java.awt.*; @@ -121,4 +124,4 @@ public Long createUniqueID(Connection conn) { } return id; } -} \ No newline at end of file +} diff --git a/src/Pages/HealthClubHomePage/HealthClubHomePage.form b/src/Pages/HealthClubHomePage.form similarity index 97% rename from src/Pages/HealthClubHomePage/HealthClubHomePage.form rename to src/Pages/HealthClubHomePage.form index b135b23..a280d45 100644 --- a/src/Pages/HealthClubHomePage/HealthClubHomePage.form +++ b/src/Pages/HealthClubHomePage.form @@ -1,425 +1,425 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Pages/HealthClubHomePage/HealthClubHomePage.java b/src/Pages/HealthClubHomePage.java similarity index 94% rename from src/Pages/HealthClubHomePage/HealthClubHomePage.java rename to src/Pages/HealthClubHomePage.java index f8eeec3..30b9e6d 100644 --- a/src/Pages/HealthClubHomePage/HealthClubHomePage.java +++ b/src/Pages/HealthClubHomePage.java @@ -1,3 +1,6 @@ +package Pages; + +import Entities.*; import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.*; @@ -13,7 +16,7 @@ import java.util.Objects; import java.util.Vector; -public class HealthClubHomePage extends JFrame implements jdbcValues{ +public class HealthClubHomePage extends JFrame implements jdbcValues { final Vector cols = new Vector<>(Arrays.asList("ID", "First Name", "Last Name", "Birthday", "Email", "Phone Number")); private Guest user; @@ -165,7 +168,9 @@ public void actionPerformed(ActionEvent e) { "\n\tBirthday: " + member.date_of_birth, "Confirm Deletion", JOptionPane.YES_NO_OPTION); switch (result) { - case JOptionPane.NO_OPTION -> JOptionPane.showMessageDialog(HealthClubHomePage.this, "Deletion was unsuccessful", "Member Deletion", JOptionPane.INFORMATION_MESSAGE); + case JOptionPane.NO_OPTION -> { + JOptionPane.showMessageDialog(HealthClubHomePage.this, "Deletion was unsuccessful", "Member Deletion", JOptionPane.INFORMATION_MESSAGE); + } case JOptionPane.YES_OPTION -> { boolean deleted = deleteMember(member.id_number); JOptionPane.showMessageDialog(HealthClubHomePage.this, @@ -194,7 +199,7 @@ public void actionPerformed(ActionEvent e) { public void initializeTable(){ Vector> data = new Vector<>(); try{ - Connection conn = DriverManager.getConnection(DB_URL,DB_USERNAME,DB_PASSWORD); + Connection conn = DriverManager.getConnection(jdbcValues.DB_URL, jdbcValues.DB_USERNAME, jdbcValues.DB_PASSWORD); Statement stmt = conn.createStatement(); String query = "SELECT id_number, first_name, last_name, birth_date, email_address, phone_number FROM members"; ResultSet rs = stmt.executeQuery(query); @@ -231,7 +236,7 @@ public boolean isCellEditable(int row, int column) { public void searchTable(Member member) { Vector> data = new Vector<>(); try{ - Connection conn = DriverManager.getConnection(DB_URL,DB_USERNAME,DB_PASSWORD); + Connection conn = DriverManager.getConnection(jdbcValues.DB_URL, jdbcValues.DB_USERNAME, jdbcValues.DB_PASSWORD); String query = "SELECT id_number, first_name, last_name, birth_date, email_address, phone_number " + "FROM members " + "WHERE id_number LIKE ? " + @@ -269,7 +274,7 @@ public void searchTable(Member member) { public Member getMember(long id) { Member member = null; try{ - Connection conn = DriverManager.getConnection(DB_URL,DB_USERNAME,DB_PASSWORD); + Connection conn = DriverManager.getConnection(jdbcValues.DB_URL, jdbcValues.DB_USERNAME, jdbcValues.DB_PASSWORD); String query = "SELECT * FROM members WHERE id_number=?"; PreparedStatement preparedStatement = conn.prepareStatement(query); preparedStatement.setLong(1,id); @@ -298,7 +303,7 @@ public Member getMember(long id) { public boolean deleteMember(long id) { boolean deleted = false; try{ - Connection conn = DriverManager.getConnection(DB_URL,DB_USERNAME,DB_PASSWORD); + Connection conn = DriverManager.getConnection(jdbcValues.DB_URL, jdbcValues.DB_USERNAME, jdbcValues.DB_PASSWORD); String query = "DELETE FROM members WHERE id_number=?"; PreparedStatement preparedStatement = conn.prepareStatement(query); preparedStatement.setLong(1,id); @@ -315,7 +320,7 @@ public boolean deleteMember(long id) { public boolean renewMembership(long id, int md){ boolean renewed = false; try { - Connection conn = DriverManager.getConnection(DB_URL,DB_USERNAME,DB_PASSWORD); + Connection conn = DriverManager.getConnection(jdbcValues.DB_URL, jdbcValues.DB_USERNAME, jdbcValues.DB_PASSWORD); String query = "UPDATE members SET expiration_date = DATE_ADD(expiration_date, INTERVAL ? MONTH) , last_checked_in_date = ? WHERE id_number = ?"; PreparedStatement preparedStatement = conn.prepareStatement(query); preparedStatement.setInt(1, md); @@ -333,7 +338,7 @@ public boolean renewMembership(long id, int md){ public boolean updateMembership(Member member) { boolean updated = false; try{ - Connection conn = DriverManager.getConnection(DB_URL,DB_USERNAME,DB_PASSWORD); + Connection conn = DriverManager.getConnection(jdbcValues.DB_URL, jdbcValues.DB_USERNAME, jdbcValues.DB_PASSWORD); String query = "UPDATE members SET first_name=?, last_name=?, email_address=?, phone_number=? WHERE id_number=?"; PreparedStatement preparedStatement = conn.prepareStatement(query); preparedStatement.setString(1,member.first_name); diff --git a/src/Pages/InactiveMemberList.form b/src/Pages/InactiveMemberList.form new file mode 100644 index 0000000..d4d94bd --- /dev/null +++ b/src/Pages/InactiveMemberList.form @@ -0,0 +1,77 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/InactiveMemberList.java b/src/Pages/InactiveMemberList.java similarity index 97% rename from InactiveMemberList.java rename to src/Pages/InactiveMemberList.java index c6bd064..5fca25f 100644 --- a/InactiveMemberList.java +++ b/src/Pages/InactiveMemberList.java @@ -1,6 +1,7 @@ +package Pages; + import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.filechooser.FileView; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import java.awt.*; @@ -91,7 +92,7 @@ public static void saveTableToFile(JTable table){ FileNameExtensionFilter f = new FileNameExtensionFilter("Text Files", "txt"); jfc.setFileFilter(f); - File defaultFile = new File("InactiveMemberList.txt"); + File defaultFile = new File("Pages.InactiveMemberList.txt"); jfc.setSelectedFile(defaultFile); // Set file selection mode to display both files and directories diff --git a/src/Pages/LoginPage/LoginPage.form b/src/Pages/LoginPage.form similarity index 100% rename from src/Pages/LoginPage/LoginPage.form rename to src/Pages/LoginPage.form diff --git a/src/Pages/LoginPage/LoginPage.java b/src/Pages/LoginPage.java similarity index 92% rename from src/Pages/LoginPage/LoginPage.java rename to src/Pages/LoginPage.java index 1ff1d16..bd7d8a5 100644 --- a/src/Pages/LoginPage/LoginPage.java +++ b/src/Pages/LoginPage.java @@ -1,10 +1,13 @@ +package Pages; + +import Entities.Guest; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; -public class LoginPage extends JDialog implements jdbcValues{ +public class LoginPage extends JDialog implements jdbcValues { private JFormattedTextField ftfUserId; private JPasswordField pfPassword; private JButton loginButton; @@ -50,7 +53,7 @@ public void actionPerformed(ActionEvent e) { private Guest getAuthenticatedGuest(long id, String password){ Guest guest = null; try{ - Connection conn = DriverManager.getConnection(DB_URL,DB_USERNAME,DB_PASSWORD); + Connection conn = DriverManager.getConnection(jdbcValues.DB_URL, jdbcValues.DB_USERNAME, jdbcValues.DB_PASSWORD); Statement stmt = conn.createStatement(); String query = "SELECT * FROM employees WHERE user_id=? AND password=?"; PreparedStatement preparedStatement = conn.prepareStatement(query); diff --git a/src/Pages/jdbcValues.java b/src/Pages/jdbcValues.java index 74c7d6b..60d14a8 100644 --- a/src/Pages/jdbcValues.java +++ b/src/Pages/jdbcValues.java @@ -1,3 +1,5 @@ +package Pages; + public interface jdbcValues { final String DB_URL = "jdbc:mysql://localhost:3306/softeng_health_club_db"; final String DB_USERNAME = "root"; diff --git a/SoftEngHealthClubSystem.java b/src/SoftEngHealthClubSystem.java similarity index 85% rename from SoftEngHealthClubSystem.java rename to src/SoftEngHealthClubSystem.java index b0873be..dac6456 100644 --- a/SoftEngHealthClubSystem.java +++ b/src/SoftEngHealthClubSystem.java @@ -1,3 +1,7 @@ +import Pages.HealthClubHomePage; +import Entities.*; +import javax.swing.*; + public class SoftEngHealthClubSystem { public Guest user;