Skip to content

Commit

Permalink
Finalized changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JaiCantCode committed Dec 2, 2024
1 parent a59e8ea commit bb3d7f2
Show file tree
Hide file tree
Showing 18 changed files with 749 additions and 641 deletions.
Binary file removed mysql-connector-j-9.1.0.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>14</source>
<target>14</target>
</configuration>
</plugin>

Expand Down
2 changes: 2 additions & 0 deletions Guest.java → src/Entities/Guest.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package Entities;
import java.time.LocalDate;

public class Guest extends Person {

public long id_number;
Expand Down
2 changes: 2 additions & 0 deletions src/Entities/Member.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package Entities;

import java.time.LocalDate;

public class Member extends Person {
Expand Down
2 changes: 2 additions & 0 deletions src/Entities/People.java → src/Entities/Person.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package Entities;

import java.time.LocalDate;

public class Person {
Expand Down
2 changes: 2 additions & 0 deletions src/Entities/Status.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package Entities;

public enum Status {
STAFF,
CLUB_MANAGER
Expand Down
3 changes: 3 additions & 0 deletions LogIn.java → src/LogIn.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import Pages.LoginPage;

import Entities.Guest;
import javax.swing.*;

public class LogIn {
Expand Down
2 changes: 2 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Entities.*;

public class Main {
public static void main(String[] args) {
LogIn login = new LogIn();
Expand Down
402 changes: 201 additions & 201 deletions src/Pages/CreateForm/CreateForm.form → src/Pages/CreateForm.form

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package Pages;

import Entities.Member;

import javax.swing.*;
import java.awt.*;
Expand Down Expand Up @@ -121,4 +124,4 @@ public Long createUniqueID(Connection conn) {
}
return id;
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package Pages;

import Entities.*;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
Expand All @@ -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<String> cols = new Vector<>(Arrays.asList("ID", "First Name", "Last Name", "Birthday", "Email", "Phone Number"));
private Guest user;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -194,7 +199,7 @@ public void actionPerformed(ActionEvent e) {
public void initializeTable(){
Vector<Vector<Object>> 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);
Expand Down Expand Up @@ -231,7 +236,7 @@ public boolean isCellEditable(int row, int column) {
public void searchTable(Member member) {
Vector<Vector<Object>> 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 ? " +
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
77 changes: 77 additions & 0 deletions src/Pages/InactiveMemberList.form
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="Pages.InactiveMemberList">
<grid id="27dc6" binding="InactiveMemberListPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="6" left="6" bottom="6" right="6"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties>
<background color="-16744320"/>
</properties>
<border type="none"/>
<children>
<grid id="1896c" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="bevel-raised"/>
<children>
<component id="d5534" class="javax.swing.JLabel" binding="welcome">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="MS Reference Sans Serif" size="16" style="1"/>
<text value="Welcome Club Manager"/>
</properties>
</component>
</children>
</grid>
<grid id="b11bd" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="bevel-raised" title="Inactive Member List" title-justification="2" title-position="3"/>
<children>
<scrollpane id="ef9aa">
<constraints>
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="bevel-lowered"/>
<children>
<component id="2f72e" class="javax.swing.JTable" binding="inactiveMemberTable">
<constraints/>
<properties>
<background color="-55"/>
</properties>
</component>
</children>
</scrollpane>
<component id="20f9d" class="javax.swing.JButton" binding="downloadButton" default-binding="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Download"/>
</properties>
</component>
<hspacer id="d9b80">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="7b4eb">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</children>
</grid>
</form>
5 changes: 3 additions & 2 deletions InactiveMemberList.java → src/Pages/InactiveMemberList.java
Original file line number Diff line number Diff line change
@@ -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.*;
Expand Down Expand Up @@ -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
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/Pages/jdbcValues.java
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import Pages.HealthClubHomePage;
import Entities.*;
import javax.swing.*;

public class SoftEngHealthClubSystem {

public Guest user;
Expand Down

0 comments on commit bb3d7f2

Please sign in to comment.