├── .idea ├── .gitignore ├── inspectionProfiles │ └── Project_Default.xml ├── misc.xml ├── modules.xml └── uiDesigner.xml ├── CourseManagementSystem.plantuml ├── README.md ├── fina.iml ├── out └── production │ └── fina │ └── com │ ├── Controller │ ├── Controller-__CONTROLLER_s_Class_Diagram____.png │ ├── Controller.plantuml │ ├── CreateDbUtils.class │ └── ManageDbUtils.class │ ├── Main │ ├── Final.iml │ ├── Main.class │ └── Main.plantuml │ ├── Model │ ├── Courses │ │ ├── Course.class │ │ ├── Courses.plantuml │ │ └── Module.class │ └── MainBody │ │ ├── Instructor.class │ │ ├── MainBody.plantuml │ │ ├── Student.class │ │ └── Users.class │ └── View │ ├── AdminFrame$1.class │ ├── AdminFrame$10.class │ ├── AdminFrame$11.class │ ├── AdminFrame$12.class │ ├── AdminFrame$13.class │ ├── AdminFrame$14.class │ ├── AdminFrame$15.class │ ├── AdminFrame$16.class │ ├── AdminFrame$17.class │ ├── AdminFrame$18.class │ ├── AdminFrame$19.class │ ├── AdminFrame$2.class │ ├── AdminFrame$20.class │ ├── AdminFrame$21.class │ ├── AdminFrame$22.class │ ├── AdminFrame$3.class │ ├── AdminFrame$4.class │ ├── AdminFrame$5.class │ ├── AdminFrame$6.class │ ├── AdminFrame$7.class │ ├── AdminFrame$8.class │ ├── AdminFrame$9.class │ ├── AdminFrame.class │ ├── Gui.class │ ├── InstructorFrame$1.class │ ├── InstructorFrame$2.class │ ├── InstructorFrame$3.class │ ├── InstructorFrame$4.class │ ├── InstructorFrame$5.class │ ├── InstructorFrame$6.class │ ├── InstructorFrame$7.class │ ├── InstructorFrame$8.class │ ├── InstructorFrame$9.class │ ├── InstructorFrame.class │ ├── Login$1.class │ ├── Login.class │ ├── Register$1.class │ ├── Register$2.class │ ├── Register.class │ ├── SelectModules$1.class │ ├── SelectModules.class │ ├── StudentFrame$1.class │ ├── StudentFrame$2.class │ ├── StudentFrame$3.class │ ├── StudentFrame$4.class │ ├── StudentFrame$5.class │ ├── StudentFrame$6.class │ ├── StudentFrame$7.class │ ├── StudentFrame$8.class │ ├── StudentFrame$9.class │ ├── StudentFrame.class │ ├── UserType.class │ └── View.plantuml └── src └── com ├── Controller ├── Controller-__CONTROLLER_s_Class_Diagram____.png ├── Controller.plantuml ├── CreateDbUtils.java └── ManageDbUtils.java ├── Main ├── Final.iml ├── Main.java └── Main.plantuml ├── Model ├── Courses │ ├── Course.java │ ├── Courses.plantuml │ └── Module.java └── MainBody │ ├── Instructor.java │ ├── MainBody.plantuml │ ├── Student.java │ └── Users.java └── View ├── AdminFrame.java ├── Gui.java ├── InstructorFrame.java ├── Login.java ├── Register.java ├── SelectModules.java ├── StudentFrame.java ├── UserType.java └── View.plantuml /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /CourseManagementSystem.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __FINA's Class Diagram__\n 4 | 5 | namespace com.Controller { 6 | class com.Controller.CreateDbUtils { 7 | } 8 | } 9 | 10 | 11 | namespace com.Controller { 12 | class com.Controller.ManageDbUtils { 13 | } 14 | } 15 | 16 | 17 | namespace com.Main { 18 | class com.Main.Main { 19 | } 20 | } 21 | 22 | 23 | namespace com.Model.Courses { 24 | class com.Model.Courses.Course { 25 | } 26 | } 27 | 28 | 29 | namespace com.Model.Courses { 30 | class com.Model.Courses.Module { 31 | } 32 | } 33 | 34 | 35 | namespace com.Model.MainBody { 36 | class com.Model.MainBody.Instructor { 37 | } 38 | } 39 | 40 | 41 | namespace com.Model.MainBody { 42 | class com.Model.MainBody.Student { 43 | } 44 | } 45 | 46 | 47 | namespace com.Model.MainBody { 48 | class com.Model.MainBody.Users { 49 | } 50 | } 51 | 52 | 53 | namespace com.View { 54 | class com.View.AdminFrame { 55 | } 56 | } 57 | 58 | 59 | namespace com.View { 60 | class com.View.Gui { 61 | } 62 | } 63 | 64 | 65 | namespace com.View { 66 | class com.View.InstructorFrame { 67 | } 68 | } 69 | 70 | 71 | namespace com.View { 72 | class com.View.Login { 73 | } 74 | } 75 | 76 | 77 | namespace com.View { 78 | class com.View.Register { 79 | } 80 | } 81 | 82 | 83 | namespace com.View { 84 | class com.View.SelectModules { 85 | } 86 | } 87 | 88 | 89 | namespace com.View { 90 | class com.View.StudentFrame { 91 | } 92 | } 93 | 94 | 95 | namespace com.View { 96 | class com.View.UserType { 97 | } 98 | } 99 | 100 | 101 | com.Model.Courses.Course o-- com.Controller.ManageDbUtils : manageDbUtils 102 | com.Model.Courses.Course o-- com.Model.Courses.Module : module 103 | com.Model.MainBody.Instructor -up-|> com.Model.MainBody.Users 104 | com.Model.MainBody.Instructor o-- com.Controller.ManageDbUtils : manageDbUtils 105 | com.Model.MainBody.Student -up-|> com.Model.MainBody.Users 106 | com.Model.MainBody.Student o-- com.Controller.ManageDbUtils : manageDbUtils 107 | com.View.AdminFrame -up-|> javax.swing.JFrame 108 | com.View.AdminFrame o-- com.Model.Courses.Course : course 109 | com.View.AdminFrame o-- com.Controller.ManageDbUtils : manageDbUtils 110 | com.View.AdminFrame o-- com.Model.Courses.Module : module 111 | com.View.InstructorFrame -up-|> javax.swing.JFrame 112 | com.View.Login .up.|> java.awt.event.ActionListener 113 | com.View.Login -up-|> javax.swing.JFrame 114 | com.View.Register -up-|> javax.swing.JFrame 115 | com.View.Register o-- com.Controller.ManageDbUtils : manageDbUtils 116 | com.View.Register o-- com.Model.MainBody.Users : users 117 | com.View.SelectModules -up-|> javax.swing.JFrame 118 | com.View.SelectModules o-- com.Controller.ManageDbUtils : manageDbUtils 119 | com.View.SelectModules o-- com.Model.Courses.Module : module 120 | com.View.StudentFrame -up-|> javax.swing.JFrame 121 | com.View.UserType .up.|> java.awt.event.ActionListener 122 | com.View.UserType -up-|> javax.swing.JFrame 123 | 124 | 125 | right footer 126 | 127 | 128 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 129 | For more information about this tool, please contact philippe.mesmeur@gmail.com 130 | endfooter 131 | 132 | @enduml 133 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Course-Management-System 2 | 3 | This is the simple Course Management System built with Java. 4 | 5 | 6 | ## Database 7 | -> MySQL 8 | 9 | ## Features 10 | 1. Admin 11 | i)CRUD operation of course 12 | ii)CRUD operation of modules 13 | iii)CRUD operation of teachers and students 14 | 15 | 2. Teacher 16 | i)View student detail of given module 17 | ii)Mark student 18 | 19 | 3. Student 20 | i)View selected course and modules 21 | ii)View Teacher Details 22 | -------------------------------------------------------------------------------- /fina.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /out/production/fina/com/Controller/Controller-__CONTROLLER_s_Class_Diagram____.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/Controller/Controller-__CONTROLLER_s_Class_Diagram____.png -------------------------------------------------------------------------------- /out/production/fina/com/Controller/Controller.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __CONTROLLER's Class Diagram__\n 4 | 5 | namespace com.Controller { 6 | class com.Controller.CreateDbUtils { 7 | {static} ~ dbname : String 8 | {static} ~ password : String 9 | {static} ~ url : String 10 | {static} ~ username : String 11 | + CreateDbUtils() 12 | + createTable() 13 | {static} + getDbConnection() 14 | - createCourseTable() 15 | - createInstructorModuleTable() 16 | - createInstructorTable() 17 | - createModuleTable() 18 | - createStudentModuleTable() 19 | - createStudentTable() 20 | - createUserTable() 21 | } 22 | } 23 | 24 | 25 | namespace com.Controller { 26 | class com.Controller.ManageDbUtils { 27 | - con : Connection 28 | + CheckLoginDetails() 29 | + ManageDbUtils() 30 | + addCourse() 31 | + addInstructors() 32 | + addModule() 33 | + assignInstructor() 34 | + deleteCourse() 35 | + deleteModule() 36 | + editCourseName() 37 | + editModuleName() 38 | + getStudentInfo() 39 | + increaseLevel() 40 | + removeInstructors() 41 | + saveInstructorDetails() 42 | + saveInstructorDetails() 43 | + saveStudentDetails() 44 | + saveStudentModule() 45 | + saveUserDetails() 46 | + selectCoreModule() 47 | + selectCoreOrOptionalModule() 48 | + selectCourse() 49 | + selectCourse() 50 | + selectInstructorInfo() 51 | + selectInstructorModule() 52 | + selectInstructorModule() 53 | + selectInstructorsModule() 54 | + selectInstructorsModule() 55 | + selectModule() 56 | + selectModule() 57 | + selectModule() 58 | + selectModule() 59 | + selectModuleDetails() 60 | + selectModuleInfo() 61 | + selectModuleInfo() 62 | + selectModuleInfo() 63 | + selectModuleInstructor() 64 | + selectModules() 65 | + selectOptionalModule() 66 | + selectStudent() 67 | + selectStudent() 68 | + selectStudentId() 69 | + selectStudentName() 70 | + selectStudentsId() 71 | + setCancelStatus() 72 | + updateCourseStatus() 73 | + updateMark() 74 | } 75 | } 76 | 77 | 78 | 79 | 80 | right footer 81 | 82 | 83 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 84 | For more information about this tool, please contact philippe.mesmeur@gmail.com 85 | endfooter 86 | 87 | @enduml 88 | -------------------------------------------------------------------------------- /out/production/fina/com/Controller/CreateDbUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/Controller/CreateDbUtils.class -------------------------------------------------------------------------------- /out/production/fina/com/Controller/ManageDbUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/Controller/ManageDbUtils.class -------------------------------------------------------------------------------- /out/production/fina/com/Main/Final.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /out/production/fina/com/Main/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/Main/Main.class -------------------------------------------------------------------------------- /out/production/fina/com/Main/Main.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __MAIN's Class Diagram__\n 4 | 5 | namespace com.Main { 6 | class com.Main.Main { 7 | {static} + main() 8 | } 9 | } 10 | 11 | 12 | 13 | 14 | right footer 15 | 16 | 17 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 18 | For more information about this tool, please contact philippe.mesmeur@gmail.com 19 | endfooter 20 | 21 | @enduml 22 | -------------------------------------------------------------------------------- /out/production/fina/com/Model/Courses/Course.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/Model/Courses/Course.class -------------------------------------------------------------------------------- /out/production/fina/com/Model/Courses/Courses.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __COURSES's Class Diagram__\n 4 | 5 | namespace com.Model.Courses { 6 | class com.Model.Courses.Course { 7 | ~ mods : ArrayList 8 | - cancelStatus : Boolean 9 | - courseCode : String 10 | - courseName : String 11 | - enrolledStatus : int 12 | - level : String 13 | + Course() 14 | + cancelCourse() 15 | + selectCourse() 16 | + setEnrolledStatus() 17 | } 18 | } 19 | 20 | 21 | namespace com.Model.Courses { 22 | class com.Model.Courses.Module { 23 | - credits : int 24 | - instructorName : String 25 | - marksSecured : Double 26 | - moduleCode : String 27 | - moduleName : String 28 | - moduleType : String 29 | - semester : int 30 | + Module() 31 | + Module() 32 | + getStudentModule() 33 | + moduleInfo() 34 | + numOfCoreModule() 35 | + numOfModule() 36 | + numOfOptionalModule() 37 | + selectCoreModule() 38 | + selectCoreSemester() 39 | + selectGrade() 40 | + selectModule() 41 | + selectModule() 42 | + selectModule() 43 | + selectModule() 44 | + selectModule() 45 | + selectModules() 46 | + selectOptionalModule() 47 | + selectOptionalModules() 48 | + totalNumOfCoreModules() 49 | + totalNumOfModules() 50 | + totalNumOfOptionalModules() 51 | } 52 | } 53 | 54 | 55 | com.Model.Courses.Course o-- com.Controller.ManageDbUtils : manageDbUtils 56 | com.Model.Courses.Course o-- com.Model.Courses.Module : module 57 | 58 | 59 | right footer 60 | 61 | 62 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 63 | For more information about this tool, please contact philippe.mesmeur@gmail.com 64 | endfooter 65 | 66 | @enduml 67 | -------------------------------------------------------------------------------- /out/production/fina/com/Model/Courses/Module.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/Model/Courses/Module.class -------------------------------------------------------------------------------- /out/production/fina/com/Model/MainBody/Instructor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/Model/MainBody/Instructor.class -------------------------------------------------------------------------------- /out/production/fina/com/Model/MainBody/MainBody.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __MAINBODY's Class Diagram__\n 4 | 5 | namespace com.Model.MainBody { 6 | class com.Model.MainBody.Instructor { 7 | - address : String 8 | - email : String 9 | - instructorId : int 10 | - instructorName : String 11 | - modules : String[] 12 | + Instructor() 13 | + Instructor() 14 | + assignInstructor() 15 | + getAddress() 16 | + getEmail() 17 | + getInstructorId() 18 | + getInstructorName() 19 | + selectInstructors() 20 | + selectInstructorsModule() 21 | + selectUpdatedInstructors() 22 | + selectUpdatedInstructors() 23 | + setAddress() 24 | + setEmail() 25 | + setInstructorId() 26 | + setInstructorInfo() 27 | + setInstructorName() 28 | } 29 | } 30 | 31 | 32 | namespace com.Model.MainBody { 33 | class com.Model.MainBody.Student { 34 | ~ modulesSelected : ArrayList 35 | - address : String 36 | - course : String 37 | - eligibleForNextSem : Boolean 38 | - emailAddress : String 39 | - level : String 40 | - remarks : String 41 | - semester : String 42 | - studentId : int 43 | - studentName : String 44 | + Student() 45 | + Student() 46 | + getAddress() 47 | + getCourse() 48 | + getEligibleForNextSem() 49 | + getEmailAddress() 50 | + getLevel() 51 | + getRemarks() 52 | + getStudentId() 53 | + getStudentModule() 54 | + getStudentName() 55 | + noOfStudents() 56 | + selectRemark() 57 | + selectStudent() 58 | + selectStudentDetails() 59 | + selectStudentId() 60 | + selectStudentName() 61 | + selectStudentsId() 62 | + setAddress() 63 | + setCourse() 64 | + setEligibleForNextSem() 65 | + setEmailAddress() 66 | + setLevel() 67 | + setRemarks() 68 | + setStudentInfo() 69 | + setStudentName() 70 | } 71 | } 72 | 73 | 74 | namespace com.Model.MainBody { 75 | class com.Model.MainBody.Users { 76 | - con : Connection 77 | - userId : String 78 | - userPassword : String 79 | - userType : String 80 | + GenerateID() 81 | + getUserId() 82 | + getUserPassword() 83 | + getUserType() 84 | + setUserId() 85 | + setUserPassword() 86 | + setUserType() 87 | + users() 88 | } 89 | } 90 | 91 | 92 | com.Model.MainBody.Instructor -up-|> com.Model.MainBody.Users 93 | com.Model.MainBody.Instructor o-- com.Controller.ManageDbUtils : manageDbUtils 94 | com.Model.MainBody.Student -up-|> com.Model.MainBody.Users 95 | com.Model.MainBody.Student o-- com.Controller.ManageDbUtils : manageDbUtils 96 | 97 | 98 | right footer 99 | 100 | 101 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 102 | For more information about this tool, please contact philippe.mesmeur@gmail.com 103 | endfooter 104 | 105 | @enduml 106 | -------------------------------------------------------------------------------- /out/production/fina/com/Model/MainBody/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/Model/MainBody/Student.class -------------------------------------------------------------------------------- /out/production/fina/com/Model/MainBody/Users.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/Model/MainBody/Users.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$1.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$10.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$10.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$11.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$11.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$12.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$12.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$13.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$13.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$14.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$14.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$15.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$15.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$16.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$16.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$17.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$17.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$18.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$18.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$19.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$19.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$2.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$20.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$20.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$21.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$21.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$22.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$22.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$3.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$4.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$5.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$6.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$7.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$8.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame$9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame$9.class -------------------------------------------------------------------------------- /out/production/fina/com/View/AdminFrame.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/AdminFrame.class -------------------------------------------------------------------------------- /out/production/fina/com/View/Gui.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/Gui.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame$1.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame$2.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame$3.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame$4.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame$5.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame$6.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame$7.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame$8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame$8.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame$9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame$9.class -------------------------------------------------------------------------------- /out/production/fina/com/View/InstructorFrame.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/InstructorFrame.class -------------------------------------------------------------------------------- /out/production/fina/com/View/Login$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/Login$1.class -------------------------------------------------------------------------------- /out/production/fina/com/View/Login.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/Login.class -------------------------------------------------------------------------------- /out/production/fina/com/View/Register$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/Register$1.class -------------------------------------------------------------------------------- /out/production/fina/com/View/Register$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/Register$2.class -------------------------------------------------------------------------------- /out/production/fina/com/View/Register.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/Register.class -------------------------------------------------------------------------------- /out/production/fina/com/View/SelectModules$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/SelectModules$1.class -------------------------------------------------------------------------------- /out/production/fina/com/View/SelectModules.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/SelectModules.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame$1.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame$2.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame$3.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame$4.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame$5.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame$6.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame$7.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame$8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame$8.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame$9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame$9.class -------------------------------------------------------------------------------- /out/production/fina/com/View/StudentFrame.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/StudentFrame.class -------------------------------------------------------------------------------- /out/production/fina/com/View/UserType.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/out/production/fina/com/View/UserType.class -------------------------------------------------------------------------------- /out/production/fina/com/View/View.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __VIEW's Class Diagram__\n 4 | 5 | namespace com.View { 6 | class com.View.AdminFrame { 7 | - buttonName : JButton 8 | - frame : JFrame 9 | + AddEditCourseFrame() 10 | + AddEditInstructorFrame() 11 | + AddEditModuleFrame() 12 | + AddEditStudentsGradeFrame() 13 | + AddStudentResultFrame() 14 | + AdminFrame() 15 | + BottomFramePanel() 16 | + createAdminFrame() 17 | + editButton() 18 | } 19 | } 20 | 21 | 22 | namespace com.View { 23 | class com.View.Gui { 24 | + Gui() 25 | } 26 | } 27 | 28 | 29 | namespace com.View { 30 | class com.View.InstructorFrame { 31 | - buttonName : JButton 32 | + AddInstructorModule() 33 | + AddProfileFrame() 34 | + BottomFramePanel() 35 | + createInstructorFrame() 36 | + editButton() 37 | } 38 | } 39 | 40 | 41 | namespace com.View { 42 | class com.View.Login { 43 | ~ c : Container 44 | - Users : Object[] 45 | - frame : JFrame 46 | - loginBtn : JButton 47 | - passwordTextField : JPasswordField 48 | - registerBtn : JButton 49 | - selectUserType : JComboBox 50 | - userType : JComboBox 51 | - userTypes : String[] 52 | - usernameTextField : JTextField 53 | + Login() 54 | + actionPerformed() 55 | } 56 | } 57 | 58 | 59 | namespace com.View { 60 | class com.View.Register { 61 | - GetAddress : JTextField 62 | - GetConfirmPassword : JPasswordField 63 | - GetEmailAddress : JTextField 64 | - GetLevel : JComboBox 65 | - GetName : JTextField 66 | - GetPassword : JPasswordField 67 | - Level : Object[] 68 | - registrationFrame : JFrame 69 | ~ Register() 70 | ~ Register() 71 | } 72 | } 73 | 74 | 75 | namespace com.View { 76 | class com.View.SelectModules { 77 | ~ rowData : String[][] 78 | - columnNames : Object[] 79 | - frame : JFrame 80 | + SelectModules() 81 | } 82 | } 83 | 84 | 85 | namespace com.View { 86 | class com.View.StudentFrame { 87 | - buttonName : JButton 88 | + AddModuleDetailFrame() 89 | + AddModuleEnrolledFrame() 90 | + AddProfileFrame() 91 | + BottomFramePanel() 92 | + createStudentFrame() 93 | + editButton() 94 | } 95 | } 96 | 97 | 98 | namespace com.View { 99 | class com.View.UserType { 100 | - InstructorID : int 101 | - instructor : JRadioButton 102 | - next : JButton 103 | - student : JRadioButton 104 | + actionPerformed() 105 | ~ UserType() 106 | } 107 | } 108 | 109 | 110 | com.View.AdminFrame -up-|> javax.swing.JFrame 111 | com.View.AdminFrame o-- com.Model.Courses.Course : course 112 | com.View.AdminFrame o-- com.Controller.ManageDbUtils : manageDbUtils 113 | com.View.AdminFrame o-- com.Model.Courses.Module : module 114 | com.View.InstructorFrame -up-|> javax.swing.JFrame 115 | com.View.Login .up.|> java.awt.event.ActionListener 116 | com.View.Login -up-|> javax.swing.JFrame 117 | com.View.Register -up-|> javax.swing.JFrame 118 | com.View.Register o-- com.Controller.ManageDbUtils : manageDbUtils 119 | com.View.Register o-- com.Model.MainBody.Users : users 120 | com.View.SelectModules -up-|> javax.swing.JFrame 121 | com.View.SelectModules o-- com.Controller.ManageDbUtils : manageDbUtils 122 | com.View.SelectModules o-- com.Model.Courses.Module : module 123 | com.View.StudentFrame -up-|> javax.swing.JFrame 124 | com.View.UserType .up.|> java.awt.event.ActionListener 125 | com.View.UserType -up-|> javax.swing.JFrame 126 | 127 | 128 | right footer 129 | 130 | 131 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 132 | For more information about this tool, please contact philippe.mesmeur@gmail.com 133 | endfooter 134 | 135 | @enduml 136 | -------------------------------------------------------------------------------- /src/com/Controller/Controller-__CONTROLLER_s_Class_Diagram____.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BishalDali/Course-Management-System/05f9f49b3225edd1cc4a7a19887b8ee606443aec/src/com/Controller/Controller-__CONTROLLER_s_Class_Diagram____.png -------------------------------------------------------------------------------- /src/com/Controller/Controller.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __CONTROLLER's Class Diagram__\n 4 | 5 | namespace com.Controller { 6 | class com.Controller.CreateDbUtils { 7 | {static} ~ dbname : String 8 | {static} ~ password : String 9 | {static} ~ url : String 10 | {static} ~ username : String 11 | + CreateDbUtils() 12 | + createTable() 13 | {static} + getDbConnection() 14 | - createCourseTable() 15 | - createInstructorModuleTable() 16 | - createInstructorTable() 17 | - createModuleTable() 18 | - createStudentModuleTable() 19 | - createStudentTable() 20 | - createUserTable() 21 | } 22 | } 23 | 24 | 25 | namespace com.Controller { 26 | class com.Controller.ManageDbUtils { 27 | - con : Connection 28 | + CheckLoginDetails() 29 | + ManageDbUtils() 30 | + addCourse() 31 | + addInstructors() 32 | + addModule() 33 | + assignInstructor() 34 | + deleteCourse() 35 | + deleteModule() 36 | + editCourseName() 37 | + editModuleName() 38 | + getStudentInfo() 39 | + increaseLevel() 40 | + removeInstructors() 41 | + saveInstructorDetails() 42 | + saveInstructorDetails() 43 | + saveStudentDetails() 44 | + saveStudentModule() 45 | + saveUserDetails() 46 | + selectCoreModule() 47 | + selectCoreOrOptionalModule() 48 | + selectCourse() 49 | + selectCourse() 50 | + selectInstructorInfo() 51 | + selectInstructorModule() 52 | + selectInstructorModule() 53 | + selectInstructorsModule() 54 | + selectInstructorsModule() 55 | + selectModule() 56 | + selectModule() 57 | + selectModule() 58 | + selectModule() 59 | + selectModuleDetails() 60 | + selectModuleInfo() 61 | + selectModuleInfo() 62 | + selectModuleInfo() 63 | + selectModuleInstructor() 64 | + selectModules() 65 | + selectOptionalModule() 66 | + selectStudent() 67 | + selectStudent() 68 | + selectStudentId() 69 | + selectStudentName() 70 | + selectStudentsId() 71 | + setCancelStatus() 72 | + updateCourseStatus() 73 | + updateMark() 74 | } 75 | } 76 | 77 | 78 | 79 | 80 | right footer 81 | 82 | 83 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 84 | For more information about this tool, please contact philippe.mesmeur@gmail.com 85 | endfooter 86 | 87 | @enduml 88 | -------------------------------------------------------------------------------- /src/com/Controller/CreateDbUtils.java: -------------------------------------------------------------------------------- 1 | package com.Controller; 2 | 3 | import com.Model.Courses.Module; 4 | import com.Model.MainBody.Instructor; 5 | 6 | import javax.swing.*; 7 | import java.sql.*; 8 | 9 | 10 | public class CreateDbUtils { 11 | static final String username = "root"; 12 | static final String password = ""; 13 | static final String url = "jdbc:mysql://localhost/"; 14 | static final String dbname = "CourseManagementSystem"; 15 | 16 | 17 | public CreateDbUtils() { 18 | //Database connection and its utilities 19 | try { 20 | Connection conn = DriverManager.getConnection(url, username, password); 21 | Statement command = conn.createStatement(); 22 | String sql = "Create Database " + dbname; 23 | command.execute(sql); 24 | System.out.println("Database has been successfully created."); 25 | } catch (SQLException se) { 26 | System.out.println("Database Already Exists!"); 27 | } catch (Exception e) { 28 | e.printStackTrace(); 29 | JOptionPane.showMessageDialog(null, "Couldn't connect to the database! Please make sure that your database server is active.", "Connection Error!", JOptionPane.ERROR_MESSAGE); 30 | System.exit(0); 31 | } 32 | createTable(); 33 | } 34 | 35 | public static Connection getDbConnection() { 36 | try{ 37 | String Username = "root"; 38 | String Password = ""; 39 | String dbName = "coursemanagementsystem"; 40 | String connectionString = "jdbc:mysql://localhost/"+dbName+"?useTimezone=true&serverTimezone=UTC"; 41 | DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver()); 42 | return DriverManager.getConnection(connectionString, Username,Password); 43 | } catch(SQLException e){ 44 | e.printStackTrace(); 45 | JOptionPane.showMessageDialog(null, "Couldn't connect to the database! Please make sure that your database server is active.", "Connection Error!", JOptionPane.ERROR_MESSAGE); 46 | System.exit(0); 47 | return null; 48 | } 49 | } 50 | 51 | public void createTable(){ 52 | createStudentTable(); 53 | createInstructorTable(); 54 | createModuleTable(); 55 | createCourseTable(); 56 | createUserTable(); 57 | createStudentModuleTable(); 58 | createInstructorModuleTable(); 59 | } 60 | 61 | private void createStudentTable() { 62 | try{ 63 | String url = "jdbc:mysql://localhost/"+dbname+"?useTimezone=true&serverTimezone=UTC"; 64 | Connection con = DriverManager.getConnection(url, username, password); 65 | Statement createTable = con.createStatement(); 66 | String sql = "CREATE TABLE student " + 67 | "(studentId VARCHAR (20), " + 68 | " studentName VARCHAR(255), " + 69 | " course VARCHAR(255), " + 70 | " level VARCHAR(255), " + 71 | " semester int(11), " + 72 | " creditCompleted int(11), " + 73 | " address VARCHAR(255), " + 74 | " emailAddress VARCHAR(255) UNIQUE ," + 75 | " eligibleForNextSem VARCHAR(255) ," + 76 | " remark VARCHAR(255))"; 77 | createTable.executeUpdate(sql); 78 | }catch (SQLSyntaxErrorException se){ 79 | System.out.println("Student table already exists!!"); 80 | }catch(SQLException se){ 81 | se.printStackTrace(); 82 | } 83 | 84 | } 85 | private void createInstructorTable(){ 86 | try{ 87 | String url = "jdbc:mysql://localhost/"+dbname+"?useTimezone=true&serverTimezone=UTC"; 88 | Connection con = DriverManager.getConnection(url, username, password); 89 | Statement createTable = con.createStatement(); 90 | String sql = "CREATE TABLE instructor " + 91 | "(instructorId VARCHAR(20), " + 92 | " instructorName VARCHAR(255), " + 93 | " instructorLevel VARCHAR(255), " + 94 | " instructorAddress VARCHAR(255), " + 95 | " instructorModule Varchar(255), " + 96 | " instructorEmail VARCHAR(50) UNIQUE , " + 97 | " instuctorRating tinyint(1))"; 98 | createTable.executeUpdate(sql); 99 | }catch (SQLSyntaxErrorException se){ 100 | 101 | System.out.println("Instructor table already exists!!"); 102 | }catch(SQLException se){ 103 | se.printStackTrace(); 104 | } 105 | } 106 | private void createCourseTable(){ 107 | try{ 108 | String url = "jdbc:mysql://localhost/"+dbname+"?useTimezone=true&serverTimezone=UTC"; 109 | Connection con = DriverManager.getConnection(url, username, password); 110 | Statement createTable = con.createStatement(); 111 | String sql = "CREATE TABLE course " + 112 | "(courseCode VARCHAR(20), " + 113 | " courseName VARCHAR(255), " + 114 | " enrolledStatus tinyint(1), " + 115 | " cancelStatus VARCHAR (10), " + 116 | " courseLeader VARCHAR(50), " + 117 | " PRIMARY KEY (courseName))"; 118 | createTable.executeUpdate(sql); 119 | String insert = "INSERT INTO `course` (`courseCode`, `courseName`, `enrolledStatus`, `courseLeader`,`cancelStatus`) VALUES ('BSC1001', 'BSc (Hons) Computer Science', '1', 'Rukesh Shrestha','false'), ('BA1001', 'BA (Hons)', '1', 'Deepson Shrestha','false');"; 120 | PreparedStatement statement = con.prepareStatement(insert); 121 | statement.executeUpdate(); 122 | }catch (SQLSyntaxErrorException se){ 123 | 124 | System.out.println("Course table already exists!!"); 125 | }catch(SQLException se){ 126 | se.printStackTrace(); 127 | } 128 | } 129 | private void createModuleTable(){ 130 | try{ 131 | String url = "jdbc:mysql://localhost/"+dbname+"?useTimezone=true&serverTimezone=UTC"; 132 | Connection con = DriverManager.getConnection(url, username, password); 133 | Statement createTable = con.createStatement(); 134 | String sql = "CREATE TABLE module " + 135 | "( semester int(11), " + 136 | " moduleCode VARCHAR(255), " + 137 | " moduleName VARCHAR(255), " + 138 | " courseName VARCHAR(255), " + 139 | " instructorName VARCHAR(255), " + 140 | " moduleType Varchar(255), " + 141 | " credits int(11)) "; 142 | 143 | createTable.executeUpdate(sql); 144 | 145 | //Dummy Data 146 | String[] insert = new String[50]; 147 | insert[0] ="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI018', 'Academic Skills and Team-based Learning', 'BSc (Hons) Computer Science', 'Wilson Fisk', 'Core', '1', '20');"; 148 | insert[1]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4MM013', 'Computational Mathematics', 'BSc (Hons) Computer Science', 'Uttam Acharya', 'Core', '1', '20');"; 149 | insert[2]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CS016', 'Embedded Systems Programming', 'BSc (Hons) Computer Science', 'Prabin Sapkota', 'Core', '1', '20');"; 150 | insert[3]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CS015', 'Fundamentals of Computing', 'BSc (Hons) Computer Science', 'Sangay Lama', 'Core', '2', '20');"; 151 | insert[4]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CS017', 'Internet Software Architecture', 'BSc (Hons) Computer Science', 'Matt Murdock', 'Core', '2', '20');"; 152 | insert[5]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CS001', 'Introductory Programming And Problem Solving', 'BSc (Hons) Computer Science', 'Aashish Acharya', 'Core', '2', '20');"; 153 | insert[6]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('5CS024', 'Collaborative Development', 'BSc (Hons) Computer Science', 'Tony Stark', 'Core', '3', '20')"; 154 | insert[7]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('5CS021', 'Numerical Methods and Concurrency', 'BSc (Hons) Computer Science', 'Prabin Khadka', 'Core', '3', '20');"; 155 | insert[8]= "INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('5CS019', 'Object-Oriented Design and Programming', 'BSc (Hons) Computer Science', 'Bishal Khadka', 'Core', '3', '20');"; 156 | insert[9]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('5CS037', 'Concepts and Technologies of AI', 'BSc (Hons) Computer Science', 'Biraj Dulal', 'Core', '4', '20');"; 157 | insert[10]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('5CS020', 'Human-Computer Interaction', 'BSc (Hons) Computer Science', 'Sachin Khadka', 'Core', '4', '20');"; 158 | insert[11]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('5CS022', 'Distributed and Cloud Systems Programming', 'BSc (Hons) Computer Science', 'Peter Parker', 'Core', '4', '20');"; 159 | insert[12]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('6CS030', 'Big Data', 'BSc (Hons) Computer Science', 'Chris Evans', 'Core', '5', '20');"; 160 | insert[13]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('6CS005', 'High Performance Computing', 'BSc (Hons) Computer Science', 'Tara Subedi', 'Core', '5', '20');"; 161 | insert[14]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('6CS028', 'Advance Web Development', 'BSc (Hons) Computer Science', 'Hang pin', 'Optional', '5', '20');"; 162 | insert[15]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('6CS012', 'Artificial Intelligence and Machine Learning', 'BSc (Hons) Computer Science', 'Jacob Smith', 'Optional', '5', '20');"; 163 | insert[16]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('6CS014', 'Complex Systems', 'BSc (Hons) Computer Science', 'Bruce Banner', 'Core', '6', '20');"; 164 | insert[17]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('6CS025', 'Advance Games Technologies and Programming', 'BSc (Hons) Computer Science', 'Lucy Hamilton', 'Core', '6', '20');"; 165 | insert[18]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('6CS007', 'Project and Professionalism', 'BSc (Hons) Computer Science', 'Chris Hemsworth', 'Optional', '6', '20');"; 166 | insert[19]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('6CS027', 'Secure Mobile Application Development', 'BSc (Hons) Computer Science', 'Nirmal Thapa', 'Optional', '6', '20');"; 167 | insert[20]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI018', 'The Digital Business', 'BA (Hons)', 'Leslie Weaver', 'Core', '1', '20');"; 168 | insert[21]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI018', 'The Responsible Business', 'BA (Hons)', 'Alondra Medina', 'Core', '1', '20');"; 169 | insert[22]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI019', 'The Sustainable Business', 'BA (Hons)', 'Killian Duarte', 'Core', '1', '20');"; 170 | insert[23]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI020', 'Customer Acquisition & Retention', 'BA (Hons)', 'Niko Mcpherson', 'Core', '2', '20');"; 171 | insert[24]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI021', 'Managing Finance and Accounts', 'BA (Hons)', 'Adeline Stephenson', 'Core', '2', '20');"; 172 | insert[25]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI022', 'Operations and Project Planning', 'BA (Hons)', 'Alayna Sweeney', 'Core', '2', '20');"; 173 | insert[26]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI023', 'The Professional Manager and Leadership', 'BA (Hons)', 'Izayah Calderon', 'Core', '3', '20');"; 174 | insert[27]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI024', 'Organisational Behaviour', 'BA (Hons)', 'Zachariah Hebert', 'Core', '3', '20');"; 175 | insert[28]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI025', 'The Business Communicator', 'BA (Hons)', 'Roderick Hickman', 'Core', '3', '20');"; 176 | insert[29]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI026', 'The Professional Project', 'BA (Hons)', 'Alfred Cooke', 'Core', '4', '20');"; 177 | insert[30]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI027', 'The Strategic Business', 'BA (Hons)', 'Kaylee Zhang', 'Core', '4', '20');"; 178 | insert[31]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI028', 'Business in a Global Context', 'BA (Hons)', 'Natalia Schultz', 'Core', '4', '20');"; 179 | insert[32]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI029', 'Contract Law', 'BA (Hons)', 'Lillianna Kerr', 'Core', '5', '20');"; 180 | insert[33]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI030', 'Law of Torts', 'BA (Hons)', 'Anderson Anthony', 'Core', '5', '20');"; 181 | insert[34]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI031', 'Financial Management', 'BA (Hons)', 'Landin Davies', 'Optional', '5', '20');"; 182 | insert[35]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI032', 'Principles of Marketing', 'BA (Hons)', 'Camilla Estrada', 'Optional', '5', '20');"; 183 | insert[36]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI033', 'Quantitative Analysis', 'BA (Hons)', 'Lorelei Charles', 'Core', '6', '20');"; 184 | insert[37]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI034', 'Commercial Law', 'BA (Hons)', 'Cody Davenport', 'Core', '6', '20');"; 185 | insert[38]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI035', 'Operations and Supply Management', 'BA (Hons)', 'Evangeline Hughes', 'Optional', '6', '20');"; 186 | insert[39]="INSERT INTO `module` (`moduleCode`, `moduleName`, `courseName`, `instructorName`, `moduleType`, `semester`, `credits`) VALUES ('4CI036', 'Marketing Planning', 'BA (Hons)', 'Simon Waters', 'Optional', '6', '20');"; 187 | for (int i = 0; i < 40; i++) { 188 | PreparedStatement statement = con.prepareStatement(insert[i]); 189 | statement.executeUpdate(); 190 | } 191 | 192 | 193 | 194 | }catch (SQLSyntaxErrorException se){ 195 | System.out.println("Module table already exists!!"); 196 | }catch(SQLException se){ 197 | se.printStackTrace(); 198 | } 199 | } 200 | private void createUserTable(){ 201 | try{ 202 | String url = "jdbc:mysql://localhost/"+dbname+"?useTimezone=true&serverTimezone=UTC"; 203 | Connection con = DriverManager.getConnection(url, username, password); 204 | Statement createTable = con.createStatement(); 205 | String sql ="CREATE TABLE user " + 206 | "(userId VARCHAR(20), " + 207 | " userType VARCHAR(255), " + 208 | " userPassword VARCHAR(255), " + 209 | " PRIMARY KEY ( userId ))"; 210 | createTable.executeUpdate(sql); 211 | String insert = "INSERT INTO `user`(`userId`, `userType`, `userPassword`) VALUES ('12345','Admin','Admin')"; 212 | PreparedStatement statement = con.prepareStatement(insert); 213 | statement.executeUpdate(); 214 | }catch (SQLSyntaxErrorException se){ 215 | System.out.println("User table already exists!!"); 216 | }catch(SQLException se){ 217 | se.printStackTrace(); 218 | } 219 | } 220 | private void createInstructorModuleTable(){ 221 | try{ 222 | String url = "jdbc:mysql://localhost/"+dbname+"?useTimezone=true&serverTimezone=UTC"; 223 | Connection con = DriverManager.getConnection(url, username, password); 224 | Statement createTable = con.createStatement(); 225 | String sql ="CREATE TABLE instructorModule " + 226 | "(moduleName VARCHAR(255), " + 227 | " instructorName VARCHAR(255)) "; 228 | 229 | createTable.executeUpdate(sql); 230 | Module module = new Module(); 231 | Instructor instructor = new Instructor(); 232 | int i = module.selectModule().length; 233 | String[] modules, instructors; 234 | modules= module.selectModule(); 235 | instructors = instructor.selectInstructors(); 236 | 237 | String insert = "INSERT INTO `instructorModule`(`moduleName`,`instructorName`) VALUES (?,?)"; 238 | for (int j = 0; j < i; j++) { 239 | PreparedStatement statement = con.prepareStatement(insert); 240 | statement.setString(1,modules[j]); 241 | statement.setString(2,instructors[j]); 242 | statement.executeUpdate(); 243 | } 244 | 245 | }catch (SQLSyntaxErrorException se){ 246 | System.out.println("User table already exists!!"); 247 | }catch(SQLException se){ 248 | se.printStackTrace(); 249 | } 250 | } 251 | private void createStudentModuleTable(){ 252 | try{ 253 | String url = "jdbc:mysql://localhost/"+dbname+"?useTimezone=true&serverTimezone=UTC"; 254 | Connection con = DriverManager.getConnection(url, username, password); 255 | Statement createTable = con.createStatement(); 256 | String sql = "CREATE TABLE studentModule " + 257 | "(studentId int(20), " + 258 | " moduleName VARCHAR(255), " + 259 | " semester int , " + 260 | " marksSecured double)"; 261 | createTable.executeUpdate(sql); 262 | }catch (SQLSyntaxErrorException se){ 263 | System.out.println("moduleResult table already exists!!"); 264 | }catch(SQLException se){ 265 | se.printStackTrace(); 266 | } 267 | } 268 | 269 | 270 | } 271 | -------------------------------------------------------------------------------- /src/com/Controller/ManageDbUtils.java: -------------------------------------------------------------------------------- 1 | package com.Controller; 2 | import com.Model.Courses.Module; 3 | import com.Model.Courses.Course; 4 | 5 | import javax.swing.*; 6 | import java.sql.*; 7 | 8 | public class ManageDbUtils { 9 | private Connection con = null; 10 | public ManageDbUtils() { 11 | try { 12 | con = CreateDbUtils.getDbConnection(); 13 | } catch (Exception ex) { 14 | ex.printStackTrace(); 15 | } 16 | 17 | 18 | } 19 | 20 | 21 | //Saves Users Details 22 | public void saveUserDetails(int ID, String Password, String UserType) throws SQLException { 23 | String insert = "INSERT INTO user (UserID, UserPassword, UserType) VALUES (?, ?, ?)"; 24 | 25 | try { 26 | PreparedStatement statement = con.prepareStatement(insert); 27 | statement.setString(1, String.valueOf(ID)); 28 | statement.setString(2, String.valueOf(Password)); 29 | statement.setString(3, UserType); 30 | statement.executeUpdate(); 31 | statement.close(); 32 | 33 | 34 | } catch (SQLException sqlException) { 35 | // JOptionPane.showMessageDialog(null, "The Person already exists!"); 36 | // System.out.println("Error in user table"); 37 | sqlException.printStackTrace(); 38 | } 39 | 40 | } 41 | 42 | public void addInstructors(String moduleName, String instructorName){ 43 | String insert = "INSERT INTO instructorModule (`moduleName`,`instructorName`) VALUES (?,?)"; 44 | try { 45 | PreparedStatement statement = con.prepareStatement(insert); 46 | statement.setString(1,moduleName); 47 | statement.setString(2,instructorName); 48 | statement.executeUpdate(); 49 | }catch (SQLException sqlException){} 50 | 51 | } 52 | 53 | public void saveInstructorDetails(String instructorName){ 54 | String insert = "INSERT INTO `instructorModule` (instructorName) VALUES (?)"; 55 | try { 56 | PreparedStatement statement = con.prepareStatement(insert); 57 | statement.setString(1,instructorName); 58 | statement.executeUpdate(); 59 | }catch (SQLException sqlException){ 60 | sqlException.printStackTrace(); 61 | } 62 | } 63 | 64 | 65 | //Save Students Details 66 | public boolean saveStudentDetails(int StudentID, String name, String Email, String course,String address, String level) { 67 | String insert = "INSERT INTO student (StudentID, studentName, emailAddress, course, address, Level) VALUES (?, ?, ?, ?,?, ?)"; 68 | try { 69 | PreparedStatement statement = con.prepareStatement(insert); 70 | statement.setInt(1, StudentID); 71 | statement.setString(2, name); 72 | statement.setString(3, Email); 73 | statement.setString(4, course); 74 | statement.setString(5, address); 75 | statement.setString(6, level); 76 | 77 | statement.executeUpdate(); 78 | statement.close(); 79 | return false; 80 | } catch (SQLIntegrityConstraintViolationException sqlException) { 81 | JOptionPane.showMessageDialog(null, "User Already Exists!!!", "Account already exists", JOptionPane.ERROR_MESSAGE); 82 | return true; 83 | } catch (SQLException sqlException) { 84 | System.out.println("Error in user table"); 85 | 86 | sqlException.printStackTrace(); 87 | return true; 88 | 89 | } 90 | } 91 | 92 | public void removeInstructors(String moduleName, String instructorName){ 93 | String delete = "DELETE FROM `instructorModule` WHERE `moduleName` LIKE ? AND `instructorName` LIKE ?"; 94 | try { 95 | PreparedStatement statement = con.prepareStatement(delete); 96 | statement.setString(1, moduleName); 97 | statement.setString(2, instructorName); 98 | statement.executeUpdate(); 99 | 100 | 101 | }catch (SQLException sqlException) { 102 | sqlException.printStackTrace(); 103 | JOptionPane.showMessageDialog(null, "User not found!!!", "Invalid UserID", JOptionPane.ERROR_MESSAGE); 104 | } 105 | } 106 | 107 | 108 | public ResultSet getStudentInfo(int studentId){ 109 | String select = "SELECT * FROM `student` WHERE `studentId` LIKE ?"; 110 | try { 111 | PreparedStatement statement = con.prepareStatement(select); 112 | statement.setInt(1, studentId); 113 | return statement.executeQuery(); 114 | 115 | 116 | }catch (SQLException sqlException){ 117 | sqlException.printStackTrace(); 118 | JOptionPane.showMessageDialog(null, "User not found!!!","Invalid UserID",JOptionPane.ERROR_MESSAGE); 119 | return null; 120 | } 121 | 122 | } 123 | 124 | public void saveStudentModule(int studentID, String courseName, String moduleName1, String moduleName2){ 125 | Module modules = new Module(); 126 | String[] availableModules; 127 | String[] semester; 128 | String insertOptional; 129 | availableModules = modules.selectCoreModule(courseName); 130 | int noOfModules = modules.totalNumOfCoreModules(courseName); 131 | semester = modules.selectCoreSemester(courseName); 132 | 133 | String insertCore = "INSERT INTO `studentModule` (`studentId`, `moduleName`, `semester` ) VALUES (?, ?, ?)"; 134 | for (int i = 0; i < noOfModules; i++) { 135 | try { 136 | PreparedStatement statement = con.prepareStatement(insertCore); 137 | statement.setInt(1, studentID); 138 | statement.setString(2, availableModules[i]); 139 | statement.setString(3, semester[i]); 140 | statement.executeUpdate(); 141 | 142 | 143 | 144 | 145 | }catch (SQLException sqlException){ 146 | sqlException.printStackTrace(); 147 | } 148 | insertOptional = "INSERT INTO `studentModule` (`studentId`, `moduleName`,`semester`) VALUES (?,?,?), (?,?,?)"; 149 | 150 | try { 151 | PreparedStatement statement = con.prepareStatement(insertOptional); 152 | statement.setInt(1, studentID); 153 | statement.setString(2, moduleName1); 154 | statement.setInt(3,5); 155 | statement.setInt(4, studentID); 156 | statement.setString(5, moduleName2); 157 | statement.setInt(6,6); 158 | statement.executeUpdate(); 159 | statement.close(); 160 | 161 | 162 | 163 | }catch (SQLException sqlException){ 164 | sqlException.printStackTrace(); 165 | } 166 | 167 | 168 | } 169 | } 170 | 171 | 172 | 173 | //Save Instructors Details 174 | public boolean saveInstructorDetails(int InstructorID, String name, String Address, String emailAddress){ 175 | String insert = "INSERT INTO instructor (instructorId, instructorName, instructorAddress, instructorEmail) VALUES (?, ?, ?, ?)"; 176 | try { 177 | PreparedStatement statement = con.prepareStatement(insert); 178 | statement.setInt(1, InstructorID); 179 | statement.setString(2, name); 180 | statement.setString(3, Address); 181 | statement.setString(4, emailAddress); 182 | statement.executeUpdate(); 183 | statement.close(); 184 | return false; 185 | 186 | }catch (SQLIntegrityConstraintViolationException sqlException){ 187 | JOptionPane.showMessageDialog(null, "User Already Exists!!!","Account already exists",JOptionPane.ERROR_MESSAGE); 188 | return true; 189 | }catch(SQLException sqlException){ 190 | System.out.println("Error in user table"); 191 | 192 | sqlException.printStackTrace(); 193 | return true; 194 | 195 | } 196 | } 197 | 198 | 199 | 200 | 201 | //Select Login Details 202 | public String CheckLoginDetails(String ID, String userType){ 203 | String select = "SELECT `userPassword` FROM `user` WHERE `userId` LIKE ? AND `userType` LIKE ?"; 204 | try { 205 | PreparedStatement statement = con.prepareStatement(select); 206 | statement.setString(1, ID); 207 | statement.setString(2, userType); 208 | ResultSet resultSet = statement.executeQuery(); 209 | if (resultSet.next()) { 210 | String Password = resultSet.getString("userPassword"); 211 | return Password; 212 | } 213 | 214 | 215 | }catch (SQLException sqlException){ 216 | JOptionPane.showMessageDialog(null, "User not found!!!","Invalid UserID",JOptionPane.ERROR_MESSAGE); 217 | return null; 218 | } 219 | return null; 220 | } 221 | 222 | 223 | //Select Course 224 | public ResultSet selectCourse(){ 225 | String select = "SELECT * FROM `course`"; 226 | 227 | 228 | try { 229 | PreparedStatement statement = con.prepareStatement(select); 230 | return statement.executeQuery(); 231 | 232 | 233 | 234 | 235 | }catch (SQLException sqlException){ 236 | sqlException.printStackTrace(); 237 | return null; 238 | } 239 | } 240 | public ResultSet selectInstructorsModule(){ 241 | String select = "SELECT * FROM `instructorModule`"; 242 | 243 | try { 244 | PreparedStatement statement = con.prepareStatement(select); 245 | return statement.executeQuery(); 246 | 247 | 248 | 249 | 250 | }catch (SQLException sqlException){ 251 | sqlException.printStackTrace(); 252 | return null; 253 | } 254 | } 255 | public ResultSet selectModule(){ 256 | String select = "SELECT * FROM `module`"; 257 | 258 | try { 259 | PreparedStatement statement = con.prepareStatement(select); 260 | return statement.executeQuery(); 261 | 262 | 263 | 264 | 265 | }catch (SQLException sqlException){ 266 | sqlException.printStackTrace(); 267 | return null; 268 | } 269 | } 270 | 271 | public ResultSet selectStudentsId(String moduleName){ 272 | String select = "SELECT * FROM `studentModule` WHERE `moduleName` LIKE ?"; 273 | 274 | try { 275 | PreparedStatement statement = con.prepareStatement(select); 276 | statement.setString(1,moduleName); 277 | return statement.executeQuery(); 278 | 279 | 280 | 281 | 282 | }catch (SQLException sqlException){ 283 | sqlException.printStackTrace(); 284 | return null; 285 | } 286 | } 287 | 288 | public ResultSet selectModuleInstructor(String instructorName){ 289 | String select = "SELECT * FROM `instructorModule` WHERE `instructorName` LIKE ?"; 290 | try { 291 | PreparedStatement statement = con.prepareStatement(select); 292 | statement.setString(1, instructorName); 293 | return statement.executeQuery(); 294 | 295 | }catch (SQLException sqlException){ 296 | sqlException.printStackTrace(); 297 | return null; 298 | } 299 | } 300 | 301 | public ResultSet selectStudentName(int studentId){ 302 | String select = "SELECT * FROM `student` WHERE `studentId` LIKE ?"; 303 | try { 304 | 305 | PreparedStatement statement = con.prepareStatement(select); 306 | statement.setInt(1, studentId); 307 | return statement.executeQuery(); 308 | 309 | }catch (SQLException sqlException){ 310 | sqlException.printStackTrace(); 311 | return null; 312 | } 313 | } 314 | 315 | public ResultSet selectInstructorModule(String moduleName){ 316 | String select = "SELECT * FROM `instructorModule` WHERE `moduleName` LIKE ?"; 317 | try { 318 | PreparedStatement statement = con.prepareStatement(select); 319 | statement.setString(1, moduleName); 320 | return statement.executeQuery(); 321 | 322 | }catch (SQLException sqlException){ 323 | sqlException.printStackTrace(); 324 | return null; 325 | } 326 | } 327 | 328 | public void increaseLevel(int studentId,String Level){ 329 | String update = "UPDATE `student` SET `level` = ? WHERE `studentId` LIKE ? "; 330 | try { 331 | PreparedStatement statement = con.prepareStatement(update); 332 | statement.setString(1,Level); 333 | statement.setInt(2,studentId); 334 | statement.executeUpdate(); 335 | 336 | }catch (SQLException sqlException){ 337 | sqlException.printStackTrace(); 338 | } 339 | } 340 | public ResultSet selectCourse(String cancelStatus){ 341 | String select = "SELECT * FROM `course` WHERE `cancelStatus` LIKE ?"; 342 | 343 | try { 344 | PreparedStatement statement = con.prepareStatement(select); 345 | statement.setString(1,cancelStatus); 346 | return statement.executeQuery(); 347 | 348 | 349 | 350 | 351 | }catch (SQLException sqlException){ 352 | sqlException.printStackTrace(); 353 | return null; 354 | } 355 | } 356 | 357 | public void setCancelStatus(String courseName){ 358 | String set = "UPDATE `course` SET `cancelStatus` = ? WHERE `courseName` LIKE ?"; 359 | try { 360 | PreparedStatement statement = con.prepareStatement(set); 361 | statement.setBoolean(1,true); 362 | statement.setString(2,courseName); 363 | statement.executeUpdate(); 364 | 365 | }catch (SQLException sqlException){ 366 | sqlException.printStackTrace(); 367 | } 368 | } 369 | 370 | public ResultSet selectInstructorModule(){ 371 | String select = "SELECT * FROM `instructorModule`"; 372 | try { 373 | PreparedStatement statement = con.prepareStatement(select); 374 | return statement.executeQuery(); 375 | 376 | }catch (SQLException sqlException){ 377 | sqlException.printStackTrace(); 378 | return null; 379 | } 380 | } 381 | 382 | public ResultSet selectModuleDetails(int studentID, int semester1, int semester2){ 383 | String select = "SELECT * FROM `studentModule` WHERE `studentId` LIKE ? AND( `semester` LIKE ? OR `semester` LIKE ?)"; 384 | try { 385 | PreparedStatement statement = con.prepareStatement(select); 386 | statement.setInt(1,studentID); 387 | statement.setInt(2,semester1); 388 | statement.setInt(3,semester2); 389 | return statement.executeQuery(); 390 | 391 | }catch (SQLException sqlException){ 392 | sqlException.printStackTrace(); 393 | return null; 394 | } 395 | } 396 | 397 | public ResultSet selectModule(int studentId){ 398 | String select = "SELECT * FROM `studentModule`"; 399 | try { 400 | PreparedStatement statement = con.prepareStatement(select); 401 | return statement.executeQuery(); 402 | 403 | }catch (SQLException sqlException){ 404 | sqlException.printStackTrace(); 405 | return null; 406 | } 407 | } 408 | 409 | public ResultSet selectModuleInfo(String moduleName){ 410 | String select = "SELECT * FROM `module` WHERE `moduleName` LIKE ?"; 411 | try { 412 | PreparedStatement statement = con.prepareStatement(select); 413 | statement.setString(1,moduleName); 414 | return statement.executeQuery(); 415 | }catch (SQLException sqlException){ 416 | sqlException.printStackTrace(); 417 | return null; 418 | } 419 | } 420 | 421 | 422 | public ResultSet selectInstructorInfo(int instructorId){ 423 | String select = "SELECT * FROM `instructor` WHERE `instructorId` LIKE ?"; 424 | try { 425 | PreparedStatement statement = con.prepareStatement(select); 426 | statement.setInt(1,instructorId); 427 | return statement.executeQuery(); 428 | }catch (SQLException sqlException){ 429 | sqlException.printStackTrace(); 430 | return null; 431 | } 432 | } 433 | 434 | 435 | 436 | public ResultSet selectCoreOrOptionalModule(String courseName,String courseType){ 437 | if (courseType == "Core") { 438 | String select = "SELECT * FROM `module` WHERE `courseName` LIKE ? AND `moduleType` LIKE ?"; 439 | try { 440 | PreparedStatement statement = con.prepareStatement(select); 441 | statement.setString(1, courseName); 442 | statement.setString(2, "Core"); 443 | return statement.executeQuery(); 444 | 445 | 446 | } catch (SQLException sqlException) { 447 | sqlException.printStackTrace(); 448 | return null; 449 | } 450 | }else { 451 | String select = "SELECT * FROM `module` WHERE `courseName` LIKE ? AND `moduleType` LIKE ?"; 452 | try { 453 | PreparedStatement statement = con.prepareStatement(select); 454 | statement.setString(1, courseName); 455 | statement.setString(2, "Optional"); 456 | return statement.executeQuery(); 457 | 458 | 459 | } catch (SQLException sqlException) { 460 | sqlException.printStackTrace(); 461 | return null; 462 | } 463 | } 464 | } 465 | 466 | public ResultSet selectOptionalModule(String courseName, int semester){ 467 | String select = "SELECT * FROM `module` WHERE `courseName` LIKE ? AND `moduleType` LIKE ? AND `semester` LIKE ?"; 468 | try { 469 | PreparedStatement statement = con.prepareStatement(select); 470 | statement.setString(1, courseName); 471 | statement.setString(2, "Optional"); 472 | statement.setInt(3, semester); 473 | return statement.executeQuery(); 474 | 475 | 476 | } catch (SQLException sqlException) { 477 | sqlException.printStackTrace(); 478 | return null; 479 | } 480 | } 481 | 482 | public void deleteModule(String moduleName){ 483 | String delete = "DELETE FROM `module` WHERE `moduleName` LIKE ?"; 484 | try { 485 | PreparedStatement statement = con.prepareStatement(delete); 486 | statement.setString(1, moduleName); 487 | statement.executeUpdate(); 488 | statement.close(); 489 | System.out.println("Successfully Deleted"); 490 | }catch (SQLException sqlException){ 491 | sqlException.printStackTrace(); 492 | } 493 | 494 | } 495 | 496 | public void editModuleName(String newName, String name) { 497 | String update = "UPDATE `module` SET `moduleName` = ? WHERE `moduleName` LIKE ? "; 498 | try { 499 | PreparedStatement statement = con.prepareStatement(update); 500 | statement.setString(1, newName); 501 | statement.setString(2, name); 502 | statement.executeUpdate(); 503 | statement.close(); 504 | System.out.println("Successfully Changed"); 505 | } catch (SQLException sqlException) { 506 | sqlException.printStackTrace(); 507 | } 508 | } 509 | 510 | public ResultSet assignInstructor(String moduleName){ 511 | String select = "SELECT * FROM `instructorModule` WHERE `moduleName` LIKE ? ORDER BY RAND() LIMIT 1"; 512 | try { 513 | PreparedStatement statement = con.prepareStatement(select); 514 | statement.setString(1, moduleName); 515 | return statement.executeQuery(); 516 | 517 | } catch (SQLException sqlException) { 518 | sqlException.printStackTrace(); 519 | } 520 | return null; 521 | } 522 | 523 | 524 | public ResultSet selectModules(String moduleName){ 525 | String select = "SELECT * FROM `module` WHERE `moduleName` LIKE ?"; 526 | try { 527 | PreparedStatement statement = con.prepareStatement(select); 528 | statement.setString(1,moduleName); 529 | return statement.executeQuery(); 530 | 531 | }catch (SQLException sqlException){ 532 | sqlException.printStackTrace(); 533 | return null; 534 | } 535 | } 536 | 537 | public ResultSet selectModule(String courseName){ 538 | String select = "SELECT * FROM `module` WHERE `courseName` LIKE ?"; 539 | try { 540 | PreparedStatement statement = con.prepareStatement(select); 541 | statement.setString(1,courseName); 542 | return statement.executeQuery(); 543 | 544 | }catch (SQLException sqlException){ 545 | sqlException.printStackTrace(); 546 | return null; 547 | } 548 | } 549 | 550 | public ResultSet selectModule(String courseName, int semester){ 551 | String select = "SELECT * FROM `module` WHERE `courseName` LIKE ? AND `semester` LIKE ?"; 552 | try { 553 | PreparedStatement statement = con.prepareStatement(select); 554 | statement.setString(1, courseName); 555 | statement.setInt(2, semester); 556 | return statement.executeQuery(); 557 | }catch (SQLException sqlException){ 558 | sqlException.printStackTrace(); 559 | return null; 560 | } 561 | } 562 | 563 | public ResultSet selectCoreModule(String courseName, int semester){ 564 | String select = "SELECT * FROM `module` WHERE `courseName` LIKE ? AND `semester` LIKE ? AND `moduleType` LIKE ?"; 565 | try { 566 | PreparedStatement statement = con.prepareStatement(select); 567 | statement.setString(1, courseName); 568 | statement.setInt(2, semester); 569 | statement.setString(3,"Core"); 570 | return statement.executeQuery(); 571 | }catch (SQLException sqlException){ 572 | sqlException.printStackTrace(); 573 | return null; 574 | } 575 | } 576 | 577 | public ResultSet selectModuleInfo(int studentId, int semester){ 578 | String select = "SELECT * FROM `studentmodule` WHERE `studentId` LIKE ? AND `semester` LIKE ?"; 579 | try { 580 | PreparedStatement statement = con.prepareStatement(select); 581 | statement.setInt(1, studentId); 582 | statement.setInt(2, semester); 583 | return statement.executeQuery(); 584 | }catch (SQLException sqlException){ 585 | sqlException.printStackTrace(); 586 | return null; 587 | } 588 | } 589 | 590 | public ResultSet selectModuleInfo(int studentId){ 591 | String select = "SELECT * FROM `studentmodule` WHERE `studentId` LIKE ?"; 592 | try { 593 | PreparedStatement statement = con.prepareStatement(select); 594 | statement.setInt(1, studentId); 595 | return statement.executeQuery(); 596 | }catch (SQLException sqlException){ 597 | sqlException.printStackTrace(); 598 | return null; 599 | } 600 | } 601 | 602 | 603 | 604 | //Select Student 605 | public ResultSet selectStudent(){ 606 | String select = "SELECT * FROM `student`"; 607 | try { 608 | PreparedStatement statement = con.prepareStatement(select); 609 | return statement.executeQuery(); 610 | }catch (SQLException e){ 611 | e.printStackTrace(); 612 | return null; 613 | } 614 | } 615 | 616 | public ResultSet selectStudent(String courseName){ 617 | String select = "SELECT * FROM `student` WHERE `course` LIKE ?"; 618 | try { 619 | PreparedStatement statement = con.prepareStatement(select); 620 | statement.setString(1,courseName); 621 | return statement.executeQuery(); 622 | }catch (SQLException e){ 623 | e.printStackTrace(); 624 | return null; 625 | } 626 | } 627 | public ResultSet selectStudentId(String studentName){ 628 | String select = "SELECT * FROM `student` WHERE `studentName` LIKE ?"; 629 | try { 630 | PreparedStatement statement = con.prepareStatement(select); 631 | statement.setString(1,studentName); 632 | return statement.executeQuery(); 633 | }catch (SQLException e){ 634 | e.printStackTrace(); 635 | return null; 636 | } 637 | } 638 | public void addCourse(String courseName){ 639 | int enrolled_status = 0; 640 | String insert = "INSERT INTO `course`(`courseName`, `enrolledStatus`) VALUES (?, ?)"; 641 | try { 642 | PreparedStatement statement = con.prepareStatement(insert); 643 | statement.setString(1, courseName); 644 | statement.setInt(2, enrolled_status); 645 | statement.executeUpdate(); 646 | statement.close(); 647 | } catch (SQLException sqlException) { 648 | sqlException.printStackTrace(); 649 | } 650 | 651 | } 652 | public void editCourseName(String newCourseName, String courseName){ 653 | String updateCourse = "UPDATE `course` SET `courseName` = ? WHERE `courseName` LIKE ? "; 654 | String updateModule = "UPDATE `module` SET `courseName` = ? WHERE `courseName` LIKE ? "; 655 | try { 656 | PreparedStatement statement = con.prepareStatement(updateCourse); 657 | statement.setString(1, newCourseName); 658 | statement.setString(2,courseName); 659 | statement.executeUpdate(); 660 | statement.close(); 661 | System.out.println("Successfully Changed"); 662 | }catch (SQLException sqlException){ 663 | sqlException.printStackTrace(); 664 | } 665 | try { 666 | PreparedStatement statement = con.prepareStatement(updateModule); 667 | statement.setString(1, newCourseName); 668 | statement.setString(2,courseName); 669 | statement.executeUpdate(); 670 | statement.close(); 671 | }catch(SQLException sqlException){ 672 | } 673 | 674 | } 675 | 676 | public void updateMark(String studentId, String moduleName, String markSecured){ 677 | String update = "UPDATE `studentmodule` SET `marksSecured` = ? WHERE `moduleName` LIKE ? AND `studentId` LIKE ?"; 678 | try { 679 | PreparedStatement statement = con.prepareStatement(update); 680 | statement.setDouble(1, Double.parseDouble(markSecured)); 681 | statement.setString(2,moduleName); 682 | statement.setInt(3, Integer.parseInt(studentId)); 683 | statement.executeUpdate(); 684 | statement.close(); 685 | }catch(SQLException sqlException){ 686 | sqlException.printStackTrace(); 687 | } 688 | } 689 | 690 | public void updateCourseStatus(boolean value,String courseName){ 691 | if (value == true){ 692 | String update = "UPDATE `course` SET `enrolledStatus` = ? WHERE `courseName` LIKE ?"; 693 | try { 694 | PreparedStatement statement = con.prepareStatement(update); 695 | statement.setInt(1, 1); 696 | statement.setString(2,courseName); 697 | statement.executeUpdate(); 698 | statement.close(); 699 | }catch(SQLException sqlException){} 700 | 701 | }else{ 702 | String update = "UPDATE `course` SET `enrolledStatus` = ? WHERE `courseName` LIKE ?"; 703 | try { 704 | PreparedStatement statement = con.prepareStatement(update); 705 | statement.setInt(1, 0); 706 | statement.setString(2,courseName); 707 | statement.executeUpdate(); 708 | statement.close(); 709 | }catch(SQLException sqlException){} 710 | 711 | } 712 | } 713 | 714 | public void deleteCourse(String courseName){ 715 | String deleteCourse = "DELETE FROM `course` WHERE `courseName` LIKE ?"; 716 | String deleteModule = "DELETE FROM `module` WHERE `courseName` LIKE ?"; 717 | try { 718 | PreparedStatement statement = con.prepareStatement(deleteCourse); 719 | statement.setString(1, courseName); 720 | statement.executeUpdate(); 721 | statement.close(); 722 | System.out.println("Successfully Deleted"); 723 | }catch (SQLException sqlException){ 724 | sqlException.printStackTrace(); 725 | } 726 | try { 727 | PreparedStatement statement = con.prepareStatement(deleteModule); 728 | statement.setString(1, courseName); 729 | statement.executeUpdate(); 730 | statement.close(); 731 | }catch(SQLException sqlException){ 732 | } 733 | } 734 | 735 | //Add Models to courses 736 | public void addModule(String moduleId, String moduleName, String course, String moduleType,String semester){ 737 | String insert = "INSERT INTO `module`(moduleCode, moduleName, courseName, moduleType, semester, credits) VALUES (?,?,?,?,?,?)"; 738 | try { 739 | PreparedStatement statement = con.prepareStatement(insert); 740 | statement.setString(1, moduleId); 741 | statement.setString(2, moduleName); 742 | statement.setString(3, course); 743 | statement.setString(4, moduleType); 744 | statement.setString(5, semester); 745 | statement.setInt(6, 20); 746 | 747 | statement.executeUpdate(); 748 | statement.close(); 749 | } catch (SQLException sqlException) { 750 | // JOptionPane.showMessageDialog(null, "The Person already exists!"); 751 | // System.out.println("Error in user table"); 752 | sqlException.printStackTrace(); 753 | } 754 | } 755 | public ResultSet selectInstructorsModule(String instructorName){ 756 | String select = "SELECT * FROM `instructorModule` WHERE `instructorName` LIKE ?"; 757 | try { 758 | PreparedStatement statement = con.prepareStatement(select); 759 | statement.setString(1, instructorName); 760 | return statement.executeQuery(); 761 | 762 | }catch (SQLException sqlException){ 763 | sqlException.printStackTrace(); 764 | return null; 765 | } 766 | } 767 | } 768 | -------------------------------------------------------------------------------- /src/com/Main/Final.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/com/Main/Main.java: -------------------------------------------------------------------------------- 1 | package com.Main; 2 | 3 | import com.Controller.CreateDbUtils; 4 | import com.View.Gui; 5 | 6 | public class Main { 7 | public static void main(String[] args) { 8 | 9 | new CreateDbUtils(); 10 | new Gui(); 11 | System.out.println("This is the Course Management System. To use the system as student and instructors, you will need to create an account and login to it.\n"); 12 | System.out.println("To use admin account, ADMIN ID is 12345 and password is Admin"); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/com/Main/Main.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __MAIN's Class Diagram__\n 4 | 5 | namespace com.Main { 6 | class com.Main.Main { 7 | {static} + main() 8 | } 9 | } 10 | 11 | 12 | 13 | 14 | right footer 15 | 16 | 17 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 18 | For more information about this tool, please contact philippe.mesmeur@gmail.com 19 | endfooter 20 | 21 | @enduml 22 | -------------------------------------------------------------------------------- /src/com/Model/Courses/Course.java: -------------------------------------------------------------------------------- 1 | package com.Model.Courses; 2 | 3 | import com.Controller.ManageDbUtils; 4 | 5 | import java.sql.PreparedStatement; 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | import java.util.ArrayList; 9 | 10 | public class Course { 11 | private Module module = new Module(); 12 | private String level; 13 | private String courseName; 14 | private String courseCode; 15 | private int enrolledStatus; 16 | private Boolean cancelStatus; 17 | ArrayList mods = new ArrayList(24); 18 | public void setEnrolledStatus(int enrolledStatus) {this.enrolledStatus = enrolledStatus;} 19 | 20 | public Course(){ 21 | 22 | } 23 | 24 | 25 | 26 | 27 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 28 | public String[] selectCourse(){ 29 | ResultSet availableCourse = manageDbUtils.selectCourse(); 30 | int i=0; 31 | 32 | try{ 33 | while (availableCourse.next()){ 34 | i++; 35 | }}catch(SQLException e){ 36 | e.printStackTrace(); 37 | } 38 | availableCourse = manageDbUtils.selectCourse(); 39 | String[] courses = new String[i]; 40 | i=0; 41 | try{ 42 | while(availableCourse.next()){ 43 | courses[i] = availableCourse.getString("courseName"); 44 | i++; 45 | } 46 | }catch(SQLException e){ 47 | e.printStackTrace(); 48 | } 49 | return courses; 50 | } 51 | 52 | public void cancelCourse(){ 53 | String[] courses = selectCourse(); 54 | 55 | ResultSet availableCourse = manageDbUtils.selectCourse(); 56 | int i=0; 57 | int j,count=0; 58 | try{ 59 | while (availableCourse.next()){ 60 | i++; 61 | } 62 | System.out.println(i); 63 | }catch(SQLException e){ 64 | e.printStackTrace(); 65 | } 66 | 67 | for ( j = 0; j < i; j++) { 68 | ResultSet student = manageDbUtils.selectStudent(courses[j]); 69 | try{ 70 | 71 | while(availableCourse.next()){ 72 | count++; 73 | } 74 | System.out.println(count); 75 | if(count==0){ 76 | manageDbUtils.updateCourseStatus(false,courses[j]); 77 | System.out.println(courses[j]); 78 | } 79 | }catch(SQLException err){ 80 | err.printStackTrace(); 81 | }} 82 | 83 | 84 | } 85 | 86 | } 87 | 88 | -------------------------------------------------------------------------------- /src/com/Model/Courses/Courses.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __COURSES's Class Diagram__\n 4 | 5 | namespace com.Model.Courses { 6 | class com.Model.Courses.Course { 7 | ~ mods : ArrayList 8 | - cancelStatus : Boolean 9 | - courseCode : String 10 | - courseName : String 11 | - enrolledStatus : int 12 | - level : String 13 | + Course() 14 | + cancelCourse() 15 | + selectCourse() 16 | + setEnrolledStatus() 17 | } 18 | } 19 | 20 | 21 | namespace com.Model.Courses { 22 | class com.Model.Courses.Module { 23 | - credits : int 24 | - instructorName : String 25 | - marksSecured : Double 26 | - moduleCode : String 27 | - moduleName : String 28 | - moduleType : String 29 | - semester : int 30 | + Module() 31 | + Module() 32 | + getStudentModule() 33 | + moduleInfo() 34 | + numOfCoreModule() 35 | + numOfModule() 36 | + numOfOptionalModule() 37 | + selectCoreModule() 38 | + selectCoreSemester() 39 | + selectGrade() 40 | + selectModule() 41 | + selectModule() 42 | + selectModule() 43 | + selectModule() 44 | + selectModule() 45 | + selectModules() 46 | + selectOptionalModule() 47 | + selectOptionalModules() 48 | + totalNumOfCoreModules() 49 | + totalNumOfModules() 50 | + totalNumOfOptionalModules() 51 | } 52 | } 53 | 54 | 55 | com.Model.Courses.Course o-- com.Controller.ManageDbUtils : manageDbUtils 56 | com.Model.Courses.Course o-- com.Model.Courses.Module : module 57 | 58 | 59 | right footer 60 | 61 | 62 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 63 | For more information about this tool, please contact philippe.mesmeur@gmail.com 64 | endfooter 65 | 66 | @enduml 67 | -------------------------------------------------------------------------------- /src/com/Model/Courses/Module.java: -------------------------------------------------------------------------------- 1 | package com.Model.Courses; 2 | 3 | import com.Controller.ManageDbUtils; 4 | 5 | import javax.swing.*; 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | public class Module { 10 | private String moduleName; 11 | private String moduleCode; 12 | private String instructorName; 13 | private int semester; 14 | private int credits; 15 | private String moduleType; 16 | private Double marksSecured; 17 | 18 | public Module(){} 19 | 20 | public Module(String moduleName, String moduleCode, String moduleType){ 21 | this.moduleCode = moduleCode; 22 | this.moduleName = moduleName; 23 | this.credits = 20; 24 | this.semester = 0; 25 | this.moduleType = moduleType; 26 | 27 | this.instructorName = null; 28 | this.marksSecured = 0.0; 29 | } 30 | 31 | 32 | 33 | 34 | public String[] selectModule(){ 35 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 36 | ResultSet availableModule = manageDbUtils.selectModule(); 37 | int i = 0; 38 | try { 39 | while (availableModule.next()){ 40 | i++; 41 | } 42 | }catch(SQLException e){ 43 | e.printStackTrace(); 44 | } 45 | availableModule = manageDbUtils.selectModule(); 46 | String[] modules = new String[i]; 47 | i=0; 48 | try { 49 | while (availableModule.next()){ 50 | modules[i] = availableModule.getString("moduleName"); 51 | i++; 52 | } 53 | }catch(SQLException e){ 54 | e.printStackTrace(); 55 | } 56 | return modules; 57 | } 58 | 59 | public String[] selectModule(String courseName){ 60 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 61 | ResultSet availableModule = manageDbUtils.selectModule(courseName); 62 | int i = 0; 63 | try { 64 | while (availableModule.next()){ 65 | i++; 66 | } 67 | }catch(SQLException e){ 68 | e.printStackTrace(); 69 | } 70 | availableModule = manageDbUtils.selectModule(courseName); 71 | String[] modules = new String[i]; 72 | i=0; 73 | try { 74 | while (availableModule.next()){ 75 | modules[i] = availableModule.getString("moduleName"); 76 | i++; 77 | } 78 | }catch(SQLException e){ 79 | e.printStackTrace(); 80 | } 81 | return modules; 82 | } 83 | public int totalNumOfModules(String courseName){ 84 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 85 | ResultSet availableModule = manageDbUtils.selectModule(courseName); 86 | int i = 0; 87 | try { 88 | while (availableModule.next()){ 89 | i++; 90 | } 91 | }catch(SQLException e){ 92 | e.printStackTrace(); 93 | } 94 | return i; 95 | } 96 | 97 | public String[] getStudentModule(String studentLevel,int studentId){ 98 | ManageDbUtils manageDbUtils= new ManageDbUtils(); 99 | int semester1 = 0, semester2 = 0; 100 | if (studentLevel.equals("Four")){ 101 | semester1 = 1; 102 | semester2 = 2; 103 | }else if(studentLevel.equals("Five")){ 104 | semester1=3; 105 | semester2=4; 106 | }else if (studentLevel.equals("Six")){ 107 | semester1=5; 108 | semester2=6; 109 | } 110 | ResultSet studentDetails = manageDbUtils.selectModuleDetails(studentId,semester1,semester2); 111 | int i = 0; 112 | try { 113 | while (studentDetails.next()){ 114 | i++; 115 | } 116 | }catch(SQLException e){ 117 | e.printStackTrace(); 118 | } 119 | System.out.println(i); 120 | studentDetails = manageDbUtils.selectModuleDetails(studentId,semester1,semester2); 121 | int j = 0; 122 | String[] modules = new String[i]; 123 | try { 124 | while (studentDetails.next()){ 125 | modules[j] = studentDetails.getString("moduleName"); 126 | j++; 127 | 128 | } 129 | return modules; 130 | }catch(SQLException e){ 131 | e.printStackTrace(); 132 | } 133 | return null; 134 | } 135 | 136 | public String[] selectModule(String courseName, int semester){ 137 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 138 | ResultSet availableModule = manageDbUtils.selectModule(courseName, semester); 139 | int i = 0; 140 | try { 141 | while (availableModule.next()){ 142 | i++; 143 | } 144 | }catch(SQLException e){ 145 | e.printStackTrace(); 146 | } 147 | availableModule = manageDbUtils.selectModule(courseName,semester); 148 | String[] modules = new String[i]; 149 | i=0; 150 | try { 151 | while (availableModule.next()){ 152 | modules[i] = availableModule.getString("moduleName"); 153 | i++; 154 | } 155 | }catch(SQLException e){ 156 | e.printStackTrace(); 157 | } 158 | return modules; 159 | } 160 | 161 | 162 | public String[] selectCoreModule(String courseName){ 163 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 164 | ResultSet availableModule = manageDbUtils.selectCoreOrOptionalModule(courseName,"Core"); 165 | int i = 0; 166 | try { 167 | while (availableModule.next()){ 168 | i++; 169 | } 170 | }catch(SQLException e){ 171 | e.printStackTrace(); 172 | } 173 | availableModule = manageDbUtils.selectCoreOrOptionalModule(courseName,"Core"); 174 | String[] modules = new String[i]; 175 | i=0; 176 | try { 177 | while (availableModule.next()){ 178 | modules[i] = availableModule.getString("moduleName"); 179 | i++; 180 | } 181 | }catch(SQLException e){ 182 | e.printStackTrace(); 183 | } 184 | return modules; 185 | } 186 | 187 | 188 | public int totalNumOfCoreModules(String courseName){ 189 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 190 | ResultSet availableModule = manageDbUtils.selectCoreOrOptionalModule(courseName,"Core"); 191 | int i = 0; 192 | try { 193 | while (availableModule.next()){ 194 | i++; 195 | } 196 | }catch(SQLException e){ 197 | e.printStackTrace(); 198 | } 199 | return i; 200 | } 201 | 202 | public int totalNumOfOptionalModules(String courseName){ 203 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 204 | ResultSet availableModule = manageDbUtils.selectCoreOrOptionalModule(courseName,"Optional"); 205 | int i = 0; 206 | try { 207 | while (availableModule.next()){ 208 | i++; 209 | } 210 | }catch(SQLException e){ 211 | e.printStackTrace(); 212 | } 213 | return i; 214 | } 215 | 216 | public String[] selectOptionalModules(String courseName){ 217 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 218 | ResultSet availableModule = manageDbUtils.selectCoreOrOptionalModule(courseName,"Optional"); 219 | int i = 0; 220 | try { 221 | while (availableModule.next()){ 222 | i++; 223 | } 224 | }catch(SQLException e){ 225 | e.printStackTrace(); 226 | } 227 | availableModule = manageDbUtils.selectCoreOrOptionalModule(courseName,"Optional"); 228 | String[] modules = new String[i]; 229 | i=0; 230 | try { 231 | while (availableModule.next()){ 232 | modules[i] = availableModule.getString("moduleName"); 233 | i++; 234 | } 235 | }catch(SQLException e){ 236 | e.printStackTrace(); 237 | } 238 | return modules; 239 | } 240 | 241 | public String[][] selectModules(String courseName){ 242 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 243 | ResultSet availableModule = manageDbUtils.selectModule(courseName); 244 | int i = 0; 245 | try { 246 | while (availableModule.next()){ 247 | i++; 248 | } 249 | }catch(SQLException e){ 250 | e.printStackTrace(); 251 | } 252 | availableModule = manageDbUtils.selectModule(courseName); 253 | String[][] modules = new String[i][4]; 254 | i=0; 255 | try { 256 | while (availableModule.next()){ 257 | int j = 0; 258 | modules[i][j] = availableModule.getString("moduleName"); 259 | j++; 260 | modules[i][j] = availableModule.getString("semester"); 261 | j++; 262 | modules[i][j] = availableModule.getString("credits"); 263 | j++; 264 | modules[i][j] = availableModule.getString("moduleType"); 265 | i++; 266 | } 267 | } catch (SQLException ex) { 268 | ex.printStackTrace(); 269 | } 270 | System.out.println("hi"); 271 | for ( i = 0; i < 20; i++) { 272 | for (int j = 0; j < 4; j++) { 273 | System.out.println(modules[i][j]); 274 | } 275 | } 276 | return modules; 277 | } 278 | 279 | public String[] selectOptionalModule(String courseName, int semester){ 280 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 281 | ResultSet availableModule = manageDbUtils.selectOptionalModule(courseName,semester); 282 | int i = 0; 283 | try { 284 | while (availableModule.next()){ 285 | i++; 286 | } 287 | }catch(SQLException e){ 288 | e.printStackTrace(); 289 | } 290 | availableModule = manageDbUtils.selectOptionalModule(courseName, semester); 291 | String[] modules = new String[i]; 292 | i=0; 293 | try { 294 | while (availableModule.next()){ 295 | modules[i] = availableModule.getString("moduleName"); 296 | i++; 297 | } 298 | }catch(SQLException e){ 299 | e.printStackTrace(); 300 | } 301 | return modules; 302 | } 303 | public int numOfModule(String courseName, String semester){ 304 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 305 | ResultSet availableModule = manageDbUtils.selectOptionalModule(courseName, Integer.parseInt(semester)); 306 | int i = 0; 307 | try { 308 | while (availableModule.next()){ 309 | i++; 310 | } 311 | }catch(SQLException e){ 312 | e.printStackTrace(); 313 | } 314 | return i; 315 | } 316 | public int numOfCoreModule(String courseName,String semester){ 317 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 318 | ResultSet availableModule = manageDbUtils.selectCoreModule(courseName, Integer.parseInt(semester)); 319 | int i = 0; 320 | try { 321 | while (availableModule.next()){ 322 | i++; 323 | } 324 | }catch(SQLException e){ 325 | e.printStackTrace(); 326 | } 327 | return i; 328 | } 329 | 330 | public int numOfOptionalModule(String courseName,String semester){ 331 | 332 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 333 | ResultSet availableModule = manageDbUtils.selectOptionalModule(courseName, Integer.parseInt(semester)); 334 | int i = 0; 335 | try { 336 | while (availableModule.next()){ 337 | i++; 338 | } 339 | }catch(SQLException e){ 340 | e.printStackTrace(); 341 | } 342 | return i; 343 | } 344 | public String[] selectModule(int studentID, int semester){ 345 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 346 | ResultSet availableModule = manageDbUtils.selectModuleInfo(studentID,semester); 347 | int i; 348 | String[] modules = new String[3]; 349 | i=0; 350 | try { 351 | while (availableModule.next()){ 352 | modules[i] = availableModule.getString("moduleName"); 353 | i++; 354 | } 355 | }catch(SQLException e){ 356 | e.printStackTrace(); 357 | } 358 | return modules; 359 | } 360 | 361 | public String[] selectGrade(int studentID, int semester){ 362 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 363 | ResultSet availableModule = manageDbUtils.selectModuleInfo(studentID,semester); 364 | 365 | String[] modules = new String[3]; 366 | int i=0; 367 | try { 368 | while (availableModule.next()){ 369 | modules[i] = availableModule.getString("marksSecured"); 370 | i++; 371 | } 372 | }catch(SQLException e){ 373 | JOptionPane.showMessageDialog(null,"The student has not been graded yet!",null,JOptionPane.ERROR_MESSAGE); 374 | e.printStackTrace(); 375 | } 376 | return modules; 377 | } 378 | 379 | public String[] selectModule(int studentId){ 380 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 381 | ResultSet availableModule = manageDbUtils.selectModuleInfo(studentId); 382 | int i = 0; 383 | try { 384 | while (availableModule.next()){ 385 | i++; 386 | } 387 | }catch(SQLException e){ 388 | e.printStackTrace(); 389 | } 390 | String[] modules = new String[i]; 391 | availableModule = manageDbUtils.selectModuleInfo(studentId); 392 | i=0; 393 | try { 394 | while (availableModule.next()){ 395 | modules[i] = availableModule.getString("moduleName"); 396 | i++; 397 | } 398 | }catch(SQLException e){ 399 | e.printStackTrace(); 400 | } 401 | return modules; 402 | } 403 | 404 | 405 | public String[] moduleInfo(String moduleName){ 406 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 407 | ResultSet availableModule = manageDbUtils.selectModules(moduleName); 408 | int i = 0; 409 | try { 410 | while (availableModule.next()){ 411 | i++; 412 | } 413 | }catch(SQLException e){ 414 | e.printStackTrace(); 415 | } 416 | String[] modules = new String[i]; 417 | availableModule = manageDbUtils.selectModuleInfo(moduleName); 418 | i=0; 419 | try { 420 | while (availableModule.next()){ 421 | modules[i] = availableModule.getString("moduleCode"); 422 | i++; 423 | } 424 | }catch(SQLException e){ 425 | e.printStackTrace(); 426 | } 427 | System.out.println(modules[0]); 428 | return modules; 429 | } 430 | 431 | public String[] selectCoreSemester(String courseName){ 432 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 433 | ResultSet availableModule = manageDbUtils.selectCoreOrOptionalModule(courseName,"Core"); 434 | int i = 0; 435 | try { 436 | while (availableModule.next()){ 437 | i++; 438 | } 439 | }catch(SQLException e){ 440 | e.printStackTrace(); 441 | } 442 | availableModule = manageDbUtils.selectCoreOrOptionalModule(courseName,"Core"); 443 | String[] semester = new String[i]; 444 | i=0; 445 | try { 446 | while (availableModule.next()){ 447 | semester[i] = availableModule.getString("semester"); 448 | i++; 449 | } 450 | }catch(SQLException e){ 451 | e.printStackTrace(); 452 | } 453 | return semester; 454 | } 455 | 456 | } 457 | -------------------------------------------------------------------------------- /src/com/Model/MainBody/Instructor.java: -------------------------------------------------------------------------------- 1 | package com.Model.MainBody; 2 | 3 | import com.Controller.ManageDbUtils; 4 | 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | 8 | public class Instructor extends Users{ 9 | private String instructorName; 10 | private int instructorId; 11 | private String address; 12 | private String email; 13 | private String[] modules; 14 | private ManageDbUtils manageDbUtils = new ManageDbUtils(); 15 | 16 | public Instructor(){} 17 | public Instructor(int userId, String password){ 18 | this.instructorId = userId; 19 | super.setUserId(String.valueOf(userId)); 20 | super.setUserPassword(password); 21 | super.setUserType("Instructor"); 22 | setInstructorInfo(); 23 | } 24 | 25 | public String getAddress() {return address;} 26 | public void setAddress(String address) {this.address = address;} 27 | 28 | public String getInstructorName() { 29 | return instructorName; 30 | } 31 | public void setInstructorName(String instructorName) { 32 | this.instructorName = instructorName; 33 | } 34 | 35 | public String getEmail() {return email;} 36 | public void setEmail(String email) {this.email = email;} 37 | 38 | public int getInstructorId() { 39 | return instructorId; 40 | } 41 | public void setInstructorId(int instructorId) { 42 | this.instructorId = instructorId; 43 | } 44 | 45 | public void setInstructorInfo(){ 46 | ResultSet resultSet = manageDbUtils.selectInstructorInfo(instructorId); 47 | try { 48 | while (resultSet.next()) { 49 | setAddress(resultSet.getString("instructorAddress")); 50 | setInstructorName(resultSet.getString("instructorName")); 51 | setEmail(resultSet.getString("instructorEmail")); 52 | } 53 | } catch (SQLException e) { 54 | e.printStackTrace(); 55 | } 56 | } 57 | 58 | 59 | public String[] selectUpdatedInstructors(){ 60 | ResultSet availableInstructors = manageDbUtils.selectInstructorModule(); 61 | int i=0; 62 | 63 | try{ 64 | while (availableInstructors.next()){ 65 | i++; 66 | }}catch(SQLException e){ 67 | e.printStackTrace(); 68 | } 69 | availableInstructors = manageDbUtils.selectInstructorModule(); 70 | String[] instructors = new String[i]; 71 | i=0; 72 | try{ 73 | while(availableInstructors.next()){ 74 | instructors[i] = availableInstructors.getString("instructorName"); 75 | i++; 76 | } 77 | }catch(SQLException e){ 78 | e.printStackTrace(); 79 | } 80 | return instructors; 81 | } 82 | 83 | public String[] selectInstructors(){ 84 | ResultSet availableInstructors = manageDbUtils.selectInstructorsModule(); 85 | int i=0; 86 | 87 | try{ 88 | while (availableInstructors.next()){ 89 | i++; 90 | }}catch(SQLException e){ 91 | e.printStackTrace(); 92 | } 93 | availableInstructors = manageDbUtils.selectInstructorsModule(); 94 | String[] instructors = new String[i]; 95 | i=0; 96 | try{ 97 | while(availableInstructors.next()){ 98 | instructors[i] = availableInstructors.getString("instructorName"); 99 | i++; 100 | } 101 | }catch(SQLException e){ 102 | e.printStackTrace(); 103 | } 104 | return instructors; 105 | } 106 | 107 | public String[] selectUpdatedInstructors(String moduleName){ 108 | 109 | ResultSet availableInstructors = manageDbUtils.selectInstructorModule(moduleName); 110 | int i=0; 111 | 112 | try{ 113 | while (availableInstructors.next()){ 114 | i++; 115 | }}catch(SQLException e){ 116 | e.printStackTrace(); 117 | } 118 | availableInstructors = manageDbUtils.selectInstructorModule(moduleName); 119 | String[] instructors = new String[i]; 120 | i=0; 121 | try{ 122 | while(availableInstructors.next()){ 123 | instructors[i] = availableInstructors.getString("instructorName"); 124 | i++; 125 | } 126 | }catch(SQLException e){ 127 | e.printStackTrace(); 128 | } 129 | return instructors; 130 | } 131 | public String assignInstructor(String moduleName){ 132 | ResultSet resultSet = manageDbUtils.assignInstructor(moduleName); 133 | String instructor = new String(); 134 | try { 135 | while (resultSet.next()){ 136 | instructor = resultSet.getString("instructorName"); 137 | } 138 | }catch (SQLException sqlException){ 139 | sqlException.printStackTrace(); 140 | } 141 | return instructor; 142 | } 143 | 144 | public String[] selectInstructorsModule(String moduleName){ 145 | ResultSet resultSet = manageDbUtils.selectInstructorsModule(moduleName); 146 | int i=0; 147 | 148 | try{ 149 | while (resultSet.next()){ 150 | i++; 151 | }}catch(SQLException e){ 152 | e.printStackTrace(); 153 | } 154 | resultSet = manageDbUtils.selectInstructorsModule(moduleName); 155 | String[] instructor = new String[i]; 156 | i=0; 157 | try { 158 | while (resultSet.next()){ 159 | instructor[i] = resultSet.getString("moduleName"); 160 | i++; 161 | } 162 | }catch (SQLException sqlException){ 163 | sqlException.printStackTrace(); 164 | } 165 | return instructor; 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /src/com/Model/MainBody/MainBody.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __MAINBODY's Class Diagram__\n 4 | 5 | namespace com.Model.MainBody { 6 | class com.Model.MainBody.Instructor { 7 | - address : String 8 | - email : String 9 | - instructorId : int 10 | - instructorName : String 11 | - modules : String[] 12 | + Instructor() 13 | + Instructor() 14 | + assignInstructor() 15 | + getAddress() 16 | + getEmail() 17 | + getInstructorId() 18 | + getInstructorName() 19 | + selectInstructors() 20 | + selectInstructorsModule() 21 | + selectUpdatedInstructors() 22 | + selectUpdatedInstructors() 23 | + setAddress() 24 | + setEmail() 25 | + setInstructorId() 26 | + setInstructorInfo() 27 | + setInstructorName() 28 | } 29 | } 30 | 31 | 32 | namespace com.Model.MainBody { 33 | class com.Model.MainBody.Student { 34 | ~ modulesSelected : ArrayList 35 | - address : String 36 | - course : String 37 | - eligibleForNextSem : Boolean 38 | - emailAddress : String 39 | - level : String 40 | - remarks : String 41 | - semester : String 42 | - studentId : int 43 | - studentName : String 44 | + Student() 45 | + Student() 46 | + getAddress() 47 | + getCourse() 48 | + getEligibleForNextSem() 49 | + getEmailAddress() 50 | + getLevel() 51 | + getRemarks() 52 | + getStudentId() 53 | + getStudentModule() 54 | + getStudentName() 55 | + noOfStudents() 56 | + selectRemark() 57 | + selectStudent() 58 | + selectStudentDetails() 59 | + selectStudentId() 60 | + selectStudentName() 61 | + selectStudentsId() 62 | + setAddress() 63 | + setCourse() 64 | + setEligibleForNextSem() 65 | + setEmailAddress() 66 | + setLevel() 67 | + setRemarks() 68 | + setStudentInfo() 69 | + setStudentName() 70 | } 71 | } 72 | 73 | 74 | namespace com.Model.MainBody { 75 | class com.Model.MainBody.Users { 76 | - con : Connection 77 | - userId : String 78 | - userPassword : String 79 | - userType : String 80 | + GenerateID() 81 | + getUserId() 82 | + getUserPassword() 83 | + getUserType() 84 | + setUserId() 85 | + setUserPassword() 86 | + setUserType() 87 | + users() 88 | } 89 | } 90 | 91 | 92 | com.Model.MainBody.Instructor -up-|> com.Model.MainBody.Users 93 | com.Model.MainBody.Instructor o-- com.Controller.ManageDbUtils : manageDbUtils 94 | com.Model.MainBody.Student -up-|> com.Model.MainBody.Users 95 | com.Model.MainBody.Student o-- com.Controller.ManageDbUtils : manageDbUtils 96 | 97 | 98 | right footer 99 | 100 | 101 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 102 | For more information about this tool, please contact philippe.mesmeur@gmail.com 103 | endfooter 104 | 105 | @enduml 106 | -------------------------------------------------------------------------------- /src/com/Model/MainBody/Student.java: -------------------------------------------------------------------------------- 1 | package com.Model.MainBody; 2 | 3 | import com.Controller.ManageDbUtils; 4 | import com.Model.Courses.Module; 5 | import com.Model.Courses.Course; 6 | 7 | import java.sql.ResultSet; 8 | import java.sql.SQLException; 9 | import java.util.ArrayList; 10 | 11 | public class Student extends Users{ 12 | private int studentId; 13 | private String studentName; 14 | private String level; 15 | private String address; 16 | private String emailAddress; 17 | private String semester; 18 | private Boolean eligibleForNextSem = true; 19 | private String remarks; 20 | private String course; 21 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 22 | 23 | ArrayList modulesSelected = new ArrayList(); 24 | 25 | 26 | public Student(){} 27 | public Student(int userId, String password){ 28 | 29 | this.studentId = userId; 30 | setStudentInfo(); 31 | super.setUserPassword(password); 32 | super.setUserType("Student"); 33 | 34 | } 35 | 36 | public int getStudentId() {return studentId;} 37 | 38 | 39 | public String getLevel(){return level;} 40 | public void setLevel(String level){ 41 | this.level = level; 42 | } 43 | 44 | public String getStudentName(){return studentName;} 45 | public void setStudentName(String studentName) { 46 | this.studentName = studentName; 47 | } 48 | 49 | public String getAddress(){return address;} 50 | public void setAddress(String address){this.address = address;} 51 | 52 | public String getCourse(){return course;} 53 | public void setCourse(String course){this.course = course;} 54 | 55 | public String getRemarks() { 56 | return remarks; 57 | } 58 | public void setRemarks(String remarks) { 59 | this.remarks = remarks; 60 | } 61 | 62 | public String getEmailAddress(){return emailAddress;} 63 | public void setEmailAddress(String emailAddress){this.emailAddress = emailAddress;} 64 | 65 | public Boolean getEligibleForNextSem(){return eligibleForNextSem;} 66 | public void setEligibleForNextSem(Boolean eligibleForNextSem){this.eligibleForNextSem = eligibleForNextSem;} 67 | 68 | 69 | 70 | public void setStudentInfo(){ 71 | ResultSet resultSet = manageDbUtils.getStudentInfo(studentId); 72 | try { 73 | while(resultSet.next()){ 74 | setAddress(resultSet.getString("address")); 75 | setLevel(resultSet.getString("level")); 76 | setStudentName(resultSet.getString("studentName")); 77 | setCourse(resultSet.getString("course")); 78 | setEmailAddress(resultSet.getString("emailAddress")); 79 | setEligibleForNextSem(resultSet.getBoolean("eligibleForNextSem")); 80 | setRemarks(resultSet.getString("remark")); 81 | } 82 | } catch (SQLException e) { 83 | e.printStackTrace(); 84 | } 85 | } 86 | 87 | 88 | 89 | 90 | public String[] selectStudent(){ 91 | ResultSet availableStudent = manageDbUtils.selectStudent(); 92 | int i = 0; 93 | try { 94 | while (availableStudent.next()){ 95 | i++; 96 | } 97 | }catch(SQLException e){ 98 | e.printStackTrace(); 99 | } 100 | availableStudent = manageDbUtils.selectStudent(); 101 | String[] students = new String[i]; 102 | i=0; 103 | try { 104 | while (availableStudent.next()){ 105 | students[i] = availableStudent.getString("studentName"); 106 | i++; 107 | } 108 | }catch(SQLException e){ 109 | e.printStackTrace(); 110 | } 111 | return students; 112 | } 113 | 114 | 115 | public String[][] selectStudentDetails(){ 116 | ResultSet availableStudents = manageDbUtils.selectStudent(); 117 | int i = 0; 118 | try { 119 | while (availableStudents.next()){ 120 | i++; 121 | } 122 | }catch(SQLException e){ 123 | e.printStackTrace(); 124 | } 125 | availableStudents = manageDbUtils.selectStudent(); 126 | String[][] students = new String[i][2]; 127 | i=0; 128 | try { 129 | while (availableStudents.next()){ 130 | int j=0; 131 | students[i][j] = availableStudents.getString("studentName"); 132 | j++; 133 | students[i][j] = availableStudents.getString("studentId"); 134 | i++; 135 | } 136 | }catch(SQLException e){ 137 | e.printStackTrace(); 138 | } 139 | return students; 140 | } 141 | public int noOfStudents(){ 142 | ResultSet availableStudents = manageDbUtils.selectStudent(); 143 | int i = 0; 144 | try { 145 | while (availableStudents.next()){ 146 | i++; 147 | } 148 | }catch(SQLException e){ 149 | e.printStackTrace(); 150 | } 151 | return i; 152 | } 153 | 154 | public int selectStudentId(String studentName){ 155 | ResultSet availableStudents = manageDbUtils.selectStudentId(studentName); 156 | 157 | int id = 0; 158 | try { 159 | while (availableStudents.next()){ 160 | id = availableStudents.getInt("studentId"); 161 | } 162 | }catch(SQLException e){ 163 | e.printStackTrace(); 164 | } 165 | return id; 166 | } 167 | 168 | public String selectRemark(String studentName){ 169 | ResultSet availableStudent = manageDbUtils.selectStudent(); 170 | int i = 0; 171 | try { 172 | while (availableStudent.next()){ 173 | i++; 174 | } 175 | }catch(SQLException e){ 176 | e.printStackTrace(); 177 | } 178 | availableStudent = manageDbUtils.selectStudent(); 179 | String students = null; 180 | i=0; 181 | try { 182 | while (availableStudent.next()){ 183 | students = availableStudent.getString("remark"); 184 | i++; 185 | } 186 | }catch(SQLException e){ 187 | e.printStackTrace(); 188 | } 189 | return students; 190 | } 191 | 192 | public String[][] getStudentModule(String studentLevel,int studentId){ 193 | int semester1 = 0, semester2 = 0; 194 | if (studentLevel.equals("Four")){ 195 | semester1 = 1; 196 | semester2 = 2; 197 | }else if(studentLevel.equals("Five")){ 198 | semester1=3; 199 | semester2=4; 200 | }else if (studentLevel.equals("Six")){ 201 | semester1=5; 202 | semester2=6; 203 | } 204 | ResultSet studentDetails = manageDbUtils.selectModuleDetails(studentId,semester1,semester2); 205 | int i = 0; 206 | try { 207 | while (studentDetails.next()){ 208 | i++; 209 | } 210 | }catch(SQLException e){ 211 | e.printStackTrace(); 212 | } 213 | studentDetails = manageDbUtils.selectModuleDetails(studentId,semester1,semester2); 214 | int j = 0; 215 | String[][] details = new String[i][4]; 216 | try { 217 | while (studentDetails.next()){ 218 | details[j][0] = studentLevel; 219 | details[j][1]= studentDetails.getString("moduleName"); 220 | details[j][2]= studentDetails.getString("semester"); 221 | details[j][3] = "Enrolled"; 222 | j++; 223 | 224 | } 225 | return details; 226 | }catch(SQLException e){ 227 | e.printStackTrace(); 228 | } 229 | return null;} 230 | 231 | public int[] selectStudentsId(String moduleName){ 232 | ResultSet availableStudent = manageDbUtils.selectStudentsId(moduleName); 233 | int i = 0; 234 | try { 235 | while (availableStudent.next()){ 236 | i++; 237 | } 238 | }catch(SQLException e){ 239 | e.printStackTrace(); 240 | } 241 | availableStudent = manageDbUtils.selectStudentsId(moduleName); 242 | int[] students = new int[i]; 243 | i=0; 244 | try { 245 | while (availableStudent.next()){ 246 | students[0] = availableStudent.getInt("studentId"); 247 | i++; 248 | } 249 | }catch(SQLException e){ 250 | e.printStackTrace(); 251 | } 252 | return students; 253 | } 254 | public String selectStudentName(int studentId){ 255 | ResultSet resultSet = manageDbUtils.selectStudentName(studentId); 256 | String students= new String(); 257 | try { 258 | while (resultSet.next()){ 259 | students = resultSet.getString("studentId"); 260 | } 261 | }catch(SQLException e){ 262 | e.printStackTrace(); 263 | } 264 | return students; 265 | } 266 | } 267 | -------------------------------------------------------------------------------- /src/com/Model/MainBody/Users.java: -------------------------------------------------------------------------------- 1 | package com.Model.MainBody; 2 | import java.util.Random; 3 | import java.util.random.*; 4 | 5 | 6 | import com.Controller.CreateDbUtils; 7 | 8 | import java.sql.Connection; 9 | 10 | public class Users { 11 | private Connection con; 12 | private String userId; 13 | private String userType; 14 | private String userPassword; 15 | 16 | public void users(){ 17 | try { 18 | con = CreateDbUtils.getDbConnection(); 19 | } catch (Exception ex) { 20 | System.out.println("Couldn't connect to database!"); 21 | } 22 | 23 | } 24 | public String getUserId() { 25 | return userId; 26 | } 27 | public void setUserId(String userId) { 28 | this.userId = userId; 29 | } 30 | 31 | public String getUserPassword() { 32 | return userPassword; 33 | } 34 | public void setUserPassword(String password) { 35 | this.userPassword = password; 36 | } 37 | 38 | public String getUserType() { 39 | return userType; 40 | } 41 | public void setUserType(String userType) { 42 | this.userType = userType; 43 | } 44 | 45 | 46 | public int GenerateID(){ 47 | Random random = new Random(); 48 | int ID = random.nextInt(100000,10000000); 49 | return ID; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/com/View/Gui.java: -------------------------------------------------------------------------------- 1 | package com.View; 2 | 3 | public class Gui { 4 | public Gui(){new Login();} 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/com/View/InstructorFrame.java: -------------------------------------------------------------------------------- 1 | package com.View; 2 | 3 | import com.Controller.ManageDbUtils; 4 | import com.Model.Courses.Course; 5 | import com.Model.Courses.Module; 6 | import com.Model.MainBody.Instructor; 7 | import com.Model.MainBody.Student; 8 | 9 | import javax.swing.*; 10 | import java.awt.*; 11 | import java.awt.event.ActionEvent; 12 | import java.awt.event.ActionListener; 13 | import java.lang.reflect.Array; 14 | import java.util.ArrayList; 15 | 16 | public class InstructorFrame extends JFrame { 17 | private JButton buttonName; 18 | 19 | public void createInstructorFrame(int instructorId,String password){ 20 | Instructor instructor = new Instructor(instructorId,password); 21 | this.setTitle("COURSE MANAGEMENT SYSTEM"); 22 | this.setSize(1440,1024); 23 | this.setResizable(false); 24 | this.setBackground(new Color(90,90,90)); 25 | this.setLocationRelativeTo(null); 26 | this.setDefaultCloseOperation(EXIT_ON_CLOSE); 27 | this.getContentPane(); 28 | JPanel panel1 = new JPanel() { 29 | @Override 30 | public void paintComponent(Graphics g) { 31 | super.paintComponent(g); 32 | g.setColor(new Color(30,38,79)); 33 | g.fillRect(0, 0, 1440, 80); 34 | 35 | g.fillRect(0,0,297,1024); 36 | 37 | g.setColor(new Color(0,181,226)); 38 | g.fillRect(500,200,700,500); 39 | 40 | 41 | } 42 | }; 43 | 44 | JLabel quote = new JLabel("Quote of the Day"); 45 | quote.setBounds(750,220,700,30); 46 | quote.setFont(new Font("Roboto", Font.BOLD, 25)); 47 | quote.setForeground(Color.white); 48 | 49 | JLabel yourLevel= new JLabel("Good things come to people who wait, but better things come "); 50 | JLabel yourLevel2 = new JLabel("to those who go out and get them."); 51 | yourLevel.setBounds(520,270,1200,120); 52 | yourLevel.setFont(new Font("Roboto", Font.ITALIC, 25)); 53 | yourLevel.setForeground(Color.WHITE); 54 | yourLevel2.setBounds(650,320,1200,120); 55 | yourLevel2.setFont(new Font("Roboto", Font.ITALIC, 25)); 56 | yourLevel2.setForeground(Color.WHITE); 57 | 58 | JLabel title = new JLabel(instructor.getInstructorName()); 59 | title.setBounds(377,0,296,80); 60 | title.setFont(new Font("Roboto", Font.ITALIC, 30)); 61 | title.setForeground(Color.WHITE); 62 | 63 | 64 | 65 | 66 | 67 | JButton title1 = new JButton("Instructor"); 68 | title1.setBounds(0,0,297,80); 69 | title1.setForeground(new Color(0,50,120)); 70 | title1.setBackground(new Color(30,38,79)); 71 | title1.setBorder(null); 72 | title1.setFocusable(false); 73 | title1.setFont(new Font("Roboto",Font.BOLD, 36)); 74 | 75 | 76 | JButton logOut = new JButton("LOG OUT"); 77 | logOut.setBounds(59,770,228,53); 78 | buttonName = logOut; 79 | editButton(buttonName); 80 | logOut.addActionListener(new ActionListener() { 81 | @Override 82 | public void actionPerformed(ActionEvent e) { 83 | int dialogButton = JOptionPane.YES_NO_OPTION; 84 | int option = JOptionPane.showConfirmDialog(null,"Are you sure that you want to log out",null,dialogButton); 85 | if (option == 0){ 86 | dispose(); 87 | new Login(); 88 | } 89 | } 90 | }); 91 | 92 | JButton home = new JButton("MY PROFILE"); 93 | home.setBounds(59,94,228,53); 94 | buttonName = home; 95 | editButton(buttonName); 96 | home.addActionListener(new ActionListener() { 97 | @Override 98 | public void actionPerformed(ActionEvent e) { 99 | 100 | dispose(); 101 | AddProfileFrame(instructorId,password); 102 | } 103 | }); 104 | 105 | 106 | 107 | 108 | JButton enrolledModules = new JButton("Grade Student"); 109 | enrolledModules.setBounds(59,147,228,53); 110 | buttonName = enrolledModules; 111 | editButton(buttonName); 112 | enrolledModules.addActionListener(new ActionListener() { 113 | @Override 114 | public void actionPerformed(ActionEvent e) { 115 | dispose(); 116 | AddInstructorModule(instructorId,password); 117 | } 118 | }); 119 | 120 | 121 | this.add(quote); 122 | this.add(yourLevel2); 123 | this.add(yourLevel); 124 | this.add(title); 125 | this.add(title1); 126 | this.add(home); 127 | this.add(enrolledModules); 128 | this.add(logOut); 129 | this.add(panel1); 130 | 131 | this.setVisible(true); 132 | } 133 | 134 | public void BottomFramePanel(JFrame frameName, int id , String password){ 135 | JPanel panel = new JPanel() { 136 | @Override 137 | public void paintComponent(Graphics g) { 138 | super.paintComponent(g); 139 | g.setColor(new Color(30,38,79)); 140 | g.fillRect(0, 735, 1440, 100); 141 | 142 | 143 | } 144 | }; 145 | 146 | JButton mainMenu = new JButton("MAIN MENU"); 147 | mainMenu.setBounds(600,750,228,53); 148 | buttonName = mainMenu; 149 | editButton(buttonName); 150 | mainMenu.addActionListener(new ActionListener() { 151 | @Override 152 | public void actionPerformed(ActionEvent e) { 153 | frameName.dispose(); 154 | createInstructorFrame(id,password); 155 | } 156 | }); 157 | frameName.add(mainMenu); 158 | frameName.add(panel); 159 | 160 | 161 | frameName.setVisible(true); 162 | 163 | 164 | } 165 | public void editButton(JButton buttonName){ 166 | buttonName.setForeground(Color.WHITE); 167 | buttonName.setBackground(new Color(30,38,79)); 168 | buttonName.setBorder(null); 169 | buttonName.setFocusable(false); 170 | buttonName.setHorizontalAlignment(SwingConstants.LEFT); 171 | buttonName.setFont(new Font("Roboto",Font.LAYOUT_LEFT_TO_RIGHT, 20)); 172 | } 173 | public void AddProfileFrame(int instructorId, String password){ 174 | Instructor instructor = new Instructor(instructorId,password); 175 | JFrame profileFrame = new JFrame(); 176 | profileFrame.setTitle("COURSE MANAGEMENT SYSTEM"); 177 | profileFrame.setSize(1440,1024); 178 | profileFrame.setResizable(false); 179 | profileFrame.setBackground(new Color(90,90,90)); 180 | profileFrame.setLocationRelativeTo(null); 181 | profileFrame.setDefaultCloseOperation(EXIT_ON_CLOSE); 182 | profileFrame.getContentPane(); 183 | JPanel panel = new JPanel(); 184 | JLabel label = new JLabel("My Details"); 185 | label.setBounds(600,20,300,30); 186 | label.setFont(new Font("Roboto",Font.BOLD,25)); 187 | 188 | JLabel id = new JLabel("Student ID: "+ instructor.getInstructorId()); 189 | id.setFont(new Font("Roboto",Font.CENTER_BASELINE,25)); 190 | id.setBounds(500,100,400,30); 191 | 192 | JLabel name = new JLabel("Student Name: "+ instructor.getInstructorName()); 193 | name.setFont(new Font("Roboto",Font.CENTER_BASELINE,25)); 194 | name.setBounds(500,150,400,30); 195 | 196 | JLabel Address = new JLabel("Address: "+instructor.getAddress()); 197 | Address.setFont(new Font("Roboto",Font.CENTER_BASELINE,25)); 198 | Address.setBounds(500,200,400,30); 199 | 200 | JLabel emailAddress = new JLabel("Email Address: "+instructor.getEmail()); 201 | emailAddress.setFont(new Font("Roboto",Font.CENTER_BASELINE,25)); 202 | emailAddress.setBounds(500,250,800,30); 203 | 204 | 205 | JLabel a = new JLabel(""); 206 | 207 | profileFrame.add(id); 208 | profileFrame.add(emailAddress); 209 | profileFrame.add(Address); 210 | profileFrame.add(label); 211 | profileFrame.add(name); 212 | 213 | 214 | profileFrame.add(a); 215 | profileFrame.setVisible(true); 216 | BottomFramePanel(profileFrame,instructorId,password); 217 | } 218 | public void AddInstructorModule(int instructorId, String password){ 219 | Student student = new Student(); 220 | Module module = new Module(); 221 | Instructor instructor = new Instructor(instructorId,password); 222 | Course course = new Course(); 223 | JFrame instructorModule = new JFrame(); 224 | instructorModule.setTitle("COURSE MANAGEMENT SYSTEM"); 225 | instructorModule.setSize(1440,1024); 226 | instructorModule.setResizable(false); 227 | instructorModule.setBackground(new Color(90,90,90)); 228 | instructorModule.setLocationRelativeTo(null); 229 | instructorModule.setDefaultCloseOperation(EXIT_ON_CLOSE); 230 | instructorModule.getContentPane(); 231 | 232 | JLabel label = new JLabel(""); 233 | 234 | JComboBox selectModules = new JComboBox<>(instructor.selectInstructorsModule(instructor.getInstructorName())); 235 | selectModules.setBounds(700,50,200,20); 236 | 237 | JLabel students = new JLabel("Select Student:"); 238 | students.setBounds(500,100,200,20); 239 | students.setFont(new Font("Roboto",Font.BOLD,20)); 240 | 241 | JComboBox selectStudents = new JComboBox<>(); 242 | selectStudents.setBounds(700,100,200,20); 243 | 244 | selectModules.addActionListener(new ActionListener() { 245 | @Override 246 | public void actionPerformed(ActionEvent e) { 247 | int num = student.selectStudentsId(selectModules.getSelectedItem().toString()).length; 248 | int[] id = student.selectStudentsId(selectModules.getSelectedItem().toString()); 249 | for (int i = 0; i < num; i++) { 250 | selectStudents.addItem(String.valueOf(id[i])); 251 | 252 | } 253 | } 254 | }); 255 | 256 | 257 | 258 | 259 | 260 | JLabel Name = new JLabel(""); 261 | JTextField moduleName = new JTextField(); 262 | Name.setBounds(500,150,400,20); 263 | moduleName.setBounds(850,150,200,20); 264 | Name.setFont(new Font("Roboto",Font.CENTER_BASELINE,15)); 265 | JButton button = new JButton("ADD MARK"); 266 | button.setBounds(600,200,200,20); 267 | 268 | selectModules.addActionListener(new ActionListener() { 269 | @Override 270 | public void actionPerformed(ActionEvent e) { 271 | int num = student.selectStudentsId(selectModules.getSelectedItem().toString()).length; 272 | int[] id = student.selectStudentsId(selectModules.getSelectedItem().toString()); 273 | for (int i = 0; i < num; i++) { 274 | selectStudents.addItem(String.valueOf(id[i])); 275 | 276 | } 277 | Name.setText(selectModules.getSelectedItem().toString()); 278 | } 279 | }); 280 | 281 | 282 | JLabel selectModule = new JLabel("Select your Module: "); 283 | selectModule.setBounds(500,50,200,20); 284 | selectModule.setFont(new Font("Roboto",Font.BOLD,20)); 285 | 286 | button.addActionListener(new ActionListener() { 287 | @Override 288 | public void actionPerformed(ActionEvent e) { 289 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 290 | manageDbUtils.updateMark(selectStudents.getSelectedItem().toString(),selectModules.getSelectedItem().toString(),moduleName.getText()); 291 | JOptionPane.showMessageDialog(null,"Success!!"); 292 | } 293 | }); 294 | 295 | instructorModule.add(button); 296 | instructorModule.add(selectStudents); 297 | instructorModule.add(students); 298 | instructorModule.add(selectModule); 299 | instructorModule.add(selectModules); 300 | instructorModule.add(Name); 301 | instructorModule.add(moduleName); 302 | instructorModule.add(label); 303 | instructorModule.setVisible(true); 304 | BottomFramePanel(instructorModule,instructorId,password); 305 | } 306 | 307 | 308 | } 309 | 310 | -------------------------------------------------------------------------------- /src/com/View/Login.java: -------------------------------------------------------------------------------- 1 | package com.View; 2 | 3 | import com.Controller.ManageDbUtils; 4 | import com.Model.Courses.Course; 5 | import com.Model.MainBody.Student; 6 | 7 | import javax.swing.*; 8 | import java.awt.*; 9 | import java.awt.event.ActionEvent; 10 | import java.awt.event.ActionListener; 11 | import java.sql.Connection; 12 | 13 | public class Login extends JFrame implements ActionListener{ 14 | private JFrame frame = new JFrame(); 15 | private JTextField usernameTextField = new JTextField(20); 16 | private JPasswordField passwordTextField = new JPasswordField(20); 17 | private String[] userTypes = {"Student", "Teacher", "Administrator"}; 18 | private JComboBox selectUserType = new JComboBox<>(userTypes); 19 | private JButton registerBtn; 20 | private JButton loginBtn; 21 | private Object[] Users = {"Student","Instructor","Admin"};; 22 | private JComboBox userType = new JComboBox<>(Users); 23 | 24 | Container c; 25 | 26 | 27 | public Login(){ 28 | 29 | //Creating Login form 30 | setTitle("Course Management System"); 31 | setSize(400,300); 32 | setResizable(false); 33 | setLocationRelativeTo(null); 34 | setDefaultCloseOperation(EXIT_ON_CLOSE); 35 | c = getContentPane(); 36 | c.setLayout(null); 37 | 38 | //Labels 39 | JLabel label1 = new JLabel("UserID"); 40 | JLabel label2 = new JLabel("Password"); 41 | JLabel label3 = new JLabel("User Type"); 42 | label1.setBounds(20,50,100,20); 43 | label2.setBounds(20,100,100,20); 44 | label3.setBounds(20,150,100,20); 45 | c.add(label1); 46 | c.add(label2); 47 | c.add(label3); 48 | 49 | //Text & Password fields 50 | usernameTextField.setBounds(120,50,130,25); 51 | c.add(usernameTextField); 52 | passwordTextField.setBounds(120,100,130,25); 53 | c.add(passwordTextField); 54 | userType.setBounds(120,150,130,25); 55 | c.add(userType); 56 | Course course = new Course(); 57 | course.cancelCourse(); 58 | 59 | 60 | //Buttons 61 | loginBtn = new JButton("Login"); 62 | loginBtn.setBounds(50,200,90,20); 63 | loginBtn.addActionListener(this); 64 | c.add(loginBtn); 65 | loginBtn.addActionListener(new ActionListener() { 66 | @Override 67 | public void actionPerformed(ActionEvent e) { 68 | String userID = usernameTextField.getText(); 69 | String password = String.valueOf(passwordTextField.getPassword()); 70 | String UserType = userType.getSelectedItem().toString(); 71 | if (userID.length()==0 || password.length() == 0){ 72 | JOptionPane.showMessageDialog(null,"Please fill the box with your UserID and Password!!", "EmptyBox",JOptionPane.ERROR_MESSAGE); 73 | 74 | }else{ 75 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 76 | String RealPassword = manageDbUtils.CheckLoginDetails(userID,UserType); 77 | if (UserType == "Admin") { 78 | if (RealPassword.equals(password)) { 79 | dispose(); 80 | AdminFrame adminFrame = new AdminFrame(); 81 | adminFrame.createAdminFrame(); 82 | } else { 83 | JOptionPane.showMessageDialog(null, "Invalid Password!!", "Password Incorrect", JOptionPane.ERROR_MESSAGE); 84 | } 85 | }else if(UserType == "Student"){ 86 | if (RealPassword.equals(password)) { 87 | dispose(); 88 | int UserId = Integer.parseInt(userID); 89 | StudentFrame studentFrame = new StudentFrame(); 90 | studentFrame.createStudentFrame(UserId,password); 91 | } else { 92 | JOptionPane.showMessageDialog(null, "Invalid Password!!", "Password Incorrect", JOptionPane.ERROR_MESSAGE); 93 | } 94 | }else if (UserType == "Instructor"){ 95 | if (RealPassword.equals(password)) { 96 | dispose(); 97 | InstructorFrame instructorFrame = new InstructorFrame(); 98 | instructorFrame.createInstructorFrame(Integer.parseInt(userID),password); 99 | } else { 100 | JOptionPane.showMessageDialog(null, "Invalid Password!!", "Password Incorrect", JOptionPane.ERROR_MESSAGE); 101 | } 102 | } 103 | } 104 | 105 | } 106 | 107 | }); 108 | 109 | registerBtn = new JButton("Register"); 110 | registerBtn.setBounds(200,200,90,20); 111 | registerBtn.addActionListener(this); 112 | c.add(registerBtn); 113 | 114 | 115 | setVisible(true); 116 | 117 | } 118 | 119 | 120 | 121 | @Override 122 | public void actionPerformed(ActionEvent e) { 123 | if(e.getSource()==registerBtn){ 124 | this.dispose(); 125 | UserType userType = new UserType(); 126 | 127 | } 128 | } 129 | 130 | } 131 | 132 | 133 | -------------------------------------------------------------------------------- /src/com/View/Register.java: -------------------------------------------------------------------------------- 1 | package com.View; 2 | import javax.swing.*; 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | 8 | import com.Controller.ManageDbUtils; 9 | import com.Model.MainBody.Users; 10 | 11 | public class Register extends JFrame{ 12 | private JFrame registrationFrame = new JFrame(); 13 | private JTextField GetName = new JTextField(); 14 | private JTextField GetAddress = new JTextField(); 15 | private JTextField GetEmailAddress = new JTextField(); 16 | private JPasswordField GetPassword = new JPasswordField(); 17 | private JPasswordField GetConfirmPassword = new JPasswordField(); 18 | private Object[] Level = {"Four","Five","Six"}; 19 | private JComboBox GetLevel = new JComboBox(Level); 20 | 21 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 22 | Users users = new Users(); 23 | 24 | 25 | //Student Registration form 26 | Register(){ 27 | //Creating Register frame 28 | String userType = "Student"; 29 | setTitle("Course Management System"); 30 | setSize(400,500); 31 | setResizable(false); 32 | setLocationRelativeTo(null); 33 | setDefaultCloseOperation(EXIT_ON_CLOSE); 34 | this.getContentPane(); 35 | this.setLayout(null); 36 | 37 | 38 | //Labels 39 | JLabel name1 = new JLabel("Full Name"); 40 | name1.setBounds(20,50,120,20); 41 | JLabel address1 = new JLabel("Address"); 42 | address1.setBounds(20,100,100,20); 43 | JLabel emailAddress1 = new JLabel("Email Address"); 44 | emailAddress1.setBounds(20,150,100,20); 45 | JLabel password1 = new JLabel("Password"); 46 | password1.setBounds(20,200,100,20); 47 | JLabel confirmPassword1 = new JLabel("Confirm Password"); 48 | confirmPassword1.setBounds(20,250,120,20); 49 | JLabel level1 = new JLabel("Level"); 50 | level1.setBounds(20,300,100,20); 51 | JLabel course1 = new JLabel("Course"); 52 | course1.setBounds(20,350,100,20); 53 | this.add(name1); 54 | this.add(address1); 55 | this.add(emailAddress1); 56 | this.add(level1); 57 | this.add(course1); 58 | this.add(password1); 59 | this.add(confirmPassword1); 60 | 61 | // Adding Courses from database 62 | ResultSet availableCourse = manageDbUtils.selectCourse("false"); 63 | int i=0; 64 | 65 | try{ 66 | while (availableCourse.next()){ 67 | i++; 68 | }}catch(SQLException e){ 69 | e.printStackTrace(); 70 | } 71 | availableCourse = manageDbUtils.selectCourse("false"); 72 | System.out.println(i); 73 | String[] courses = new String[i]; 74 | i=0; 75 | try{ 76 | while(availableCourse.next()){ 77 | courses[i] = availableCourse.getString("courseName"); 78 | i++; 79 | } 80 | }catch(SQLException e){ 81 | e.printStackTrace(); 82 | } 83 | 84 | 85 | 86 | 87 | JComboBox GetCourse = new JComboBox<>(courses); 88 | //Text fields 89 | GetName.setBounds(150,50,150,20); 90 | GetAddress.setBounds(150,100,150,20); 91 | GetEmailAddress.setBounds(150,150,150,20); 92 | GetPassword.setBounds(150,200,150,20); 93 | GetConfirmPassword.setBounds(150,250,150,20); 94 | GetLevel.setBounds(150,300,150,20); 95 | GetCourse.setBounds(150,350,150,20); 96 | 97 | this.add(GetName); 98 | this.add(GetAddress); 99 | this.add(GetEmailAddress); 100 | this.add(GetLevel); 101 | this.add(GetCourse); 102 | this.add(GetPassword); 103 | this.add(GetConfirmPassword); 104 | 105 | 106 | 107 | //Button 108 | JButton register = new JButton("Register"); 109 | register.setBounds(140,400,120,20); 110 | this.add(register); 111 | register.addActionListener(new ActionListener() { 112 | @Override 113 | public void actionPerformed(ActionEvent e) { 114 | String name = GetName.getText(); 115 | String address = GetAddress.getText(); 116 | String emailAddress = GetEmailAddress.getText(); 117 | String password = String.valueOf(GetPassword.getPassword()); 118 | String confirmPassword = String.valueOf(GetConfirmPassword.getPassword()); 119 | String level = GetLevel.getSelectedItem().toString(); 120 | String course = GetCourse.getSelectedItem().toString(); 121 | 122 | if (name.length()==0 || address.length()==0 || password.length()==0 || emailAddress.length()==0) { 123 | JOptionPane.showMessageDialog(null,"Please fill all the empty box!!", "Empty Information!!",JOptionPane.ERROR_MESSAGE); 124 | return; 125 | 126 | }else{ 127 | if (password.equals(confirmPassword)){ 128 | try { 129 | int StudentID = users.GenerateID(); 130 | int ID = StudentID; 131 | manageDbUtils.saveUserDetails(ID, password, userType); 132 | boolean error = manageDbUtils.saveStudentDetails(StudentID, name, emailAddress, course, address, level); 133 | manageDbUtils.updateCourseStatus(true, course); 134 | if (!error) { 135 | JOptionPane.showMessageDialog(null, "Your Account is successfully created!!! \n" + ID + " is your userID."); 136 | 137 | dispose(); 138 | new SelectModules(StudentID,course); 139 | } 140 | } catch (Exception ex) { 141 | System.out.println("Account couldn't be registered."); 142 | } 143 | } 144 | } 145 | 146 | } 147 | }); 148 | 149 | setVisible(true); 150 | 151 | } 152 | 153 | 154 | 155 | 156 | 157 | //Instructor Registration form 158 | Register(int InstructorID){ 159 | // Instructor's Frame 160 | String userType = "Instructor"; 161 | setTitle("Instructor's Registration"); 162 | setSize(350,450); 163 | setResizable(false); 164 | setLocationRelativeTo(null); 165 | setDefaultCloseOperation(EXIT_ON_CLOSE); 166 | this.getContentPane(); 167 | this.setLayout(null); 168 | 169 | 170 | JLabel name1 = new JLabel("Full Name"); 171 | name1.setBounds(20,50,120,20); 172 | JLabel address1 = new JLabel("Address"); 173 | address1.setBounds(20,100,100,20); 174 | JLabel emailAddress1 = new JLabel("Email Address"); 175 | emailAddress1.setBounds(20,150,100,20); 176 | JLabel password1 = new JLabel("Password"); 177 | password1.setBounds(20,200,100,20); 178 | JLabel confirmPassword1 = new JLabel("Confirm Password"); 179 | confirmPassword1.setBounds(20,250,120,20); 180 | 181 | //Text fields 182 | GetName.setBounds(150,50,150,20); 183 | GetAddress.setBounds(150,100,150,20); 184 | GetEmailAddress.setBounds(150,150,150,20); 185 | GetPassword.setBounds(150,200,150,20); 186 | GetConfirmPassword.setBounds(150,250,150,20); 187 | 188 | 189 | this.add(name1); 190 | this.add(address1); 191 | this.add(emailAddress1); 192 | this.add(password1); 193 | this.add(confirmPassword1); 194 | this.add(GetName); 195 | this.add(GetAddress); 196 | this.add(GetEmailAddress); 197 | this.add(GetPassword); 198 | this.add(GetConfirmPassword); 199 | 200 | 201 | 202 | 203 | //Button 204 | JButton register = new JButton("Register"); 205 | register.setBounds(100,300,120,20); 206 | this.add(register); 207 | register.addActionListener(new ActionListener() { 208 | @Override 209 | public void actionPerformed(ActionEvent e) { 210 | String name = GetName.getText(); 211 | String address = GetAddress.getText(); 212 | String emailAddress = GetEmailAddress.getText(); 213 | String password = String.valueOf(GetPassword.getPassword()); 214 | String confirmPassword = String.valueOf(GetConfirmPassword.getPassword()); 215 | 216 | 217 | if (name.length() == 0 || address.length() == 0 || password.length() == 0 || emailAddress.length() == 0) { 218 | JOptionPane.showMessageDialog(null,"Please fill all the empty box!!", "Empty Information!!",JOptionPane.ERROR_MESSAGE); 219 | return; 220 | }else{ 221 | if(password.equals(confirmPassword)){ 222 | try { 223 | int InstructorID = users.GenerateID(); 224 | int ID = InstructorID; 225 | manageDbUtils.saveUserDetails(ID, password, userType); 226 | boolean error = manageDbUtils.saveInstructorDetails(InstructorID, name, address, emailAddress ); 227 | manageDbUtils.saveInstructorDetails(name); 228 | if (!error) { 229 | JOptionPane.showMessageDialog(null, "Your Account is successfully created!!! \n" + ID + " is your userID."); 230 | dispose(); 231 | new Login(); 232 | } 233 | } catch (Exception exception) { 234 | System.out.println("Account couldn't be registered."); 235 | } 236 | 237 | } else { 238 | JOptionPane.showMessageDialog(null, "Please Enter the Matching Password!!", "Password Mismatched!!", JOptionPane.ERROR_MESSAGE); 239 | } 240 | } 241 | } 242 | }); 243 | 244 | 245 | 246 | setVisible(true); 247 | } 248 | 249 | 250 | 251 | } -------------------------------------------------------------------------------- /src/com/View/SelectModules.java: -------------------------------------------------------------------------------- 1 | package com.View; 2 | 3 | import com.Controller.ManageDbUtils; 4 | import com.Model.Courses.Module; 5 | 6 | import javax.swing.*; 7 | import javax.swing.table.DefaultTableCellRenderer; 8 | import javax.swing.table.DefaultTableModel; 9 | import javax.swing.table.TableColumn; 10 | import java.awt.*; 11 | import java.awt.event.ActionEvent; 12 | import java.awt.event.ActionListener; 13 | 14 | public class SelectModules extends JFrame{ 15 | private JFrame frame = new JFrame(); 16 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 17 | Module module = new Module(); 18 | private Object[] columnNames = {"Module Name","Semester","Credits", "Module Type"}; 19 | String[][] rowData ; 20 | 21 | public SelectModules(int studentID, String courseName){ 22 | this.setTitle("COURSE MANAGEMENT SYSTEM"); 23 | this.setSize(1440,1024); 24 | this.setResizable(false); 25 | this.setBackground(new Color(90,90,90)); 26 | this.setLocationRelativeTo(null); 27 | this.setDefaultCloseOperation(EXIT_ON_CLOSE); 28 | this.getContentPane(); 29 | int numberOfRows = module.totalNumOfModules(courseName); 30 | JLabel title = new JLabel("Modules For Your Course"); 31 | title.setBounds(500,510,800,50); 32 | title.setFont(new Font("Roboto",Font.BOLD,25)); 33 | 34 | JLabel note = new JLabel("Note: You can select a optional subject for 5th and 6th semester!"); 35 | note.setBounds(470,560,800,30); 36 | note.setForeground(Color.red); 37 | 38 | JTable table = new JTable(numberOfRows,4); 39 | JScrollPane scrollPane = new JScrollPane(); 40 | 41 | rowData = module.selectModules(courseName); 42 | DefaultTableModel model = new DefaultTableModel(rowData, columnNames); 43 | table.setBackground(Color.WHITE); 44 | table.setRowHeight(25); 45 | table.setAutoResizeMode( JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); 46 | table.setCellSelectionEnabled(false); 47 | 48 | JLabel selectModule1 = new JLabel("Select Optional Module for 5th semester: "); 49 | JLabel selectModule2 = new JLabel("Select Optional Module for 6th semester: "); 50 | selectModule1.setBounds(300,600,400,30); 51 | selectModule1.setFont(new Font("Roboto",Font.BOLD,18)); 52 | selectModule2.setBounds(300,640,400,30); 53 | selectModule2.setFont(new Font("Roboto",Font.BOLD,18)); 54 | 55 | 56 | JComboBox selectModules1 = new JComboBox<>(module.selectOptionalModule(courseName,5)); 57 | JComboBox selectModules2 = new JComboBox<>(module.selectOptionalModule(courseName,6)); 58 | selectModules1.setBounds(700,600,400,30); 59 | selectModules1.setFont(new Font("San-Serif",Font.TRUETYPE_FONT,15)); 60 | selectModules2.setBounds(700,640,400,30); 61 | selectModules2.setFont(new Font("San-Serif",Font.TRUETYPE_FONT,15)); 62 | table.setModel(model); 63 | 64 | JButton confirm = new JButton("Confirm"); 65 | confirm.setBounds(600,700,200,30); 66 | confirm.setFocusable(false); 67 | confirm.addActionListener(new ActionListener() { 68 | @Override 69 | public void actionPerformed(ActionEvent e) { 70 | int dialogButton = JOptionPane.YES_NO_OPTION; 71 | int option = JOptionPane.showConfirmDialog(null,"Are you sure that you want to select those modules?",null,dialogButton); 72 | if (option == 0){ 73 | manageDbUtils.saveStudentModule(studentID,courseName,selectModules1.getSelectedItem().toString(),selectModules2.getSelectedItem().toString()); 74 | JOptionPane.showMessageDialog(null,"Sucessfully Selected"); 75 | 76 | dispose(); 77 | new Login(); 78 | } 79 | } 80 | }); 81 | 82 | 83 | scrollPane.setViewportView(table); 84 | this.add(confirm); 85 | this.add(selectModule2); 86 | this.add(selectModule1); 87 | this.add(selectModules2); 88 | this.add(selectModules1); 89 | this.add(note); 90 | this.add(title); 91 | this.add(scrollPane); 92 | this.setVisible(true); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/com/View/StudentFrame.java: -------------------------------------------------------------------------------- 1 | package com.View; 2 | 3 | import com.Controller.ManageDbUtils; 4 | import com.Model.Courses.Course; 5 | import com.Model.Courses.Module; 6 | import com.Model.MainBody.Instructor; 7 | import com.Model.MainBody.Student; 8 | 9 | import javax.swing.*; 10 | import javax.swing.table.DefaultTableModel; 11 | import java.awt.*; 12 | import java.awt.event.ActionEvent; 13 | import java.awt.event.ActionListener; 14 | import java.util.logging.Level; 15 | 16 | public class StudentFrame extends JFrame { 17 | private JButton buttonName; 18 | 19 | public void createStudentFrame(int studentId,String password){ 20 | Module module = new Module(); 21 | Student student = new Student(studentId,password); 22 | this.setTitle("COURSE MANAGEMENT SYSTEM"); 23 | this.setSize(1440,1024); 24 | this.setResizable(false); 25 | this.setBackground(new Color(90,90,90)); 26 | this.setLocationRelativeTo(null); 27 | this.setDefaultCloseOperation(EXIT_ON_CLOSE); 28 | this.getContentPane(); 29 | JPanel panel1 = new JPanel() { 30 | @Override 31 | public void paintComponent(Graphics g) { 32 | super.paintComponent(g); 33 | g.setColor(new Color(30,38,79)); 34 | g.fillRect(0, 0, 1440, 80); 35 | 36 | g.fillRect(0,0,297,1024); 37 | 38 | g.setColor(new Color(0,181,226)); 39 | g.fillRect(500,200,700,500); 40 | 41 | 42 | } 43 | }; 44 | 45 | JLabel quote = new JLabel("Quote of the Day"); 46 | quote.setBounds(750,220,700,30); 47 | quote.setFont(new Font("Roboto", Font.BOLD, 25)); 48 | quote.setForeground(Color.white); 49 | 50 | JLabel yourLevel= new JLabel("Good things come to people who wait, but better things come "); 51 | JLabel yourLevel2 = new JLabel("to those who go out and get them."); 52 | yourLevel.setBounds(520,270,1200,120); 53 | yourLevel.setFont(new Font("Roboto", Font.ITALIC, 25)); 54 | yourLevel.setForeground(Color.WHITE); 55 | yourLevel2.setBounds(650,320,1200,120); 56 | yourLevel2.setFont(new Font("Roboto", Font.ITALIC, 25)); 57 | yourLevel2.setForeground(Color.WHITE); 58 | 59 | JLabel title = new JLabel(student.getStudentName()); 60 | title.setBounds(377,0,296,80); 61 | title.setFont(new Font("Roboto", Font.ITALIC, 30)); 62 | title.setForeground(Color.WHITE); 63 | 64 | 65 | JButton nextLevel = new JButton("Next Level"); 66 | nextLevel.setBounds(700,750,200,20); 67 | nextLevel.setFocusable(false); 68 | nextLevel.addActionListener(new ActionListener() { 69 | @Override 70 | public void actionPerformed(ActionEvent e) { 71 | String [] grades1; 72 | String [] grades2; 73 | Boolean pass; 74 | int semester1 = 0, semester2 = 0; 75 | if (student.getLevel().equals("Four")){ 76 | semester1 = 1; 77 | semester2 = 2; 78 | }else if(student.getLevel().equals("Five")){ 79 | semester1=3; 80 | semester2=4; 81 | }else if (student.getLevel().equals("Six")){ 82 | semester1=5; 83 | semester2=6; 84 | } 85 | grades1 = module.selectGrade(studentId, semester1); 86 | grades2 = module.selectGrade(studentId, semester1); 87 | try { 88 | if (Double.parseDouble(grades1[0]) >=40 && Double.parseDouble(grades1[1])>=40 && Double.parseDouble(grades1[2])>=40){ 89 | pass=true; 90 | }else{ 91 | pass=false; 92 | } 93 | if (Double.parseDouble(grades2[0]) >=40 && Double.parseDouble(grades2[1])>=40 && Double.parseDouble(grades2[2])>=40){ 94 | pass=true; 95 | }else{ 96 | pass=false; 97 | } 98 | ManageDbUtils manageDbUtils = new ManageDbUtils(); 99 | if (pass== true){ 100 | if (student.getLevel().equals("Four")){ 101 | manageDbUtils.increaseLevel(studentId,"Five"); 102 | JOptionPane.showMessageDialog(null,"Congratulation! You have been promoted to Level Five!"); 103 | dispose(); 104 | createStudentFrame(studentId,password); 105 | }else if(student.getLevel().equals("Five")){ 106 | manageDbUtils.increaseLevel(studentId,"Six"); 107 | JOptionPane.showMessageDialog(null,"Congratulation! You have been promoted to Level Six!"); 108 | dispose(); 109 | createStudentFrame(studentId,password); 110 | }else{ 111 | manageDbUtils.increaseLevel(studentId,"Graduated"); 112 | JOptionPane.showMessageDialog(null,"Congratulation! You have Graduated!"); 113 | dispose(); 114 | createStudentFrame(studentId,password); 115 | } 116 | }else{ 117 | JOptionPane.showMessageDialog(null,"You do not meet requirement to be promoted!!",null, JOptionPane.ERROR_MESSAGE); 118 | } 119 | } catch (NullPointerException ex) { 120 | JOptionPane.showMessageDialog(null,"You are not Graded Yet!!",null,JOptionPane.ERROR_MESSAGE); 121 | } 122 | 123 | } 124 | }); 125 | 126 | 127 | JButton title1 = new JButton("STUDENT"); 128 | title1.setBounds(0,0,297,80); 129 | title1.setForeground(new Color(0,50,120)); 130 | title1.setBackground(new Color(30,38,79)); 131 | title1.setBorder(null); 132 | title1.setFocusable(false); 133 | title1.setFont(new Font("Roboto",Font.BOLD, 36)); 134 | 135 | 136 | JButton logOut = new JButton("LOG OUT"); 137 | logOut.setBounds(59,770,228,53); 138 | buttonName = logOut; 139 | editButton(buttonName); 140 | logOut.addActionListener(new ActionListener() { 141 | @Override 142 | public void actionPerformed(ActionEvent e) { 143 | int dialogButton = JOptionPane.YES_NO_OPTION; 144 | int option = JOptionPane.showConfirmDialog(null,"Are you sure that you want to log out",null,dialogButton); 145 | if (option == 0){ 146 | dispose(); 147 | new Login(); 148 | } 149 | } 150 | }); 151 | 152 | JButton home = new JButton("MY PROFILE"); 153 | home.setBounds(59,94,228,53); 154 | buttonName = home; 155 | editButton(buttonName); 156 | home.addActionListener(new ActionListener() { 157 | @Override 158 | public void actionPerformed(ActionEvent e) { 159 | 160 | dispose(); 161 | AddProfileFrame(studentId,password); 162 | } 163 | }); 164 | 165 | 166 | 167 | 168 | JButton enrolledModules = new JButton("ENROLLED MODULES"); 169 | enrolledModules.setBounds(59,147,228,53); 170 | buttonName = enrolledModules; 171 | editButton(buttonName); 172 | enrolledModules.addActionListener(new ActionListener() { 173 | @Override 174 | public void actionPerformed(ActionEvent e) { 175 | dispose(); 176 | AddModuleEnrolledFrame(studentId,password); 177 | } 178 | }); 179 | 180 | JButton moduleDetails = new JButton("Module Details"); 181 | moduleDetails.setBounds(59,200,228,53); 182 | buttonName = moduleDetails; 183 | editButton(buttonName); 184 | moduleDetails.addActionListener(new ActionListener() { 185 | @Override 186 | public void actionPerformed(ActionEvent e) { 187 | dispose(); 188 | AddModuleDetailFrame(studentId,password); 189 | } 190 | }); 191 | this.add(nextLevel); 192 | this.add(quote); 193 | this.add(yourLevel2); 194 | this.add(yourLevel); 195 | this.add(title); 196 | this.add(title1); 197 | this.add(home); 198 | this.add(enrolledModules); 199 | this.add(moduleDetails); 200 | this.add(logOut); 201 | this.add(panel1); 202 | 203 | this.setVisible(true); 204 | } 205 | 206 | public void BottomFramePanel(JFrame frameName, int id , String password){ 207 | JPanel panel = new JPanel() { 208 | @Override 209 | public void paintComponent(Graphics g) { 210 | super.paintComponent(g); 211 | g.setColor(new Color(30,38,79)); 212 | g.fillRect(0, 735, 1440, 100); 213 | 214 | 215 | } 216 | }; 217 | 218 | JButton mainMenu = new JButton("MAIN MENU"); 219 | mainMenu.setBounds(600,750,228,53); 220 | buttonName = mainMenu; 221 | editButton(buttonName); 222 | mainMenu.addActionListener(new ActionListener() { 223 | @Override 224 | public void actionPerformed(ActionEvent e) { 225 | frameName.dispose(); 226 | createStudentFrame(id,password); 227 | } 228 | }); 229 | frameName.add(mainMenu); 230 | frameName.add(panel); 231 | 232 | 233 | frameName.setVisible(true); 234 | 235 | 236 | } 237 | public void editButton(JButton buttonName){ 238 | buttonName.setForeground(Color.WHITE); 239 | buttonName.setBackground(new Color(30,38,79)); 240 | buttonName.setBorder(null); 241 | buttonName.setFocusable(false); 242 | buttonName.setHorizontalAlignment(SwingConstants.LEFT); 243 | buttonName.setFont(new Font("Roboto",Font.LAYOUT_LEFT_TO_RIGHT, 20)); 244 | } 245 | 246 | public void AddProfileFrame(int studentId, String password){ 247 | Student student = new Student(studentId,password); 248 | JFrame profileFrame = new JFrame(); 249 | profileFrame.setTitle("COURSE MANAGEMENT SYSTEM"); 250 | profileFrame.setSize(1440,1024); 251 | profileFrame.setResizable(false); 252 | profileFrame.setBackground(new Color(90,90,90)); 253 | profileFrame.setLocationRelativeTo(null); 254 | profileFrame.setDefaultCloseOperation(EXIT_ON_CLOSE); 255 | profileFrame.getContentPane(); 256 | JPanel panel = new JPanel(); 257 | JLabel label = new JLabel("My Details"); 258 | label.setBounds(600,20,300,30); 259 | label.setFont(new Font("Roboto",Font.BOLD,25)); 260 | 261 | JLabel id = new JLabel("Student ID: "+ student.getStudentId()); 262 | id.setFont(new Font("Roboto",Font.CENTER_BASELINE,25)); 263 | id.setBounds(500,100,400,30); 264 | 265 | JLabel name = new JLabel("Student Name: "+ student.getStudentName()); 266 | name.setFont(new Font("Roboto",Font.CENTER_BASELINE,25)); 267 | name.setBounds(500,150,400,30); 268 | 269 | JLabel Address = new JLabel("Address: "+student.getAddress()); 270 | Address.setFont(new Font("Roboto",Font.CENTER_BASELINE,25)); 271 | Address.setBounds(500,200,400,30); 272 | 273 | JLabel emailAddress = new JLabel("Email Address: "+student.getEmailAddress()); 274 | emailAddress.setFont(new Font("Roboto",Font.CENTER_BASELINE,25)); 275 | emailAddress.setBounds(500,250,800,30); 276 | 277 | JLabel courseEnrolled = new JLabel("Course Enrolled: "+ student.getCourse()); 278 | courseEnrolled.setFont(new Font("Roboto",Font.CENTER_BASELINE,25)); 279 | courseEnrolled.setBounds(500,300,800,30); 280 | 281 | JLabel a = new JLabel(""); 282 | 283 | profileFrame.add(id); 284 | profileFrame.add(courseEnrolled); 285 | profileFrame.add(emailAddress); 286 | profileFrame.add(Address); 287 | profileFrame.add(label); 288 | profileFrame.add(name); 289 | 290 | 291 | profileFrame.add(a); 292 | profileFrame.setVisible(true); 293 | BottomFramePanel(profileFrame,studentId,password); 294 | } 295 | public void AddModuleEnrolledFrame(int studentId, String password){ 296 | Student student = new Student(studentId,password); 297 | Course course = new Course(); 298 | JFrame moduleEnrolledFrame = new JFrame(); 299 | moduleEnrolledFrame.setTitle("COURSE MANAGEMENT SYSTEM"); 300 | moduleEnrolledFrame.setSize(1440,1024); 301 | moduleEnrolledFrame.setResizable(false); 302 | moduleEnrolledFrame.setBackground(new Color(90,90,90)); 303 | moduleEnrolledFrame.setLocationRelativeTo(null); 304 | moduleEnrolledFrame.setDefaultCloseOperation(EXIT_ON_CLOSE); 305 | moduleEnrolledFrame.getContentPane(); 306 | 307 | JLabel label = new JLabel(""); 308 | Object[] columnName = {"Level","Module Name","Semester","Enrolled Status"}; 309 | String[][] rowData = student.getStudentModule(student.getLevel(),studentId); 310 | 311 | JTable table = new JTable(7,4); 312 | ScrollPane scrollPane = new ScrollPane(); 313 | 314 | DefaultTableModel model = new DefaultTableModel(rowData, columnName); 315 | table.setBackground(Color.WHITE); 316 | table.setRowHeight(30); 317 | table.setAutoResizeMode( JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); 318 | table.setCellSelectionEnabled(false); 319 | scrollPane.setBounds(300,200,800,185); 320 | 321 | JLabel level = new JLabel("Level"); 322 | JLabel moduleName = new JLabel("Module Name"); 323 | JLabel semester = new JLabel("Semester"); 324 | JLabel status = new JLabel("Enrolled Status"); 325 | level.setBounds(300,170,200,20); 326 | semester.setBounds(700,170,200,20); 327 | moduleName.setBounds(500,170,200,20); 328 | status.setBounds(900,170,200,20); 329 | level.setFont(new Font("Roboto",Font.CENTER_BASELINE,20)); 330 | semester.setFont(new Font("Roboto",Font.CENTER_BASELINE,20)); 331 | moduleName.setFont(new Font("Roboto",Font.CENTER_BASELINE,20)); 332 | status.setFont(new Font("Roboto",Font.CENTER_BASELINE,20)); 333 | 334 | 335 | JLabel title = new JLabel("ENROLLED MODULES"); 336 | title.setBounds(500,30,800,30); 337 | title.setFont(new Font("Roboto",Font.BOLD,30)); 338 | 339 | table.setModel(model); 340 | scrollPane.add(table); 341 | moduleEnrolledFrame.add(title); 342 | moduleEnrolledFrame.add(status); 343 | moduleEnrolledFrame.add(level); 344 | moduleEnrolledFrame.add(semester); 345 | moduleEnrolledFrame.add(moduleName); 346 | moduleEnrolledFrame.add(scrollPane); 347 | moduleEnrolledFrame.add(label); 348 | moduleEnrolledFrame.setVisible(true); 349 | BottomFramePanel(moduleEnrolledFrame,studentId,password); 350 | } 351 | public void AddModuleDetailFrame(int studentId, String password){ 352 | Student student = new Student(studentId, password); 353 | Instructor ins = new Instructor(); 354 | Module module = new Module(); 355 | JFrame moduleDetailFrame = new JFrame(); 356 | moduleDetailFrame.setTitle("COURSE MANAGEMENT SYSTEM"); 357 | moduleDetailFrame.setSize(1440,1024); 358 | moduleDetailFrame.setResizable(false); 359 | moduleDetailFrame.setBackground(new Color(90,90,90)); 360 | moduleDetailFrame.setLocationRelativeTo(null); 361 | moduleDetailFrame.setDefaultCloseOperation(EXIT_ON_CLOSE); 362 | moduleDetailFrame.getContentPane(); 363 | JLabel label = new JLabel(""); 364 | 365 | JLabel selectModule = new JLabel("Select Module:"); 366 | selectModule.setBounds(500,20,200,20); 367 | selectModule.setFont(new Font("Roboto",Font.BOLD,20)); 368 | 369 | JComboBox modules = new JComboBox<>(module.getStudentModule(student.getLevel(),studentId)); 370 | modules.setBounds(650,20,200,20); 371 | 372 | JLabel moduleCode = new JLabel("Module Code: "); 373 | JLabel moduleName = new JLabel("Module Name : "); 374 | JLabel instructor = new JLabel("Assigned Instructor : "); 375 | moduleCode.setBounds(400,120,800,30); 376 | moduleName.setBounds(400,170,800,30); 377 | instructor.setBounds(400,220,800,30); 378 | moduleCode.setFont(new Font("Roboto",Font.BOLD,20)); 379 | moduleName.setFont(new Font("Roboto",Font.BOLD,20)); 380 | instructor.setFont(new Font("Roboto",Font.BOLD,20)); 381 | 382 | modules.addActionListener(new ActionListener() { 383 | @Override 384 | 385 | public void actionPerformed(ActionEvent e) { 386 | String[] code = module.moduleInfo(modules.getSelectedItem().toString()); 387 | moduleName.setText("Module Name: "+ modules.getSelectedItem().toString()); 388 | moduleCode.setText("Module Code: " + code[0]); 389 | instructor.setText("Assigned Instructor: " + ins.assignInstructor(modules.getSelectedItem().toString())); 390 | } 391 | }); 392 | 393 | 394 | 395 | moduleDetailFrame.add(moduleName); 396 | moduleDetailFrame.add(moduleCode); 397 | moduleDetailFrame.add(instructor); 398 | 399 | moduleDetailFrame.add(modules); 400 | moduleDetailFrame.add(selectModule); 401 | moduleDetailFrame.add(label); 402 | moduleDetailFrame.setVisible(true); 403 | BottomFramePanel(moduleDetailFrame,studentId,password); 404 | } 405 | 406 | } 407 | -------------------------------------------------------------------------------- /src/com/View/UserType.java: -------------------------------------------------------------------------------- 1 | package com.View; 2 | 3 | import com.View.Register; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | 10 | public class UserType extends JFrame implements ActionListener { 11 | private JRadioButton student, instructor; 12 | private JButton next; 13 | private int InstructorID; 14 | 15 | 16 | UserType() { 17 | 18 | setTitle("Course Management System"); 19 | setSize(300,200); 20 | setResizable(false); 21 | setLocationRelativeTo(null); 22 | setDefaultCloseOperation(EXIT_ON_CLOSE); 23 | this.getContentPane(); 24 | this.setLayout(null); 25 | JLabel label = new JLabel("Select your role:"); 26 | Font font = new Font("Courier", Font.BOLD,18); 27 | label.setFont(font); 28 | label.setBounds(40,40,500,20); 29 | student = new JRadioButton("Student"); 30 | instructor = new JRadioButton("Instructor"); 31 | // admin = new JRadioButton("Admin"); 32 | next = new JButton("Next"); 33 | 34 | ButtonGroup buttonGroup = new ButtonGroup(); 35 | buttonGroup.add(student); 36 | buttonGroup.add(instructor); 37 | // buttonGroup.add(admin); 38 | student.setBounds(40,80,100,20); 39 | instructor.setBounds(140,80,100,20); 40 | // admin.setBounds(240,50,100,20); 41 | 42 | student.addActionListener(this); 43 | instructor.addActionListener(this); 44 | // admin.addActionListener(this); 45 | next.addActionListener(this); 46 | this.add(student); 47 | this.add(instructor); 48 | this.add(label); 49 | // this.add(admin); 50 | 51 | this.setVisible(true); 52 | 53 | 54 | } 55 | // public void caseAdmin() { 56 | // JLabel label1 = new JLabel("AdminID"); 57 | // JLabel label2 = new JLabel("Password"); 58 | // JLabel label3 = new JLabel("For admin registration please enter admin id and password!!"); 59 | // label1.setBounds(40, 150 , 100, 20); 60 | // label2.setBounds(40, 200, 100, 20); 61 | // label3.setBounds(20,100,500,20); 62 | // adminID = new JTextField(); 63 | // adminID.setBounds(140, 150, 130, 25); 64 | // password = new JPasswordField(); 65 | // password.setBounds(140, 200, 130, 25); 66 | // next.setBounds(150,300,70,20); 67 | // adminID.addActionListener(this); 68 | // password.addActionListener(this); 69 | // next.addActionListener(new ActionListener() { 70 | // @Override 71 | // public void actionPerformed(ActionEvent e) { 72 | // if (e.getSource()==next){ 73 | // if(adminID.equals("admin") && (password.equals("admin"))) { 74 | // this.dis 75 | // Register register = new Register("admin","admin"); 76 | // }else{ 77 | // JOptionPane.showMessageDialog(null, "You don't have an access to create admin account!!", "Access denied!", JOptionPane.ERROR_MESSAGE); 78 | // 79 | // } 80 | // 81 | // 82 | // } 83 | // } 84 | // }); 85 | // this.add(next); 86 | // this.add(label1); 87 | // this.add(label2); 88 | // this.add(label3); 89 | // this.add(adminID); 90 | // this.add(password); 91 | // } 92 | 93 | @Override 94 | public void actionPerformed(ActionEvent e) { 95 | // if (e.getSource()==admin){ 96 | // this.dispose(); 97 | // caseAdmin(); 98 | // setVisible(true); 99 | // } 100 | if (e.getSource()==student){ 101 | this.dispose(); 102 | Register register = new Register(); 103 | }else if (e.getSource()==instructor){ 104 | this.dispose(); 105 | Register register = new Register(InstructorID); 106 | } 107 | } 108 | } 109 | 110 | 111 | -------------------------------------------------------------------------------- /src/com/View/View.plantuml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | title __VIEW's Class Diagram__\n 4 | 5 | namespace com.View { 6 | class com.View.AdminFrame { 7 | - buttonName : JButton 8 | - frame : JFrame 9 | + AddEditCourseFrame() 10 | + AddEditInstructorFrame() 11 | + AddEditModuleFrame() 12 | + AddEditStudentsGradeFrame() 13 | + AddStudentResultFrame() 14 | + AdminFrame() 15 | + BottomFramePanel() 16 | + createAdminFrame() 17 | + editButton() 18 | } 19 | } 20 | 21 | 22 | namespace com.View { 23 | class com.View.Gui { 24 | + Gui() 25 | } 26 | } 27 | 28 | 29 | namespace com.View { 30 | class com.View.InstructorFrame { 31 | - buttonName : JButton 32 | + AddInstructorModule() 33 | + AddProfileFrame() 34 | + BottomFramePanel() 35 | + createInstructorFrame() 36 | + editButton() 37 | } 38 | } 39 | 40 | 41 | namespace com.View { 42 | class com.View.Login { 43 | ~ c : Container 44 | - Users : Object[] 45 | - frame : JFrame 46 | - loginBtn : JButton 47 | - passwordTextField : JPasswordField 48 | - registerBtn : JButton 49 | - selectUserType : JComboBox 50 | - userType : JComboBox 51 | - userTypes : String[] 52 | - usernameTextField : JTextField 53 | + Login() 54 | + actionPerformed() 55 | } 56 | } 57 | 58 | 59 | namespace com.View { 60 | class com.View.Register { 61 | - GetAddress : JTextField 62 | - GetConfirmPassword : JPasswordField 63 | - GetEmailAddress : JTextField 64 | - GetLevel : JComboBox 65 | - GetName : JTextField 66 | - GetPassword : JPasswordField 67 | - Level : Object[] 68 | - registrationFrame : JFrame 69 | ~ Register() 70 | ~ Register() 71 | } 72 | } 73 | 74 | 75 | namespace com.View { 76 | class com.View.SelectModules { 77 | ~ rowData : String[][] 78 | - columnNames : Object[] 79 | - frame : JFrame 80 | + SelectModules() 81 | } 82 | } 83 | 84 | 85 | namespace com.View { 86 | class com.View.StudentFrame { 87 | - buttonName : JButton 88 | + AddModuleDetailFrame() 89 | + AddModuleEnrolledFrame() 90 | + AddProfileFrame() 91 | + BottomFramePanel() 92 | + createStudentFrame() 93 | + editButton() 94 | } 95 | } 96 | 97 | 98 | namespace com.View { 99 | class com.View.UserType { 100 | - InstructorID : int 101 | - instructor : JRadioButton 102 | - next : JButton 103 | - student : JRadioButton 104 | + actionPerformed() 105 | ~ UserType() 106 | } 107 | } 108 | 109 | 110 | com.View.AdminFrame -up-|> javax.swing.JFrame 111 | com.View.AdminFrame o-- com.Model.Courses.Course : course 112 | com.View.AdminFrame o-- com.Controller.ManageDbUtils : manageDbUtils 113 | com.View.AdminFrame o-- com.Model.Courses.Module : module 114 | com.View.InstructorFrame -up-|> javax.swing.JFrame 115 | com.View.Login .up.|> java.awt.event.ActionListener 116 | com.View.Login -up-|> javax.swing.JFrame 117 | com.View.Register -up-|> javax.swing.JFrame 118 | com.View.Register o-- com.Controller.ManageDbUtils : manageDbUtils 119 | com.View.Register o-- com.Model.MainBody.Users : users 120 | com.View.SelectModules -up-|> javax.swing.JFrame 121 | com.View.SelectModules o-- com.Controller.ManageDbUtils : manageDbUtils 122 | com.View.SelectModules o-- com.Model.Courses.Module : module 123 | com.View.StudentFrame -up-|> javax.swing.JFrame 124 | com.View.UserType .up.|> java.awt.event.ActionListener 125 | com.View.UserType -up-|> javax.swing.JFrame 126 | 127 | 128 | right footer 129 | 130 | 131 | PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it) 132 | For more information about this tool, please contact philippe.mesmeur@gmail.com 133 | endfooter 134 | 135 | @enduml 136 | --------------------------------------------------------------------------------