@Override public void insertInterview(StudentModel studentModel) { // TODO Auto-generated method stub try { Class.forName("com.mysql.jdbc.Driver"); Connection myCon = DriverManager.getConnection("jdbc:mysql://localhost:3306/EnrollTrackDB", "root", ""); Statement myStmt = myCon.createStatement(); myStmt.executeUpdate( "UPDATE studentInformation set `InterviewNeeded_InterviewID`= " + studentModel.getInterviewNeeded() + " WHERE `studentId`=" + "" + studentModel.getStudentID() + ""); } catch (Exception e) { e.printStackTrace(); } }
@Override public ArrayList<StudentModel> getCCStudentOverview(StudentModel studentModel) { // TODO Auto-generated method stub ResultSet myRes = null; ArrayList<StudentModel> ccStduentView = new ArrayList<StudentModel>(); try { Class.forName("com.mysql.jdbc.Driver"); Connection myCon = DriverManager.getConnection("jdbc:mysql://localhost:3306/EnrollTrackDB", "root", ""); Statement myStmt = myCon.createStatement(); /* * Query for finding the all students first name , last name, grade value, gpa, status in studentoverview page. */ String query = "SELECT DISTINCT studentInformation.studentId, " + "studentInformation.studentFirstName," + "studentInformation.studentLastName," + "studentInformation.currentGPA," + "studentInformation.CurrentGrade_currentGradeId," + "Course.courseName ," + "Status.statusName," + "CurrentGrade.currentGrade ," + "School.schoolName " + "from studentInformation , School ,CurrentGrade ,Course_has_Student , Status ,Course " + " where studentInformation.School_schoolId = School.schoolId and " + "studentInformation.CurrentGrade_currentGradeId = CurrentGrade.currentGradeId and " + " Course_has_Student.Status_statusID = Status.statusID and " + "Course_has_Student.Course_courseId = Course.courseId and " + "Course_has_Student.studentInformation_studentId = studentInformation.studentId "; if (studentModel.getCurrentGPA() != 0) { query = query.concat( " and studentInformation.currentGPA >= '" + studentModel.getCurrentGPA() + "'"); } if (studentModel.getCurrentGrade() != 0) { query = query.concat( " and studentInformation.CurrentGrade_currentGradeId = '" + studentModel.getCurrentGrade() + "' "); } if (studentModel.getStudentID() != 0) { query = query.concat( " and studentInformation.School_schoolId = ' " + studentModel.getStudentID() + "'"); } if (studentModel.getInterviewNeeded() != 0) { query = query.concat( " and studentInformation.InterviewNeeded_InterviewID = '" + studentModel.getInterviewNeeded() + "' and" + "studentInformation.InterviewNeeded_InterviewID = InterviewNeeded.InterviewID "); } if (studentModel.statusModel.getStatusID() != 0) { query = query.concat( " and Course_has_Student.Status_statusID = " + studentModel.statusModel.getStatusID()); } if (studentModel.schoolModel.getSchoolID() != 0) { query = query.concat(" and School.schoolId = " + studentModel.schoolModel.getSchoolID()); } myRes = myStmt.executeQuery(query + ";"); while (myRes.next()) { StudentModel studentModelDetails = new StudentModel(); studentModelDetails.setStudentID( Integer.parseInt(myRes.getString("studentInformation.studentId"))); studentModelDetails.setFirstName(myRes.getString("studentInformation.studentFirstName")); studentModelDetails.setLastName(myRes.getString("studentInformation.studentLastName")); studentModelDetails.setCurrentGPA(myRes.getInt("studentInformation.currentGPA")); studentModelDetails.setCurrentGrade( myRes.getInt("studentInformation.CurrentGrade_currentGradeId")); studentModelDetails.schoolModel.setSchoolName(myRes.getString("School.schoolName")); studentModelDetails.statusModel.setStatusName(myRes.getString("Status.statusName")); studentModelDetails.gradeModel.setCurrentGrade( myRes.getString("CurrentGrade.currentGrade")); studentModelDetails.courseStudentModel.progarmModel.setProgramName( myRes.getString("Course.courseName")); ccStduentView.add(studentModelDetails); } } catch (Exception e) { e.printStackTrace(); } return ccStduentView; }