Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
notnayan committed Jun 2, 2023
0 parents commit 733ff67
Show file tree
Hide file tree
Showing 178 changed files with 2,987 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-19">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Users/Acer/Downloads/mysql-connector-j-8.0.31.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>courseManagementSystem</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1685697234452</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
14 changes: 14 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=19
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=19
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=19
Binary file added bin/DP/1 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/DP/2 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/DP/3 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/DP/4 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/DP/5 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/DP/6 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/DP/7 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/DP/8 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/UML_Class_Diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/courseManagementSystem/Auth.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$1.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$10.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$11.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$12.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$13.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$14.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$15.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$16.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$17.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$18.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$19.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$2.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$20.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$3.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$4.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$5.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$6.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$7.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$8.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard$9.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Dashboard.class
Binary file not shown.
Binary file added bin/courseManagementSystem/DbManager.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditCourse$1.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditCourse$2.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditCourse.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditModule$1.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditModule$2.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditModule$3.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditModule.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditTeacher$1.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditTeacher$2.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditTeacher$3.class
Binary file not shown.
Binary file added bin/courseManagementSystem/EditTeacher.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$1.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$10.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$11.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$12.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$13.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$14.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$15$1.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$15.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$2.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$3.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$4.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$5.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$6.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$7.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$8.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form$9.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Form.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Regex.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Reportcard$1.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Reportcard$2.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Reportcard$3.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Reportcard$4.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Reportcard$5.class
Binary file not shown.
Binary file added bin/courseManagementSystem/Reportcard.class
Binary file not shown.
Binary file added bin/courseManagementSystem/StudentView.class
Binary file not shown.
Binary file added bin/courseManagementSystem/test$1.class
Binary file not shown.
Binary file added bin/courseManagementSystem/test.class
Binary file not shown.
Binary file added bin/pics/accountIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/addIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/backIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/bgImg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/bookshelfIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/cheerIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/confetti.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/courseIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/creportIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/dashCourse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/dashStud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/dashTeach.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/dashboardIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/editIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/envelopeIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/estdIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/pics/eteachIcon.png
Binary file added bin/pics/fbIcon.png
Binary file added bin/pics/gRIcon.png
Binary file added bin/pics/googleIcon.png
Binary file added bin/pics/gradeIcon.png
Binary file added bin/pics/handShake.png
Binary file added bin/pics/heraldIcon.png
Binary file added bin/pics/instaIcon.png
Binary file added bin/pics/instructorIcon.png
Binary file added bin/pics/logOut.png
Binary file added bin/pics/passIcon.png
Binary file added bin/pics/phoneIcon.png
Binary file added bin/pics/roleIcon.png
Binary file added bin/pics/searchIcon.png
Binary file added bin/pics/settingsIcon.png
Binary file added bin/pics/sirenIcon.png
Binary file added bin/pics/skullyHeartIcon.png
Binary file added bin/pics/sleepingIcon.png
Binary file added bin/pics/studentIcon.png
Binary file added bin/pics/thumbsIcon.png
Binary file added bin/pics/titleIcon.png
Binary file added bin/pics/todoIcon.png
Binary file added bin/pics/trashIcon.png
Binary file added bin/pics/twtIcon.png
Binary file added bin/pics/userIcon.png
Binary file added bin/pics/watchIcon.png
Binary file added bin/pics/welcomeIcon.png
Binary file added src/DP/1 (1).png
Binary file added src/DP/2 (1).png
Binary file added src/DP/3 (1).png
Binary file added src/DP/4 (1).png
Binary file added src/DP/5 (1).png
Binary file added src/DP/6 (1).png
Binary file added src/DP/7 (1).png
Binary file added src/DP/8 (1).png
193 changes: 193 additions & 0 deletions src/courseManagementSystem/Auth.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
package courseManagementSystem;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;


public class Auth {
private static PreparedStatement checkEmailStmt;
private static PreparedStatement retrieveRoleStmt;
private static PreparedStatement checkEmailExistenceStmt;
private static PreparedStatement addCredentialStmt;

private static PreparedStatement addCourseStmt;
private static PreparedStatement deleteCourseStmt;

private static PreparedStatement addModuleStmt;
private static PreparedStatement deleteModuleStmt;

private static PreparedStatement addTeachStmt;
private static PreparedStatement deleteTeachStmt;

private static PreparedStatement addResultsStmt;
private static PreparedStatement addComboItemsStmt;

public Auth(DbManager db) throws SQLException {
checkEmailStmt = db.getConnection().prepareStatement("SELECT count(*) FROM auth WHERE email=?");
retrieveRoleStmt = db.getConnection()
.prepareStatement("SELECT name,role FROM auth WHERE email=? AND BINARY password=?");
checkEmailExistenceStmt = db.getConnection().prepareStatement("SELECT email FROM auth WHERE email=?");
addCredentialStmt = db.getConnection()
.prepareStatement("INSERT INTO auth (name, email, phoneNo, role, password, course) VALUES (?,?,?,'Student',?,?)");

addCourseStmt = db.getConnection().prepareStatement("INSERT INTO courses(course_name) VALUES (?)");
deleteCourseStmt = db.getConnection().prepareStatement("DELETE FROM courses WHERE course_name = ?");

addModuleStmt = db.getConnection().prepareStatement("INSERT INTO modules(module_name, module_type, course_id) VALUES (?,?,?)");
deleteModuleStmt = db.getConnection().prepareStatement("DELETE FROM modules WHERE module_name = ?");

addTeachStmt = db.getConnection().
prepareStatement("INSERT INTO auth (name, email, phoneNo, role, password, course) VALUES (?,?,?,'Teacher',?,?)");
deleteTeachStmt = db.getConnection().prepareStatement("DELETE FROM auth WHERE email = ?");

addResultsStmt = db.getConnection()
.prepareStatement("INSERT INTO results(`student_id`, `module_id`, `marks`) VALUES (?,?,?)");

addComboItemsStmt = db.getConnection()
.prepareStatement("SELECT course_name FROM courses");

}

public ArrayList<String> login(String email, String password) throws Exception {
ArrayList<String> arrayList = new ArrayList<String>();
try {
checkEmailStmt.setString(1, email);
ResultSet rs = checkEmailStmt.executeQuery();
int count = 0;
if (rs.next()) {
}
count = rs.getInt(1);
if (count == 0)
throw new Exception("No user with this email found!");
else {
retrieveRoleStmt.setString(1, email);
retrieveRoleStmt.setString(2, password);
rs = retrieveRoleStmt.executeQuery();
if (rs.next()) {
arrayList.add(rs.getString("name"));
arrayList.add(rs.getString("role"));
return arrayList;
} else
throw new Exception("Password not valid!");
}
} catch (SQLException e) {
System.out.println(e.getMessage());
throw new Exception("An error occurred while checking the email and password!");
}
}

public void addCredential(String name, String email, String password, String phoneNo, String comboBox) throws Exception {
try {
checkEmailExistenceStmt.setString(1, email);
ResultSet rs = checkEmailExistenceStmt.executeQuery();
if (rs.next()) {
throw new Exception("Email already in use!");
} else {
addCredentialStmt.setString(1, name);
addCredentialStmt.setString(2, email);
addCredentialStmt.setString(3, password);
addCredentialStmt.setString(4, phoneNo);
addCredentialStmt.setString(5, comboBox);
addCredentialStmt.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
}

public static void addCourse(String course_name) throws Exception {
try {
addCourseStmt.setString(1,course_name);
addCourseStmt.executeUpdate();
}
catch (SQLException e) {
System.out.println(e.getMessage());
throw new Exception("An error occurred while adding new course!");

}
}

public static void deleteCourse(String course_name) throws Exception {
try {
deleteCourseStmt.setString(1, course_name);
deleteCourseStmt.executeUpdate();
} catch (SQLException e) {
System.out.println(e.getMessage());
throw new Exception("An error occurred trying to delete the course!");
}
}

public static void addModule(String module_name, String module_type, String course_ID) throws Exception {
try {
addModuleStmt.setString(1,module_name);
addModuleStmt.setString(2,module_type);
addModuleStmt.setString(3,course_ID);
addModuleStmt.executeUpdate();
}
catch (SQLException e) {
System.out.println(e.getMessage());
throw new Exception("An error occurred while adding module!");

}
}

public static void deleteModule(String module_name) throws Exception {
try {
deleteModuleStmt.setString(1,module_name);
deleteModuleStmt.executeUpdate();
}
catch (SQLException e) {
System.out.println(e.getMessage());
throw new Exception("An error occurred while deleting module!");

}
}

public static void addTeach(String name, String email, String password, String phoneNo, String comboBox) throws Exception {
try {
addTeachStmt.setString(1, name);
addTeachStmt.setString(2, email);
addTeachStmt.setString(3, password);
addTeachStmt.setString(4, phoneNo);
addTeachStmt.setString(5, comboBox);
addTeachStmt.executeUpdate();
}
catch (SQLException e) {
System.out.println(e.getMessage());
throw new Exception("An error occurred while adding teacher!");
}
}

public static void deleteTeach(String email) throws Exception {
try {
deleteTeachStmt.setString(1,email);
deleteTeachStmt.executeUpdate();
}
catch (SQLException e) {
System.out.println(e.getMessage());
throw new Exception("An error occurred while deleting module!");

}
}


public static void addResults(String student_id, String module_id, String marks) throws Exception {
try {
addResultsStmt.setString(1, student_id);
addResultsStmt.setString(2, module_id);
addResultsStmt.setString(3, marks);
addResultsStmt.executeUpdate();
}
catch (SQLException e) {
System.out.println(e.getMessage());
throw new Exception("An error occurred while deleting module!");

}
}

public PreparedStatement getAddComboItemsStmt() {
return addComboItemsStmt;
}
}
Loading

0 comments on commit 733ff67

Please sign in to comment.