diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ad92f84 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 abdullah100998 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..d0b11f9 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 abdullah100998 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9975994 --- /dev/null +++ b/README.md @@ -0,0 +1,170 @@ + +# Project Title : DIU Student Support System. +## Project Name : DIU Assist. + +![diuassist1](https://user-images.githubusercontent.com/60839928/101146579-5e706680-3645-11eb-9464-1a8cb2e97551.png) +![diuassist2](https://user-images.githubusercontent.com/60839928/101146587-603a2a00-3645-11eb-900f-d6e6b72f37c5.png) + + + +#### Project Type : +Our project is a graphical user interface project. This is actually a project of Java FX and Java Swing. This project is basically a desktop application. Through this, the user will be able to create the software the way he wants, which means that this software will actually play an important role in saving time. In this project, a Daffodil student is going to work with everything he/she uses in his daily life, from the student portal to the BLC as well as from the account office and faculty site. + +#### Description : +Basically our software will handle the all basic work of a computer science student. where all the teachers and students info will be given, all social and important link also. There is also a login option for user, in this software it have its own browser which will make comfort for user. + + + +#### Requirement Specification : +• This software is made with a use case diagram. +• Daffodil CSE student is going to work with everything he/she uses in his daily life. +• Login-logout by mail for students. +• It can use only by downloading and installing the software. +• This app must have a graphical user interface that's will make it more user-friendly. +• This is our software apps or the way you go here, you can go to the link from there. +• The main thing is of this software is to helps students have, sometimes they have to go to many places many times. Here all their links of the varsity will be combined in this app and the user will be made dependent. +• This app has Database for storing Students/Teachers Information. +• It has a MySQL Database operation for saving/remove information. +• Mainly focused on memory management for any low configure computer it can support. + +#### Literature Review : +In our project Literature Review includes whether any such application was created before us. Even before us, an app was created which is known as DI U Smart App in the Play Store. We are working in a very special way with time, so that in a very short time the user can move from one place to another as he needs. His time complexity should be reduced. He should be able to access everything on the bus without installing anything in a very short time. + + +## Features : +### 1. Log in + +![diuassist1](https://user-images.githubusercontent.com/60839928/101146579-5e706680-3645-11eb-9464-1a8cb2e97551.png) + + +### 2. Home Page (Quick Assist) + +![diuassist2](https://user-images.githubusercontent.com/60839928/101146587-603a2a00-3645-11eb-900f-d6e6b72f37c5.png) + +### 3. Home Page (Add Students) + +![diuassist3](https://user-images.githubusercontent.com/60839928/101143145-b9538f00-3640-11eb-80d8-8eab81379a46.png) +![diuassist4](https://user-images.githubusercontent.com/60839928/101143150-ba84bc00-3640-11eb-927e-3db5981551ce.png) +![diuassist5](https://user-images.githubusercontent.com/60839928/101143152-bb1d5280-3640-11eb-843b-5d41d56ac732.png) + +### 4. Home Page (Add Teachers) + +![diuassist6](https://user-images.githubusercontent.com/60839928/101143317-eb64f100-3640-11eb-9ed2-32a6d9a897a8.png) +![diuassist7](https://user-images.githubusercontent.com/60839928/101143322-ec961e00-3640-11eb-9705-c05f454d5ac0.png) + + +### 5. Home Page (View Students) + Select..,Search, Delete & Update + + +![diuassist8](https://user-images.githubusercontent.com/60839928/101143411-0c2d4680-3641-11eb-8dd2-6b14e0a350f4.png) +![diuassist9](https://user-images.githubusercontent.com/60839928/101143414-0d5e7380-3641-11eb-8cb2-1cdfe8bb9a68.png) +![diuassist10](https://user-images.githubusercontent.com/60839928/101143418-0df70a00-3641-11eb-9672-4d46d77a6fab.png) +![diuassist11](https://user-images.githubusercontent.com/60839928/101143419-0e8fa080-3641-11eb-8567-7246934a0403.png) +![diuassist12](https://user-images.githubusercontent.com/60839928/101143422-0f283700-3641-11eb-9a30-3c3ab89f8c43.png) + +### 6. Home Page (View Teachers) + Select..,Search, Delete & Update + + +![diuassist26](https://user-images.githubusercontent.com/60839928/101242922-f4c88900-3726-11eb-8774-75c318e08b62.png) +![diuassist13](https://user-images.githubusercontent.com/60839928/101143718-7e059000-3641-11eb-801f-914749fe088c.png) +![diuassist14](https://user-images.githubusercontent.com/60839928/101143724-7f36bd00-3641-11eb-974f-b203fc4db37b.png) +![diuassist15](https://user-images.githubusercontent.com/60839928/101143727-7fcf5380-3641-11eb-96b5-5401d05578a9.png) +![diuassist16](https://user-images.githubusercontent.com/60839928/101143728-8067ea00-3641-11eb-9981-13baef46037d.png) +![diuassist17](https://user-images.githubusercontent.com/60839928/101143729-81008080-3641-11eb-9d2a-3e053248f798.png) +![diuassist18](https://user-images.githubusercontent.com/60839928/101143732-81008080-3641-11eb-81b6-7a37fd349f9f.png) + + +### 6. About us + +![diuassist19](https://user-images.githubusercontent.com/60839928/101143770-91186000-3641-11eb-9cdd-48d2f819e0a1.png) + +### 7. Logout + +![diuassist20](https://user-images.githubusercontent.com/60839928/101143830-aa211100-3641-11eb-9b25-99b927f1b964.png) + + + +#### Testing: +For Testing Purpose open exe file and use +Login key : userid@diu.edu.bd + + +#### Software used for Implementing this Software : +IDE: Netbeans IDE for Java EE Developers + +JDK version: 1.8 + +Download Link : https://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-3413139-esa.html + +![diuassist22](https://user-images.githubusercontent.com/60839928/101145236-b4440f00-3643-11eb-96f9-2aeeb7e45b43.png) + +Libraries: + +MySQL JDBC Driver. + +Jfoinex 8.0.jar + +Fontawsomfx 8.2.jar + +Java DB Driver. + +Database Manager: XAMPP Version: 7.4.12 + +DBMS: MySQL. + +Download Link: https://www.apachefriends.org/download.html + + +![diuassist21](https://user-images.githubusercontent.com/60839928/101145321-d2aa0a80-3643-11eb-99e9-95567f1f04e0.png) + + +#### Database Connection: +After installing XAMPP, you need to log in to XAMPP and start its Apache and MySQL databases. Then by clicking on My SQL Admin we will get our desired database. + + + +student: Using this database you can add , seach , update a student's information and delete those information. + +teacher: Using this database you can add , seach , update a teacher’s information and delete those information. + + + +![diuassist23](https://user-images.githubusercontent.com/60839928/101145369-e3f31700-3643-11eb-924a-1c1e529c9472.png) +![diuassist24](https://user-images.githubusercontent.com/60839928/101145374-e5bcda80-3643-11eb-92a9-4de26a475a20.png) +![diuassist25](https://user-images.githubusercontent.com/60839928/101145378-e6557100-3643-11eb-85d7-160c9852d109.png) + + +# Application Version with source : + DIU Assist v1.5 : https://drive.google.com/file/d/1hwzRAH34SAZ4QkBnup4ljRDEm-KMkd8D/view?usp=sharing + Github Repository : https://github.com/abdullah100998/DIU-Assist-v1.5 + DBMS Sql file : https://drive.google.com/file/d/13NDpdHmj0RTo8F-Vr4D1dv-A7D8suRSb/view?usp=sharing + + +#### Future Update: +• Dynamic Search from Database +• Relational DBMS +• Routine and Event's management +• Move into Web and Android Application + + +#### Challenges Faced : +• Faced error connecting into Database. +• Faced not getting any data from user input. +• Faced problem in insert, delete, view from database. +• Faced Some Little bugs. + + +#### Outcome +The outcome of this project will be a GUI application all people can use to get & set information . This will also be able to use for browse necessry sites. + +#### Conclusion: +This was a great experience doing this project. This project was intended to make the DIU system easier and reliable. I hope the intention of the program gets full filled.. The challenges we faced and the learning we have gone through will come in great help in the future. + + ------------------------------Thank you for using our application------------------------------ + + +DIU Assist v1.5 © Fantastic Four ©2020 Fantastic Four. All rights reserved + + diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..90c388c --- /dev/null +++ b/build.xml @@ -0,0 +1,53 @@ + + Builds, tests, and runs the project DIU Assist 1.0. + + + diff --git a/manifest.mf b/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/src/diu/assist/pkg1/pkg0/AddStudentLayoutController.java b/src/diu/assist/pkg1/pkg0/AddStudentLayoutController.java index 2886b4f..d6ebe85 100644 --- a/src/diu/assist/pkg1/pkg0/AddStudentLayoutController.java +++ b/src/diu/assist/pkg1/pkg0/AddStudentLayoutController.java @@ -1,202 +1,202 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -//imports -import java.net.URL; -import java.sql.SQLException; -import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.fxml.Initializable; -import javafx.scene.control.Label; -import javafx.scene.control.TextArea; -import javafx.scene.control.TextField; -import javafx.scene.input.KeyEvent; -import javafx.scene.input.MouseEvent; - -/** - * FXML Controller class - * - * @author Dell - */ -public class AddStudentLayoutController implements Initializable { - - - public AddStudentLayoutController() { - } - - - public static ObservableList stdList = FXCollections.observableArrayList(); - @FXML - private TextField slnoField; - @FXML - private TextField idField; - @FXML - private TextField nameField; - @FXML - private TextField mobileField; - @FXML - private TextField emailField; - @FXML - private TextField sectionField; - @FXML - private TextArea departmentField; - @FXML - private Label notification; - @FXML - private TextField batchField; - - /** - * Initializes the controller class. - * @param url - * @param rb - */ - @Override - public void initialize(URL url, ResourceBundle rb) { - // TODO - SDatabaseAction sdbAction = new SDatabaseAction(); - try { - stdList = sdbAction.getAllStudents(); - } catch (SQLException ex) { - Logger.getLogger(AddStudentLayoutController.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //serial no field action - @FXML - private void slFieldAction(KeyEvent event) { - notification.setText(""); - String slno = slnoField.getText(); - if (slno.equals("")) { - return; - } - for (Student std : stdList) { - if (std.getSlno() == Integer.parseInt(slno)) { - notification.setText("This SL no is already exist!! Please Try Another"); - break; - } - } - - } - - //reset button action - @FXML - private void reset(ActionEvent event) { - slnoField.clear(); - idField.clear(); - batchField.clear(); - nameField.clear(); - mobileField.clear(); - emailField.clear(); - sectionField.clear(); - departmentField.clear(); - notification.setText(""); - } - - //save button action - @FXML - private void save(ActionEvent event) throws SQLException{ - - if(slnoField.getText().equals("")){ - return; - } - - int slno = Integer.parseInt(slnoField.getText()); - String id = idField.getText(); - String batch = batchField.getText(); - String name = nameField.getText(); - String mobile = mobileField.getText(); - String email = emailField.getText(); - String section = sectionField.getText(); - String department = departmentField.getText(); - - if (name.equals("") || batch.equals("") || id.equals("")) { - notification.setText("Please Enter NAME , Id & BATCH"); - return; - } - - for (Student std : stdList) { - if (std.getId().equals(id)) { - notification.setText("This ID no is already exist!! Please Try Another"); - return; - } - } - - Student std = new Student(slno, id, batch, name, mobile, email, section, department); - stdList.add(std); - - try { - SDatabaseAction dbAction = new SDatabaseAction(); - String r = dbAction.insertStudent(std); - idField.clear(); - slnoField.clear(); - batchField.clear(); - nameField.clear(); - mobileField.clear(); - emailField.clear(); - sectionField.clear(); - departmentField.clear(); - notification.setText(r); - } catch (SQLException e) { - notification.setText("Cannot insert To DBMS"); - //e.printStackTrace(); - } - } - - //save button action - @FXML - private void saveBtn(MouseEvent event) throws SQLException{ - if(slnoField.getText().equals("")){ - return; - } - - int slno = Integer.parseInt(slnoField.getText()); - String id = idField.getText(); - String batch = batchField.getText(); - String name = nameField.getText(); - String mobile = mobileField.getText(); - String email = emailField.getText(); - String section = sectionField.getText(); - String department = departmentField.getText(); - - if (name.equals("") && batch.equals("")&& id.equals("")) { - notification.setText("Please Enter NAME , Id & BATCH"); - return; - } - - for (Student std : stdList) { - if (std.getId().equals(id)) { - notification.setText("This ID no is already exist!! Please Try Another"); - return; - } - } - - Student std = new Student(slno, id, batch, name, mobile, email, section, department); - stdList.add(std); - - try { - SDatabaseAction dbAction = new SDatabaseAction(); - String r = dbAction.insertStudent(std); - idField.clear(); - slnoField.clear(); - batchField.clear(); - nameField.clear(); - mobileField.clear(); - emailField.clear(); - sectionField.clear(); - departmentField.clear(); - notification.setText(r); - } catch (SQLException e) { - notification.setText("Cannot insert To Database"); - //e.printStackTrace(); - } - } -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +//imports +import java.net.URL; +import java.sql.SQLException; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.Label; +import javafx.scene.control.TextArea; +import javafx.scene.control.TextField; +import javafx.scene.input.KeyEvent; +import javafx.scene.input.MouseEvent; + +/** + * FXML Controller class + * + * @author Dell + */ +public class AddStudentLayoutController implements Initializable { + + + public AddStudentLayoutController() { + } + + + public static ObservableList stdList = FXCollections.observableArrayList(); + @FXML + private TextField slnoField; + @FXML + private TextField idField; + @FXML + private TextField nameField; + @FXML + private TextField mobileField; + @FXML + private TextField emailField; + @FXML + private TextField sectionField; + @FXML + private TextArea departmentField; + @FXML + private Label notification; + @FXML + private TextField batchField; + + /** + * Initializes the controller class. + * @param url + * @param rb + */ + @Override + public void initialize(URL url, ResourceBundle rb) { + // TODO + SDatabaseAction sdbAction = new SDatabaseAction(); + try { + stdList = sdbAction.getAllStudents(); + } catch (SQLException ex) { + Logger.getLogger(AddStudentLayoutController.class.getName()).log(Level.SEVERE, null, ex); + } + } + + //serial no field action + @FXML + private void slFieldAction(KeyEvent event) { + notification.setText(""); + String slno = slnoField.getText(); + if (slno.equals("")) { + return; + } + for (Student std : stdList) { + if (std.getSlno() == Integer.parseInt(slno)) { + notification.setText("This SL no is already exist!! Please Try Another"); + break; + } + } + + } + + //reset button action + @FXML + private void reset(ActionEvent event) { + slnoField.clear(); + idField.clear(); + batchField.clear(); + nameField.clear(); + mobileField.clear(); + emailField.clear(); + sectionField.clear(); + departmentField.clear(); + notification.setText(""); + } + + //save button action + @FXML + private void save(ActionEvent event) throws SQLException{ + + if(slnoField.getText().equals("")){ + return; + } + + int slno = Integer.parseInt(slnoField.getText()); + String id = idField.getText(); + String batch = batchField.getText(); + String name = nameField.getText(); + String mobile = mobileField.getText(); + String email = emailField.getText(); + String section = sectionField.getText(); + String department = departmentField.getText(); + + if (name.equals("") || batch.equals("") || id.equals("")) { + notification.setText("Please Enter NAME , Id & BATCH"); + return; + } + + for (Student std : stdList) { + if (std.getId().equals(id)) { + notification.setText("This ID no is already exist!! Please Try Another"); + return; + } + } + + Student std = new Student(slno, id, batch, name, mobile, email, section, department); + stdList.add(std); + + try { + SDatabaseAction dbAction = new SDatabaseAction(); + String r = dbAction.insertStudent(std); + idField.clear(); + slnoField.clear(); + batchField.clear(); + nameField.clear(); + mobileField.clear(); + emailField.clear(); + sectionField.clear(); + departmentField.clear(); + notification.setText(r); + } catch (SQLException e) { + notification.setText("Cannot insert To DBMS"); + //e.printStackTrace(); + } + } + + //save button action + @FXML + private void saveBtn(MouseEvent event) throws SQLException{ + if(slnoField.getText().equals("")){ + return; + } + + int slno = Integer.parseInt(slnoField.getText()); + String id = idField.getText(); + String batch = batchField.getText(); + String name = nameField.getText(); + String mobile = mobileField.getText(); + String email = emailField.getText(); + String section = sectionField.getText(); + String department = departmentField.getText(); + + if (name.equals("") && batch.equals("")&& id.equals("")) { + notification.setText("Please Enter NAME , Id & BATCH"); + return; + } + + for (Student std : stdList) { + if (std.getId().equals(id)) { + notification.setText("This ID no is already exist!! Please Try Another"); + return; + } + } + + Student std = new Student(slno, id, batch, name, mobile, email, section, department); + stdList.add(std); + + try { + SDatabaseAction dbAction = new SDatabaseAction(); + String r = dbAction.insertStudent(std); + idField.clear(); + slnoField.clear(); + batchField.clear(); + nameField.clear(); + mobileField.clear(); + emailField.clear(); + sectionField.clear(); + departmentField.clear(); + notification.setText(r); + } catch (SQLException e) { + notification.setText("Cannot insert To Database"); + //e.printStackTrace(); + } + } +} diff --git a/src/diu/assist/pkg1/pkg0/AddTeacherLayoutController.java b/src/diu/assist/pkg1/pkg0/AddTeacherLayoutController.java index 5851b73..c511950 100644 --- a/src/diu/assist/pkg1/pkg0/AddTeacherLayoutController.java +++ b/src/diu/assist/pkg1/pkg0/AddTeacherLayoutController.java @@ -1,165 +1,165 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -//imports -import java.net.URL; -import java.sql.SQLException; -import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.fxml.Initializable; -import javafx.scene.control.Label; -import javafx.scene.control.TextArea; -import javafx.scene.control.TextField; -import javafx.scene.input.KeyEvent; - -/** - * FXML Controller class - * - * @author Dell - */ -public class AddTeacherLayoutController implements Initializable { - - public static ObservableList teachList = FXCollections.observableArrayList(); - @FXML - private Label notification; - @FXML - private TextField tslnoField; - @FXML - private TextField tidField; - @FXML - private TextField tnameField; - @FXML - private TextField tmobileField; - @FXML - private TextField temailField; - @FXML - private TextField tcoursecodeField; - @FXML - private TextArea tdepartmentField; - @FXML - private TextField tteacherinitialField; - @FXML - private TextField tcoursenameField; - @FXML - private TextField tfacultyField; - - /** - * Initializes the controller class. - * - * @param url - * @param rb - */ - @Override - public void initialize(URL url, ResourceBundle rb) { - // TODO - TDatabaseAction tdbAction = new TDatabaseAction(); - try { - teachList = tdbAction.getAllTeachers(); - } catch (SQLException ex) { - Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //serial no field action - @FXML - private void slFieldAction(KeyEvent event) { - notification.setText(""); - String tslno = tslnoField.getText(); - if (tslno.equals("")) { - return; - } - - for (Teacher teach : teachList) { - if(teach.getTslno() == Integer.parseInt(tslno)) { - notification.setText("This SL no is already exist!! Please Try Another"); - break; - } else { - } - } - - } - - //save button action - @FXML - private void save(ActionEvent event) throws SQLException { - if (tslnoField.getText().equals("")) { - return; - } - - int tslno = Integer.parseInt(tslnoField.getText()); - String tid = tidField.getText(); - String tteacherinitial = tteacherinitialField.getText(); - String tname = tnameField.getText(); - String tmobile = tmobileField.getText(); - String temail = temailField.getText(); - String tcoursecode = tcoursecodeField.getText(); - String tcoursename = tcoursenameField.getText(); - String tdepartment = tdepartmentField.getText(); - String tfaculty = tfacultyField.getText(); - - if (tname.equals("") || tteacherinitial.equals("") || tid.equals("") || tcoursecode.equals("")) { - notification.setText("Please Enter Name , Id , TI , Course Code"); - return; - } - - for (Teacher teach : teachList) { - if (teach.getTid().equals(tid)) { - notification.setText("This ID no is already exist!! Please Try Another"); - return; - } - } - - Teacher teach = new Teacher(tslno, tid, tteacherinitial, tname, tmobile, temail, tcoursecode, tcoursename, tdepartment, tfaculty); - teachList.add(teach); - - try { - TDatabaseAction dbAction = new TDatabaseAction(); - String r = dbAction.insertTeacher(teach); - - tslnoField.clear(); - tidField.clear(); - tnameField.clear(); - temailField.clear(); - tcoursecodeField.clear(); - tcoursenameField.clear(); - tdepartmentField.clear(); - tmobileField.clear(); - tidField.clear(); - tteacherinitialField.clear(); - tfacultyField.clear(); - - notification.setText(r); - - } catch (SQLException e) { - notification.setText("Cannot insert To DBMS"); - //e.printStackTrace(); - } - } - - //reset button action - @FXML - private void reset(ActionEvent event) { - tslnoField.clear(); - tidField.clear(); - tnameField.clear(); - temailField.clear(); - tcoursecodeField.clear(); - tcoursenameField.clear(); - tdepartmentField.clear(); - tmobileField.clear(); - tidField.clear(); - tteacherinitialField.clear(); - tfacultyField.clear(); - notification.setText(""); - } - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +//imports +import java.net.URL; +import java.sql.SQLException; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.Label; +import javafx.scene.control.TextArea; +import javafx.scene.control.TextField; +import javafx.scene.input.KeyEvent; + +/** + * FXML Controller class + * + * @author Dell + */ +public class AddTeacherLayoutController implements Initializable { + + public static ObservableList teachList = FXCollections.observableArrayList(); + @FXML + private Label notification; + @FXML + private TextField tslnoField; + @FXML + private TextField tidField; + @FXML + private TextField tnameField; + @FXML + private TextField tmobileField; + @FXML + private TextField temailField; + @FXML + private TextField tcoursecodeField; + @FXML + private TextArea tdepartmentField; + @FXML + private TextField tteacherinitialField; + @FXML + private TextField tcoursenameField; + @FXML + private TextField tfacultyField; + + /** + * Initializes the controller class. + * + * @param url + * @param rb + */ + @Override + public void initialize(URL url, ResourceBundle rb) { + // TODO + TDatabaseAction tdbAction = new TDatabaseAction(); + try { + teachList = tdbAction.getAllTeachers(); + } catch (SQLException ex) { + Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); + } + } + + //serial no field action + @FXML + private void slFieldAction(KeyEvent event) { + notification.setText(""); + String tslno = tslnoField.getText(); + if (tslno.equals("")) { + return; + } + + for (Teacher teach : teachList) { + if(teach.getTslno() == Integer.parseInt(tslno)) { + notification.setText("This SL no is already exist!! Please Try Another"); + break; + } else { + } + } + + } + + //save button action + @FXML + private void save(ActionEvent event) throws SQLException { + if (tslnoField.getText().equals("")) { + return; + } + + int tslno = Integer.parseInt(tslnoField.getText()); + String tid = tidField.getText(); + String tteacherinitial = tteacherinitialField.getText(); + String tname = tnameField.getText(); + String tmobile = tmobileField.getText(); + String temail = temailField.getText(); + String tcoursecode = tcoursecodeField.getText(); + String tcoursename = tcoursenameField.getText(); + String tdepartment = tdepartmentField.getText(); + String tfaculty = tfacultyField.getText(); + + if (tname.equals("") || tteacherinitial.equals("") || tid.equals("") || tcoursecode.equals("")) { + notification.setText("Please Enter Name , Id , TI , Course Code"); + return; + } + + for (Teacher teach : teachList) { + if (teach.getTid().equals(tid)) { + notification.setText("This ID no is already exist!! Please Try Another"); + return; + } + } + + Teacher teach = new Teacher(tslno, tid, tteacherinitial, tname, tmobile, temail, tcoursecode, tcoursename, tdepartment, tfaculty); + teachList.add(teach); + + try { + TDatabaseAction dbAction = new TDatabaseAction(); + String r = dbAction.insertTeacher(teach); + + tslnoField.clear(); + tidField.clear(); + tnameField.clear(); + temailField.clear(); + tcoursecodeField.clear(); + tcoursenameField.clear(); + tdepartmentField.clear(); + tmobileField.clear(); + tidField.clear(); + tteacherinitialField.clear(); + tfacultyField.clear(); + + notification.setText(r); + + } catch (SQLException e) { + notification.setText("Cannot insert To DBMS"); + //e.printStackTrace(); + } + } + + //reset button action + @FXML + private void reset(ActionEvent event) { + tslnoField.clear(); + tidField.clear(); + tnameField.clear(); + temailField.clear(); + tcoursecodeField.clear(); + tcoursenameField.clear(); + tdepartmentField.clear(); + tmobileField.clear(); + tidField.clear(); + tteacherinitialField.clear(); + tfacultyField.clear(); + notification.setText(""); + } + +} diff --git a/src/diu/assist/pkg1/pkg0/DIUAssist10.java b/src/diu/assist/pkg1/pkg0/DIUAssist10.java index 5354d61..b507537 100644 --- a/src/diu/assist/pkg1/pkg0/DIUAssist10.java +++ b/src/diu/assist/pkg1/pkg0/DIUAssist10.java @@ -1,81 +1,81 @@ -/**.................................Bismillahir-Rahamanirahim..................................**/ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.scene.image.Image; -import javafx.stage.Stage; -import javafx.stage.WindowEvent; - -/** - * - * @author Dell - * - */ - -/** -*(c) 2020 Team : Fantastic 4 -*[1]Md.Mahfuzur Rahman || Id:193-15-13416 || -*[2]Md.Abdullah Ibna Harun || Id:193-15-13426 || -*[3]Md.Mahade Hassan Forhad || Id:193-15-13355 || -*[4]Md.Abidur Rahman Khan || Id:193-15-13374 || -**/ - -public class DIUAssist10 extends Application { - - public static Stage stage; - - @Override - public void start(Stage stage) throws Exception { - - DIUAssist10.stage = stage; - - Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); - Scene scene = new Scene(root); - stage.setTitle("DIU Assist v1.5"); - Image img = new Image("/icons/mainicon.png"); - stage.getIcons().add(img); - stage.setScene(scene); - stage.resizableProperty().set(false); - stage.show(); - - try{ - FXMLDocumentController.stage1.setOnCloseRequest((WindowEvent e) -> { - FXMLDocumentController.stage1.close(); - if (MainStage1Controller.clock.isAlive()) { - MainStage1Controller.clock.stop(); - } - WebviewprojectController.webengine.load(""); - System.exit(0); - }); - }catch(EnumConstantNotPresentException e){ - - } - - try { - stage.setOnCloseRequest((WindowEvent e) -> { - stage.close(); - System.exit(0); - }); - } catch (Exception e) { - } - - } - - /** - * @param args the command line arguments - */ - //main method - public static void main(String[] args) { - launch(args); - } - -} +/**.................................Bismillahir-Rahamanirahim..................................**/ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.image.Image; +import javafx.stage.Stage; +import javafx.stage.WindowEvent; + +/** + * + * @author Dell + * + */ + +/** +*(c) 2020 Team : Fantastic 4 +*[1]Md.Mahfuzur Rahman || Id:193-15-13416 || +*[2]Md.Abdullah Ibna Harun || Id:193-15-13426 || +*[3]Md.Mahade Hassan Forhad || Id:193-15-13355 || +*[4]Md.Abidur Rahman Khan || Id:193-15-13374 || +**/ + +public class DIUAssist10 extends Application { + + public static Stage stage; + + @Override + public void start(Stage stage) throws Exception { + + DIUAssist10.stage = stage; + + Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); + Scene scene = new Scene(root); + stage.setTitle("DIU Assist v1.5"); + Image img = new Image("/icons/mainicon.png"); + stage.getIcons().add(img); + stage.setScene(scene); + stage.resizableProperty().set(false); + stage.show(); + + try{ + FXMLDocumentController.stage1.setOnCloseRequest((WindowEvent e) -> { + FXMLDocumentController.stage1.close(); + if (MainStage1Controller.clock.isAlive()) { + MainStage1Controller.clock.stop(); + } + WebviewprojectController.webengine.load(""); + System.exit(0); + }); + }catch(EnumConstantNotPresentException e){ + + } + + try { + stage.setOnCloseRequest((WindowEvent e) -> { + stage.close(); + System.exit(0); + }); + } catch (Exception e) { + } + + } + + /** + * @param args the command line arguments + */ + //main method + public static void main(String[] args) { + launch(args); + } + +} diff --git a/src/diu/assist/pkg1/pkg0/FXMLDocumentController.java b/src/diu/assist/pkg1/pkg0/FXMLDocumentController.java index 69b97f8..1e92fcd 100644 --- a/src/diu/assist/pkg1/pkg0/FXMLDocumentController.java +++ b/src/diu/assist/pkg1/pkg0/FXMLDocumentController.java @@ -1,97 +1,97 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/************************imports**********************/ -package diu.assist.pkg1.pkg0; -import static diu.assist.pkg1.pkg0.DIUAssist10.stage; -import java.io.IOException; -import java.net.URL; -import java.util.ResourceBundle; -import java.util.regex.Pattern; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; -import javafx.fxml.Initializable; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.scene.control.Label; -import javafx.scene.control.TextField; -import javafx.scene.image.Image; -import javafx.stage.Stage; - -/** - * - * @author Dell - */ -public class FXMLDocumentController implements Initializable { - - public static Stage stage1 = new Stage(); - - static String mail; - - @FXML - private TextField emailField; - - @FXML - private Label notificationLable; - - @Override - public void initialize(URL url, ResourceBundle rb) { - notificationLable.setText(""); - emailField.clear(); - } - - - //submit button action - @FXML - private void submitBtn(ActionEvent event) throws IOException { - notificationLable.setText(""); - String substr1 = "@diu.edu.bd"; - //String substr2 = "bd"; - String substr3 = "@daffodilvarsity.edu.bd"; - mail = emailField.getText(); - - String toLowerCase = mail.toLowerCase(); - if ("".equals(mail)) { - return; - } - if (isEmailValid(mail) && (toLowerCase.contains(substr1) || toLowerCase.contains(substr3))) { - emailField.setText("---Login Sucessfull!---"); - emailField.clear(); - stage.close(); - try { - Parent pane = FXMLLoader.load(getClass().getResource("MainStage1.fxml")); - Scene scene = new Scene(pane); - Image ico = new Image("/icons/mainicon.png"); - stage1.setScene(scene); - stage1.setTitle("DIU Assist v1.5"); - stage1.getIcons().add(ico); - stage1.resizableProperty().set(false); - stage1.show(); - } catch (IOException e) { - System.out.println("Problem on FxmlController"); - } - } else { - notificationLable.setText("Invalid Mail, Try Again.."); - } - } - - //email pattern check - public static boolean isEmailValid(String email) - { - String emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\."+ - "[a-zA-Z0-9_+&*-]+)*@" + - "(?:[a-zA-Z0-9-]+\\.)+[a-z" + - "A-Z]{2,7}$"; - - Pattern pat = Pattern.compile(emailRegex); - if (email == null) - return false; - return pat.matcher(email).matches(); - } - -//abdullah1513426@diu.edu.bd -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/************************imports**********************/ +package diu.assist.pkg1.pkg0; +import static diu.assist.pkg1.pkg0.DIUAssist10.stage; +import java.io.IOException; +import java.net.URL; +import java.util.ResourceBundle; +import java.util.regex.Pattern; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.fxml.Initializable; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.image.Image; +import javafx.stage.Stage; + +/** + * + * @author Dell + */ +public class FXMLDocumentController implements Initializable { + + public static Stage stage1 = new Stage(); + + static String mail; + + @FXML + private TextField emailField; + + @FXML + private Label notificationLable; + + @Override + public void initialize(URL url, ResourceBundle rb) { + notificationLable.setText(""); + emailField.clear(); + } + + + //submit button action + @FXML + private void submitBtn(ActionEvent event) throws IOException { + notificationLable.setText(""); + String substr1 = "@diu.edu.bd"; + //String substr2 = "bd"; + String substr3 = "@daffodilvarsity.edu.bd"; + mail = emailField.getText(); + + String toLowerCase = mail.toLowerCase(); + if ("".equals(mail)) { + return; + } + if (isEmailValid(mail) && (toLowerCase.contains(substr1) || toLowerCase.contains(substr3))) { + emailField.setText("---Login Sucessfull!---"); + emailField.clear(); + stage.close(); + try { + Parent pane = FXMLLoader.load(getClass().getResource("MainStage1.fxml")); + Scene scene = new Scene(pane); + Image ico = new Image("/icons/mainicon.png"); + stage1.setScene(scene); + stage1.setTitle("DIU Assist v1.5"); + stage1.getIcons().add(ico); + stage1.resizableProperty().set(false); + stage1.show(); + } catch (IOException e) { + System.out.println("Problem on FxmlController"); + } + } else { + notificationLable.setText("Invalid Mail, Try Again.."); + } + } + + //email pattern check + public static boolean isEmailValid(String email) + { + String emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\."+ + "[a-zA-Z0-9_+&*-]+)*@" + + "(?:[a-zA-Z0-9-]+\\.)+[a-z" + + "A-Z]{2,7}$"; + + Pattern pat = Pattern.compile(emailRegex); + if (email == null) + return false; + return pat.matcher(email).matches(); + } + +//abdullah1513426@diu.edu.bd +} diff --git a/src/diu/assist/pkg1/pkg0/MainStage1Controller.java b/src/diu/assist/pkg1/pkg0/MainStage1Controller.java index 426fcde..99254b3 100644 --- a/src/diu/assist/pkg1/pkg0/MainStage1Controller.java +++ b/src/diu/assist/pkg1/pkg0/MainStage1Controller.java @@ -1,193 +1,193 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -//imports - -import static diu.assist.pkg1.pkg0.FXMLDocumentController.stage1; -import java.io.IOException; -import java.net.URL; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; -import javafx.fxml.Initializable; -import javafx.scene.Parent; -import javafx.scene.layout.BorderPane; -import javafx.scene.text.Text; -import javafx.stage.WindowEvent; - -/** - * FXML Controller class - * - * @author Dell - */ -public class MainStage1Controller extends Thread implements Initializable { - - public MainStage1Controller() { - } - - public static Thread clock; - @FXML - private Text userMail; - @FXML - private BorderPane mainContant; - @FXML - private Text dateField; - @FXML - private Text timeField; - - /** - * Initializes the controller class. - * - * @param url - * @param rb - */ - @Override - public void initialize(URL url, ResourceBundle rb) { - // TODO - userMail.setText(FXMLDocumentController.mail); - try { - timedate(true); - Parent child = FXMLLoader.load(getClass().getResource("Webviewproject.fxml")); - mainContant.setCenter(child); - } catch (IOException ex) { - Logger.getLogger(MainStage1Controller.class.getName()).log(Level.SEVERE, null, ex); - } - - try { - stage1.setOnCloseRequest((WindowEvent e) -> { - stage1.close(); - WebviewprojectController.webengine.load(""); - - if (!clock.isAlive()) { - System.exit(0); - return; - } else { - clock.stop(); - System.exit(0); - } - System.exit(0); - }); - } catch (Exception e) { - } - - } - - //aboutus button action - @FXML - private void aboutUs(ActionEvent event) { - try { - Parent child = FXMLLoader.load(getClass().getResource("Webviewproject.fxml")); - String url = "https://sites.google.com/diu.edu.bd/fantasticfour/about-fantastic-four?authuser=0"; - WebviewprojectController.webengine.load(url); - mainContant.setCenter(child); - } catch (IOException ex) { - Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //quick assist button action - @FXML - private void quickAssist(ActionEvent event) throws IOException { - try { - Parent child = FXMLLoader.load(getClass().getResource("Webviewproject.fxml")); - mainContant.setCenter(child); - } catch (IOException ex) { - Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //add student action - @FXML - private void addStdData(ActionEvent event) { - try { - Parent child = FXMLLoader.load(getClass().getResource("AddStudentLayout.fxml")); - mainContant.setCenter(child); - } catch (IOException ex) { - Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //add teacher action - @FXML - private void addTecData(ActionEvent event) { - try { - Parent child = FXMLLoader.load(getClass().getResource("AddTeacherLayout.fxml")); - mainContant.setCenter(child); - } catch (IOException ex) { - Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //show students action - @FXML - private void showSudents(ActionEvent event) { - try { - Parent child = FXMLLoader.load(getClass().getResource("ShowAllStudents.fxml")); - mainContant.setCenter(child); - } catch (IOException ex) { - Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //show teachers acton - @FXML - private void showTeachers(ActionEvent event) { - try { - Parent child = FXMLLoader.load(getClass().getResource("ShowAllTeachers.fxml")); - mainContant.setCenter(child); - } catch (IOException ex) { - Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //logout action - @FXML - private void logout(ActionEvent event) { - DIUAssist10.stage.show(); - FXMLDocumentController.stage1.close(); - - if (clock.isAlive()) { - clock.stop(); - } - if (ShowAllStudentsController.stage3 != null) { - ShowAllStudentsController.stage3.close(); - } - if (ShowAllTeachersController.stage4 != null) { - ShowAllTeachersController.stage4.close(); - } - - } - - //live time & date by using thread handeling - private void timedate(boolean valu) { - if (valu) { - clock = new Thread() { - @Override - public void run() { - while (!FXMLDocumentController.stage1.isShowing()) { - while (!FXMLDocumentController.stage1.hasProperties()) { - Date thisDate = new Date(); - SimpleDateFormat dateFrom = new SimpleDateFormat("dd/MM/y"); - dateField.setText(dateFrom.format(thisDate)); - Date thisTime = new Date(); - SimpleDateFormat timeFrom = new SimpleDateFormat("hh:mm a"); - timeField.setText(timeFrom.format(thisTime)); - //sleep(1000); - } - } - } - }; - clock.start(); - } - } - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +//imports + +import static diu.assist.pkg1.pkg0.FXMLDocumentController.stage1; +import java.io.IOException; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.fxml.Initializable; +import javafx.scene.Parent; +import javafx.scene.layout.BorderPane; +import javafx.scene.text.Text; +import javafx.stage.WindowEvent; + +/** + * FXML Controller class + * + * @author Dell + */ +public class MainStage1Controller extends Thread implements Initializable { + + public MainStage1Controller() { + } + + public static Thread clock; + @FXML + private Text userMail; + @FXML + private BorderPane mainContant; + @FXML + private Text dateField; + @FXML + private Text timeField; + + /** + * Initializes the controller class. + * + * @param url + * @param rb + */ + @Override + public void initialize(URL url, ResourceBundle rb) { + // TODO + userMail.setText(FXMLDocumentController.mail); + try { + timedate(true); + Parent child = FXMLLoader.load(getClass().getResource("Webviewproject.fxml")); + mainContant.setCenter(child); + } catch (IOException ex) { + Logger.getLogger(MainStage1Controller.class.getName()).log(Level.SEVERE, null, ex); + } + + try { + stage1.setOnCloseRequest((WindowEvent e) -> { + stage1.close(); + WebviewprojectController.webengine.load(""); + + if (!clock.isAlive()) { + System.exit(0); + return; + } else { + clock.stop(); + System.exit(0); + } + System.exit(0); + }); + } catch (Exception e) { + } + + } + + //aboutus button action + @FXML + private void aboutUs(ActionEvent event) { + try { + Parent child = FXMLLoader.load(getClass().getResource("Webviewproject.fxml")); + String url = "https://sites.google.com/diu.edu.bd/fantasticfour/about-fantastic-four?authuser=0"; + WebviewprojectController.webengine.load(url); + mainContant.setCenter(child); + } catch (IOException ex) { + Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); + } + } + + //quick assist button action + @FXML + private void quickAssist(ActionEvent event) throws IOException { + try { + Parent child = FXMLLoader.load(getClass().getResource("Webviewproject.fxml")); + mainContant.setCenter(child); + } catch (IOException ex) { + Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); + } + } + + //add student action + @FXML + private void addStdData(ActionEvent event) { + try { + Parent child = FXMLLoader.load(getClass().getResource("AddStudentLayout.fxml")); + mainContant.setCenter(child); + } catch (IOException ex) { + Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); + } + } + + //add teacher action + @FXML + private void addTecData(ActionEvent event) { + try { + Parent child = FXMLLoader.load(getClass().getResource("AddTeacherLayout.fxml")); + mainContant.setCenter(child); + } catch (IOException ex) { + Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); + } + } + + //show students action + @FXML + private void showSudents(ActionEvent event) { + try { + Parent child = FXMLLoader.load(getClass().getResource("ShowAllStudents.fxml")); + mainContant.setCenter(child); + } catch (IOException ex) { + Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); + } + } + + //show teachers acton + @FXML + private void showTeachers(ActionEvent event) { + try { + Parent child = FXMLLoader.load(getClass().getResource("ShowAllTeachers.fxml")); + mainContant.setCenter(child); + } catch (IOException ex) { + Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); + } + } + + //logout action + @FXML + private void logout(ActionEvent event) { + DIUAssist10.stage.show(); + FXMLDocumentController.stage1.close(); + + if (clock.isAlive()) { + clock.stop(); + } + if (ShowAllStudentsController.stage3 != null) { + ShowAllStudentsController.stage3.close(); + } + if (ShowAllTeachersController.stage4 != null) { + ShowAllTeachersController.stage4.close(); + } + + } + + //live time & date by using thread handeling + private void timedate(boolean valu) { + if (valu) { + clock = new Thread() { + @Override + public void run() { + while (!FXMLDocumentController.stage1.isShowing()) { + while (!FXMLDocumentController.stage1.hasProperties()) { + Date thisDate = new Date(); + SimpleDateFormat dateFrom = new SimpleDateFormat("dd/MM/y"); + dateField.setText(dateFrom.format(thisDate)); + Date thisTime = new Date(); + SimpleDateFormat timeFrom = new SimpleDateFormat("hh:mm a"); + timeField.setText(timeFrom.format(thisTime)); + //sleep(1000); + } + } + } + }; + clock.start(); + } + } + +} diff --git a/src/diu/assist/pkg1/pkg0/SDatabaseAction.java b/src/diu/assist/pkg1/pkg0/SDatabaseAction.java index f172a3b..ccf0f92 100644 --- a/src/diu/assist/pkg1/pkg0/SDatabaseAction.java +++ b/src/diu/assist/pkg1/pkg0/SDatabaseAction.java @@ -1,119 +1,119 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -import java.net.URL; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ResourceBundle; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.fxml.Initializable; - - - - -/** - * - * @author Dell - */ -public class SDatabaseAction implements Initializable{ - - //constructor - public SDatabaseAction() { - } - - @Override - public void initialize(URL location, ResourceBundle resources) { - //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates - - } - - //get database connection method - public Connection getConnection() throws SQLException{ - Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/diuassist_dbms","root",""); - Statement statement = conn.createStatement(); - statement.close(); - return conn; - - - } - - //get students from database - public ObservableList getAllStudents() throws SQLException { - - ObservableList stdList = FXCollections.observableArrayList(); - - Connection conn = getConnection(); - Statement statement = conn.createStatement(); - String query = "select * from student"; - - ResultSet rs = statement.executeQuery(query); - - while (rs.next()) { - - int slno = rs.getInt("sl"); - String id = rs.getString("id"); - String batch = rs.getString("batch"); - String name = rs.getString("name"); - String mobile = rs.getString("mobile"); - String email = rs.getString("email"); - String section = rs.getString("section"); - String department = rs.getString("department"); - - Student student = new Student(slno, id, batch, name, mobile, email, section, department); - stdList.add(student); - } - statement.close(); - return stdList; - - } - - //insert students data into database - public String insertStudent(Student student) throws SQLException { - Connection conn = getConnection(); - Statement statement = conn.createStatement(); - String query = "insert into student "+"values("+student.getSlno()+",'"+student.getId()+"','"+student.getBatch()+"','"+student.getName()+"','"+student.getMobile()+"','"+student.getEmail()+"','"+student.getSection()+"','"+student.getDepartment()+"')"; - - if (statement.executeUpdate(query)>0) { - statement.close(); - return "Student added Successfully"; - } else { - statement.close(); - return "Failed"; - } - } - - //delete dada from database - public void deletStudents(ObservableList selectedStudents) throws SQLException { - Connection conn = getConnection(); - try (Statement statement = conn.createStatement()) { - for (Student students : selectedStudents) { - String query = "delete from student where sl = " + students.getSlno(); - int executeUpdate = statement.executeUpdate(query); - } - } - } - - //update data in database - public void updateStudent(Student std) throws SQLException{ - Student student = std; - Connection conn = getConnection(); - Statement statement = conn.createStatement(); - try{ - String query = " UPDATE student SET id = '"+student.getId()+"', batch = '"+student.getBatch()+"', name = '"+student.getName()+"', mobile = '"+student.getMobile()+"',email = '"+student.getEmail()+"', section = '"+student.getSection()+"', department = '"+student.getDepartment()+"' WHERE sl= "+student.getSlno()+";"; - statement.executeUpdate(query); - statement.close(); - }catch(SQLException e){ - - } - } - - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ResourceBundle; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.fxml.Initializable; + + + + +/** + * + * @author Dell + */ +public class SDatabaseAction implements Initializable{ + + //constructor + public SDatabaseAction() { + } + + @Override + public void initialize(URL location, ResourceBundle resources) { + //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates + + } + + //get database connection method + public Connection getConnection() throws SQLException{ + Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/diuassist_dbms","root",""); + Statement statement = conn.createStatement(); + statement.close(); + return conn; + + + } + + //get students from database + public ObservableList getAllStudents() throws SQLException { + + ObservableList stdList = FXCollections.observableArrayList(); + + Connection conn = getConnection(); + Statement statement = conn.createStatement(); + String query = "select * from student"; + + ResultSet rs = statement.executeQuery(query); + + while (rs.next()) { + + int slno = rs.getInt("sl"); + String id = rs.getString("id"); + String batch = rs.getString("batch"); + String name = rs.getString("name"); + String mobile = rs.getString("mobile"); + String email = rs.getString("email"); + String section = rs.getString("section"); + String department = rs.getString("department"); + + Student student = new Student(slno, id, batch, name, mobile, email, section, department); + stdList.add(student); + } + statement.close(); + return stdList; + + } + + //insert students data into database + public String insertStudent(Student student) throws SQLException { + Connection conn = getConnection(); + Statement statement = conn.createStatement(); + String query = "insert into student "+"values("+student.getSlno()+",'"+student.getId()+"','"+student.getBatch()+"','"+student.getName()+"','"+student.getMobile()+"','"+student.getEmail()+"','"+student.getSection()+"','"+student.getDepartment()+"')"; + + if (statement.executeUpdate(query)>0) { + statement.close(); + return "Student added Successfully"; + } else { + statement.close(); + return "Failed"; + } + } + + //delete dada from database + public void deletStudents(ObservableList selectedStudents) throws SQLException { + Connection conn = getConnection(); + try (Statement statement = conn.createStatement()) { + for (Student students : selectedStudents) { + String query = "delete from student where sl = " + students.getSlno(); + int executeUpdate = statement.executeUpdate(query); + } + } + } + + //update data in database + public void updateStudent(Student std) throws SQLException{ + Student student = std; + Connection conn = getConnection(); + Statement statement = conn.createStatement(); + try{ + String query = " UPDATE student SET id = '"+student.getId()+"', batch = '"+student.getBatch()+"', name = '"+student.getName()+"', mobile = '"+student.getMobile()+"',email = '"+student.getEmail()+"', section = '"+student.getSection()+"', department = '"+student.getDepartment()+"' WHERE sl= "+student.getSlno()+";"; + statement.executeUpdate(query); + statement.close(); + }catch(SQLException e){ + + } + } + + +} diff --git a/src/diu/assist/pkg1/pkg0/ShowAllStudentsController.java b/src/diu/assist/pkg1/pkg0/ShowAllStudentsController.java index 073fda7..04a411a 100644 --- a/src/diu/assist/pkg1/pkg0/ShowAllStudentsController.java +++ b/src/diu/assist/pkg1/pkg0/ShowAllStudentsController.java @@ -1,165 +1,165 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -//imports -import java.io.IOException; -import java.net.URL; -import java.sql.SQLException; -import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; -import javafx.fxml.Initializable; -import javafx.geometry.Pos; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.scene.control.Label; -import javafx.scene.control.SelectionMode; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableView; -import javafx.scene.control.TextField; -import javafx.scene.control.cell.PropertyValueFactory; -import javafx.scene.image.Image; -import javafx.scene.text.Text; -import javafx.stage.Stage; - -/** - * FXML Controller class - * - * @author Dell - */ -public class ShowAllStudentsController implements Initializable { - public static Student student1; - public static Stage stage3; - - public ShowAllStudentsController() { - } - @FXML - private Label studentcount; - @FXML - private TextField ssearchField; - @FXML - private Text searchresultlable; - @FXML - private TableView studentTable; - @FXML - private TableColumn slnoColl; - @FXML - private TableColumn idColl; - @FXML - private TableColumn batchColl; - @FXML - private TableColumn nameColl; - @FXML - private TableColumn mobileColl; - @FXML - private TableColumn emailColl; - @FXML - private TableColumn sectionColl; - @FXML - private TableColumn departmentColl; - - /** - * Initializes the controller class. - * - * @param url - * @param rb - */ - @Override - public void initialize(URL url, ResourceBundle rb) { - // TODO - searchresultlable.setText(""); - studentTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); - AddStudentLayoutController.stdList.clear(); - - SDatabaseAction sdbAction = new SDatabaseAction(); - try { - AddStudentLayoutController.stdList = sdbAction.getAllStudents(); - } catch (SQLException ex) { - Logger.getLogger(ShowAllStudentsController.class.getName()).log(Level.SEVERE, null, ex); - } - - studentcount.setText(" Total Students : "+AddStudentLayoutController.stdList.size()); - studentcount.setAlignment(Pos.CENTER); - - slnoColl.setCellValueFactory(new PropertyValueFactory("slno")); - idColl.setCellValueFactory(new PropertyValueFactory("id")); - batchColl.setCellValueFactory(new PropertyValueFactory("batch")); - nameColl.setCellValueFactory(new PropertyValueFactory("name")); - mobileColl.setCellValueFactory(new PropertyValueFactory("mobile")); - emailColl.setCellValueFactory(new PropertyValueFactory("email")); - sectionColl.setCellValueFactory(new PropertyValueFactory("section")); - departmentColl.setCellValueFactory(new PropertyValueFactory("department")); - - studentTable.setItems(AddStudentLayoutController.stdList); - - } - - //delete button action - @FXML - private void deleteRecords(ActionEvent event) throws SQLException { - try { - ObservableList selectedStudents = FXCollections.observableArrayList(); - selectedStudents = studentTable.getSelectionModel().getSelectedItems(); - - SDatabaseAction sdbAction = new SDatabaseAction(); - sdbAction.deletStudents(selectedStudents); - if (AddStudentLayoutController.stdList.removeAll(selectedStudents)) { - searchresultlable.setText("Data Deleted Successfully"); - } - } catch (SQLException e) { - searchresultlable.setText("Sorry Cannot Delete Those Data"); - } - - } - - //search button action - @FXML - private void searchBtn(ActionEvent event) { - String id = ssearchField.getText(); - if (id.equals("")) { - searchresultlable.setText(""); - return; - } - ObservableList Students = AddStudentLayoutController.stdList; - for (Student std : Students) { - if (std.getId().contains(id)) { - searchresultlable.setText(std.toString()); - break; - } else { - searchresultlable.setText("Sorry Data Not Found"); - } - } - } - - //update button action - @FXML - private void updateRecord(ActionEvent event) { - studentTable.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); - student1 = studentTable.getSelectionModel().getSelectedItem(); - if(student1 == null){ - return; - } - try { - Parent pane3 = FXMLLoader.load(getClass().getResource("UpdateStudentLayout.fxml")); - Scene scene3 = new Scene(pane3); - Image ico3 = new Image("/icons/mainicon.png"); - stage3 = new Stage() ; - stage3.setScene(scene3); - stage3.setTitle("DIU Assist v1.5"); - stage3.getIcons().add(ico3); - stage3.resizableProperty().set(false); - stage3.show(); - } catch (IOException e) { - } - } - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +//imports +import java.io.IOException; +import java.net.URL; +import java.sql.SQLException; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.fxml.Initializable; +import javafx.geometry.Pos; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.SelectionMode; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.TextField; +import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.image.Image; +import javafx.scene.text.Text; +import javafx.stage.Stage; + +/** + * FXML Controller class + * + * @author Dell + */ +public class ShowAllStudentsController implements Initializable { + public static Student student1; + public static Stage stage3; + + public ShowAllStudentsController() { + } + @FXML + private Label studentcount; + @FXML + private TextField ssearchField; + @FXML + private Text searchresultlable; + @FXML + private TableView studentTable; + @FXML + private TableColumn slnoColl; + @FXML + private TableColumn idColl; + @FXML + private TableColumn batchColl; + @FXML + private TableColumn nameColl; + @FXML + private TableColumn mobileColl; + @FXML + private TableColumn emailColl; + @FXML + private TableColumn sectionColl; + @FXML + private TableColumn departmentColl; + + /** + * Initializes the controller class. + * + * @param url + * @param rb + */ + @Override + public void initialize(URL url, ResourceBundle rb) { + // TODO + searchresultlable.setText(""); + studentTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); + AddStudentLayoutController.stdList.clear(); + + SDatabaseAction sdbAction = new SDatabaseAction(); + try { + AddStudentLayoutController.stdList = sdbAction.getAllStudents(); + } catch (SQLException ex) { + Logger.getLogger(ShowAllStudentsController.class.getName()).log(Level.SEVERE, null, ex); + } + + studentcount.setText(" Total Students : "+AddStudentLayoutController.stdList.size()); + studentcount.setAlignment(Pos.CENTER); + + slnoColl.setCellValueFactory(new PropertyValueFactory("slno")); + idColl.setCellValueFactory(new PropertyValueFactory("id")); + batchColl.setCellValueFactory(new PropertyValueFactory("batch")); + nameColl.setCellValueFactory(new PropertyValueFactory("name")); + mobileColl.setCellValueFactory(new PropertyValueFactory("mobile")); + emailColl.setCellValueFactory(new PropertyValueFactory("email")); + sectionColl.setCellValueFactory(new PropertyValueFactory("section")); + departmentColl.setCellValueFactory(new PropertyValueFactory("department")); + + studentTable.setItems(AddStudentLayoutController.stdList); + + } + + //delete button action + @FXML + private void deleteRecords(ActionEvent event) throws SQLException { + try { + ObservableList selectedStudents = FXCollections.observableArrayList(); + selectedStudents = studentTable.getSelectionModel().getSelectedItems(); + + SDatabaseAction sdbAction = new SDatabaseAction(); + sdbAction.deletStudents(selectedStudents); + if (AddStudentLayoutController.stdList.removeAll(selectedStudents)) { + searchresultlable.setText("Data Deleted Successfully"); + } + } catch (SQLException e) { + searchresultlable.setText("Sorry Cannot Delete Those Data"); + } + + } + + //search button action + @FXML + private void searchBtn(ActionEvent event) { + String id = ssearchField.getText(); + if (id.equals("")) { + searchresultlable.setText(""); + return; + } + ObservableList Students = AddStudentLayoutController.stdList; + for (Student std : Students) { + if (std.getId().contains(id)) { + searchresultlable.setText(std.toString()); + break; + } else { + searchresultlable.setText("Sorry Data Not Found"); + } + } + } + + //update button action + @FXML + private void updateRecord(ActionEvent event) { + studentTable.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); + student1 = studentTable.getSelectionModel().getSelectedItem(); + if(student1 == null){ + return; + } + try { + Parent pane3 = FXMLLoader.load(getClass().getResource("UpdateStudentLayout.fxml")); + Scene scene3 = new Scene(pane3); + Image ico3 = new Image("/icons/mainicon.png"); + stage3 = new Stage() ; + stage3.setScene(scene3); + stage3.setTitle("DIU Assist v1.5"); + stage3.getIcons().add(ico3); + stage3.resizableProperty().set(false); + stage3.show(); + } catch (IOException e) { + } + } + +} diff --git a/src/diu/assist/pkg1/pkg0/ShowAllTeachersController.java b/src/diu/assist/pkg1/pkg0/ShowAllTeachersController.java index 14773b3..dccbddb 100644 --- a/src/diu/assist/pkg1/pkg0/ShowAllTeachersController.java +++ b/src/diu/assist/pkg1/pkg0/ShowAllTeachersController.java @@ -1,172 +1,172 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -//imports -import java.io.IOException; -import java.net.URL; -import java.sql.SQLException; -import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; -import javafx.fxml.Initializable; -import javafx.geometry.Pos; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.scene.control.Label; -import javafx.scene.control.SelectionMode; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableView; -import javafx.scene.control.TextField; -import javafx.scene.control.cell.PropertyValueFactory; -import javafx.scene.image.Image; -import javafx.scene.text.Text; -import javafx.stage.Stage; - -/** - * FXML Controller class - * - * @author Dell - */ -public class ShowAllTeachersController implements Initializable { - - public static Teacher teacher1; - public static Stage stage4; - - - public ShowAllTeachersController() { - } - @FXML - private TextField tsearchField; - @FXML - private Text searchresultlable; - @FXML - private Label teachercount; - @FXML - private TableView teacherTable; - @FXML - private TableColumn slnoColl; - @FXML - private TableColumn idColl; - @FXML - private TableColumn tiColl; - @FXML - private TableColumn nameColl; - @FXML - private TableColumn mobileColl; - @FXML - private TableColumn emailCOll; - @FXML - private TableColumn coursecodeColl; - @FXML - private TableColumn coursenameColl; - @FXML - private TableColumn departmentColl; - @FXML - private TableColumn facultyColl; - - /** - * Initializes the controller class. - */ - @Override - public void initialize(URL url, ResourceBundle rb) { - // TODO - teacherTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); - AddTeacherLayoutController.teachList.clear(); - searchresultlable.setText(""); - - TDatabaseAction tdbAction = new TDatabaseAction(); - - try { - AddTeacherLayoutController.teachList = tdbAction.getAllTeachers(); - } catch (SQLException ex) { - Logger.getLogger(ShowAllTeachersController.class.getName()).log(Level.SEVERE, null, ex); - } - - teachercount.setText(" Total Techers : "+AddTeacherLayoutController.teachList.size()); - teachercount.setAlignment(Pos.CENTER); - - slnoColl.setCellValueFactory(new PropertyValueFactory("tslno")); - idColl.setCellValueFactory(new PropertyValueFactory("tid")); - tiColl.setCellValueFactory(new PropertyValueFactory("tteacherinitial")); - nameColl.setCellValueFactory(new PropertyValueFactory("tname")); - mobileColl.setCellValueFactory(new PropertyValueFactory("tmobile")); - emailCOll.setCellValueFactory(new PropertyValueFactory("temail")); - coursecodeColl.setCellValueFactory(new PropertyValueFactory("tcoursecode")); - coursenameColl.setCellValueFactory(new PropertyValueFactory("tcoursename")); - departmentColl.setCellValueFactory(new PropertyValueFactory("tdepartment")); - facultyColl.setCellValueFactory(new PropertyValueFactory("tfaculty")); - - teacherTable.setItems(AddTeacherLayoutController.teachList); - - } - - //delete button action - @FXML - private void tdeleteBtn(ActionEvent event) throws SQLException { - try { - ObservableList selectedTeachers = FXCollections.observableArrayList(); - selectedTeachers = teacherTable.getSelectionModel().getSelectedItems(); - if(selectedTeachers==null){ - return; - } - TDatabaseAction tdbAction = new TDatabaseAction(); - tdbAction.deletTeachers(selectedTeachers); - if( AddTeacherLayoutController.teachList.removeAll(selectedTeachers)){ - searchresultlable.setText("Data Deleted Successfully"); - } - } catch (SQLException e) { - searchresultlable.setText("Sorry Cannot Delete Those Data"); - } - } - - //search button action - @FXML - private void searchBtn(ActionEvent event) { - String id = tsearchField.getText(); - if (id.equals("")) { - searchresultlable.setText(""); - return; - } - ObservableList teachers = AddTeacherLayoutController.teachList; - for (Teacher teach : teachers) { - if (teach.getTid().contains(id)) { - searchresultlable.setText(teach.toString()); - break; - } else { - searchresultlable.setText("Sorry Data Not Found"); - } - } - } - - //update button action - @FXML - private void tupdateRecord(ActionEvent event) throws IOException { - teacherTable.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); - teacher1 = teacherTable.getSelectionModel().getSelectedItem(); - if(teacher1==null){ - return ; - } - try{ - Parent pane4 = FXMLLoader.load(getClass().getResource("UpdateteacherLayout.fxml")); - Scene scene4 = new Scene(pane4); - Image ico4 = new Image("/icons/mainicon.png"); - stage4 = new Stage(); - stage4.setScene(scene4); - stage4.setTitle("DIU Assist v1.5"); - stage4.getIcons().add(ico4); - stage4.resizableProperty().set(false); - stage4.show(); - }catch(IOException e){ - } - } - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +//imports +import java.io.IOException; +import java.net.URL; +import java.sql.SQLException; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.fxml.Initializable; +import javafx.geometry.Pos; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.SelectionMode; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.TextField; +import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.image.Image; +import javafx.scene.text.Text; +import javafx.stage.Stage; + +/** + * FXML Controller class + * + * @author Dell + */ +public class ShowAllTeachersController implements Initializable { + + public static Teacher teacher1; + public static Stage stage4; + + + public ShowAllTeachersController() { + } + @FXML + private TextField tsearchField; + @FXML + private Text searchresultlable; + @FXML + private Label teachercount; + @FXML + private TableView teacherTable; + @FXML + private TableColumn slnoColl; + @FXML + private TableColumn idColl; + @FXML + private TableColumn tiColl; + @FXML + private TableColumn nameColl; + @FXML + private TableColumn mobileColl; + @FXML + private TableColumn emailCOll; + @FXML + private TableColumn coursecodeColl; + @FXML + private TableColumn coursenameColl; + @FXML + private TableColumn departmentColl; + @FXML + private TableColumn facultyColl; + + /** + * Initializes the controller class. + */ + @Override + public void initialize(URL url, ResourceBundle rb) { + // TODO + teacherTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); + AddTeacherLayoutController.teachList.clear(); + searchresultlable.setText(""); + + TDatabaseAction tdbAction = new TDatabaseAction(); + + try { + AddTeacherLayoutController.teachList = tdbAction.getAllTeachers(); + } catch (SQLException ex) { + Logger.getLogger(ShowAllTeachersController.class.getName()).log(Level.SEVERE, null, ex); + } + + teachercount.setText(" Total Techers : "+AddTeacherLayoutController.teachList.size()); + teachercount.setAlignment(Pos.CENTER); + + slnoColl.setCellValueFactory(new PropertyValueFactory("tslno")); + idColl.setCellValueFactory(new PropertyValueFactory("tid")); + tiColl.setCellValueFactory(new PropertyValueFactory("tteacherinitial")); + nameColl.setCellValueFactory(new PropertyValueFactory("tname")); + mobileColl.setCellValueFactory(new PropertyValueFactory("tmobile")); + emailCOll.setCellValueFactory(new PropertyValueFactory("temail")); + coursecodeColl.setCellValueFactory(new PropertyValueFactory("tcoursecode")); + coursenameColl.setCellValueFactory(new PropertyValueFactory("tcoursename")); + departmentColl.setCellValueFactory(new PropertyValueFactory("tdepartment")); + facultyColl.setCellValueFactory(new PropertyValueFactory("tfaculty")); + + teacherTable.setItems(AddTeacherLayoutController.teachList); + + } + + //delete button action + @FXML + private void tdeleteBtn(ActionEvent event) throws SQLException { + try { + ObservableList selectedTeachers = FXCollections.observableArrayList(); + selectedTeachers = teacherTable.getSelectionModel().getSelectedItems(); + if(selectedTeachers==null){ + return; + } + TDatabaseAction tdbAction = new TDatabaseAction(); + tdbAction.deletTeachers(selectedTeachers); + if( AddTeacherLayoutController.teachList.removeAll(selectedTeachers)){ + searchresultlable.setText("Data Deleted Successfully"); + } + } catch (SQLException e) { + searchresultlable.setText("Sorry Cannot Delete Those Data"); + } + } + + //search button action + @FXML + private void searchBtn(ActionEvent event) { + String id = tsearchField.getText(); + if (id.equals("")) { + searchresultlable.setText(""); + return; + } + ObservableList teachers = AddTeacherLayoutController.teachList; + for (Teacher teach : teachers) { + if (teach.getTid().contains(id)) { + searchresultlable.setText(teach.toString()); + break; + } else { + searchresultlable.setText("Sorry Data Not Found"); + } + } + } + + //update button action + @FXML + private void tupdateRecord(ActionEvent event) throws IOException { + teacherTable.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); + teacher1 = teacherTable.getSelectionModel().getSelectedItem(); + if(teacher1==null){ + return ; + } + try{ + Parent pane4 = FXMLLoader.load(getClass().getResource("UpdateteacherLayout.fxml")); + Scene scene4 = new Scene(pane4); + Image ico4 = new Image("/icons/mainicon.png"); + stage4 = new Stage(); + stage4.setScene(scene4); + stage4.setTitle("DIU Assist v1.5"); + stage4.getIcons().add(ico4); + stage4.resizableProperty().set(false); + stage4.show(); + }catch(IOException e){ + } + } + +} diff --git a/src/diu/assist/pkg1/pkg0/Student.java b/src/diu/assist/pkg1/pkg0/Student.java index d36c88a..90b7232 100644 --- a/src/diu/assist/pkg1/pkg0/Student.java +++ b/src/diu/assist/pkg1/pkg0/Student.java @@ -1,106 +1,106 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -/** - * - * @author Dell - */ -public class Student { - private int slno; - private String id; - private String batch; - private String name; - private String mobile; - private String email; - private String section; - private String department; - - public Student() { - } - - public Student(int slno, String id, String batch, String name, String mobile, String email, String section, String department) { - this.slno = slno; - this.id = id; - this.batch = batch; - this.name = name; - this.mobile = mobile; - this.email = email; - this.section = section; - this.department = department; - } - - public int getSlno() { - return slno; - } - - public void setSlno(int slno) { - this.slno = slno; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getBatch() { - return batch; - } - - public void setBatch(String batch) { - this.batch = batch; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getMobile() { - return mobile; - } - - public void setMobile(String mobile) { - this.mobile = mobile; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getSection() { - return section; - } - - public void setSection(String section) { - this.section = section; - } - - public String getDepartment() { - return department; - } - - public void setDepartment(String department) { - this.department = department; - } - - @Override - public String toString() { - return "SL No. : " + slno + ",Id :" + id + ", Batch : " + batch + ", Name : " + name + ", Mobile : " + mobile + ", Email : " + email + ", Section : " + section + ", Department : " + department; - } - - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +/** + * + * @author Dell + */ +public class Student { + private int slno; + private String id; + private String batch; + private String name; + private String mobile; + private String email; + private String section; + private String department; + + public Student() { + } + + public Student(int slno, String id, String batch, String name, String mobile, String email, String section, String department) { + this.slno = slno; + this.id = id; + this.batch = batch; + this.name = name; + this.mobile = mobile; + this.email = email; + this.section = section; + this.department = department; + } + + public int getSlno() { + return slno; + } + + public void setSlno(int slno) { + this.slno = slno; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getBatch() { + return batch; + } + + public void setBatch(String batch) { + this.batch = batch; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getSection() { + return section; + } + + public void setSection(String section) { + this.section = section; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + @Override + public String toString() { + return "SL No. : " + slno + ",Id :" + id + ", Batch : " + batch + ", Name : " + name + ", Mobile : " + mobile + ", Email : " + email + ", Section : " + section + ", Department : " + department; + } + + +} diff --git a/src/diu/assist/pkg1/pkg0/TDatabaseAction.java b/src/diu/assist/pkg1/pkg0/TDatabaseAction.java index ee248f9..6290590 100644 --- a/src/diu/assist/pkg1/pkg0/TDatabaseAction.java +++ b/src/diu/assist/pkg1/pkg0/TDatabaseAction.java @@ -1,115 +1,115 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -//imports -import java.net.URL; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ResourceBundle; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.fxml.Initializable; - -/** - * - * @author Dell - */ -public class TDatabaseAction implements Initializable{ - - //constructor - public TDatabaseAction(){ - - } - - - @Override - public void initialize(URL location, ResourceBundle resources) { - //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - //get connection from database - public Connection getConnection() throws SQLException{ - Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/diuassist_dbms","root",""); - Statement statement = conn.createStatement(); - statement.close(); - return conn; - } - - //get teachers data from database - public ObservableList getAllTeachers() throws SQLException{ - ObservableList teachList = FXCollections.observableArrayList(); - Connection conn = getConnection(); - try (Statement statement = conn.createStatement()) { - String query = "select * from teacher"; - - ResultSet rs = statement.executeQuery(query); - - while (rs.next()) { - int tslno = rs.getInt("tslno"); - String tid = rs.getString("tid"); - String tteacherinitial = rs.getString("tteacherinitial"); - String tname = rs.getString("tname"); - String tmobile = rs.getString("tmobile"); - String temail = rs.getString("temail"); - String tcoursecode = rs.getString("tcoursecode"); - String tcoursename = rs.getString("tcoursename"); - String tdepartment = rs.getString("tdepartment"); - String tfaculty = rs.getString("tfaculty"); - - Teacher teacher = new Teacher(tslno, tid, tteacherinitial, tname, tmobile, temail, tcoursecode, tcoursename, tdepartment, tfaculty); - teachList.add(teacher); - } - } - return teachList; - } - - //insert teachers data in database - public String insertTeacher(Teacher teacher) throws SQLException{ - Connection conn = getConnection(); - Statement statement = conn.createStatement(); - String query = "insert into teacher "+"values("+teacher.getTslno()+",'"+teacher.getTid()+"','"+teacher.getTteacherinitial()+"','"+teacher.getTname()+"','"+teacher.getTmobile()+"','"+teacher.getTemail()+"','"+teacher.getTcoursecode()+"','"+teacher.getTcoursename()+"','"+teacher.getTdepartment()+"','"+teacher.getTfaculty()+"')" ; - - if(statement.executeUpdate(query)>0){ - statement.close(); - return "Teaher added Successfully"; - } - else{ - statement.close(); - return "Failed"; - } - } - - //delete teachers data in database - void deletTeachers(ObservableList selectedteachers) throws SQLException{ - Connection conn = getConnection(); - try (Statement statement = conn.createStatement()) { - for(Teacher teachers : selectedteachers){ - String query = "delete from teacher where tslno = " +teachers.getTslno(); - int executeUpade = statement.executeUpdate(query); - } - } - } - - //update teachers data in database - public void updateTeacher(Teacher teach)throws SQLException{ - Teacher teacher = teach; - Connection conn = getConnection(); - Statement statement = conn.createStatement(); - try{ - String query = " UPDATE teacher SET tid = '"+teacher.getTid()+"', tteacherinitial = '"+teacher.getTteacherinitial()+"', tname = '"+teacher.getTname()+"', tmobile = '"+teacher.getTmobile()+"', temail = '"+teacher.getTemail()+"', tcoursecode = '"+teacher.getTcoursecode()+"', tcoursename ='"+teacher.getTcoursename()+"', tdepartment = '"+teacher.getTdepartment()+"', tfaculty = '"+teacher.getTfaculty()+"' WHERE tslno = "+teacher.getTslno()+";"; - statement.executeUpdate(query); - statement.close(); - }catch(SQLException e){ - - } - } - - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +//imports +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ResourceBundle; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.fxml.Initializable; + +/** + * + * @author Dell + */ +public class TDatabaseAction implements Initializable{ + + //constructor + public TDatabaseAction(){ + + } + + + @Override + public void initialize(URL location, ResourceBundle resources) { + //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + //get connection from database + public Connection getConnection() throws SQLException{ + Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/diuassist_dbms","root",""); + Statement statement = conn.createStatement(); + statement.close(); + return conn; + } + + //get teachers data from database + public ObservableList getAllTeachers() throws SQLException{ + ObservableList teachList = FXCollections.observableArrayList(); + Connection conn = getConnection(); + try (Statement statement = conn.createStatement()) { + String query = "select * from teacher"; + + ResultSet rs = statement.executeQuery(query); + + while (rs.next()) { + int tslno = rs.getInt("tslno"); + String tid = rs.getString("tid"); + String tteacherinitial = rs.getString("tteacherinitial"); + String tname = rs.getString("tname"); + String tmobile = rs.getString("tmobile"); + String temail = rs.getString("temail"); + String tcoursecode = rs.getString("tcoursecode"); + String tcoursename = rs.getString("tcoursename"); + String tdepartment = rs.getString("tdepartment"); + String tfaculty = rs.getString("tfaculty"); + + Teacher teacher = new Teacher(tslno, tid, tteacherinitial, tname, tmobile, temail, tcoursecode, tcoursename, tdepartment, tfaculty); + teachList.add(teacher); + } + } + return teachList; + } + + //insert teachers data in database + public String insertTeacher(Teacher teacher) throws SQLException{ + Connection conn = getConnection(); + Statement statement = conn.createStatement(); + String query = "insert into teacher "+"values("+teacher.getTslno()+",'"+teacher.getTid()+"','"+teacher.getTteacherinitial()+"','"+teacher.getTname()+"','"+teacher.getTmobile()+"','"+teacher.getTemail()+"','"+teacher.getTcoursecode()+"','"+teacher.getTcoursename()+"','"+teacher.getTdepartment()+"','"+teacher.getTfaculty()+"')" ; + + if(statement.executeUpdate(query)>0){ + statement.close(); + return "Teaher added Successfully"; + } + else{ + statement.close(); + return "Failed"; + } + } + + //delete teachers data in database + void deletTeachers(ObservableList selectedteachers) throws SQLException{ + Connection conn = getConnection(); + try (Statement statement = conn.createStatement()) { + for(Teacher teachers : selectedteachers){ + String query = "delete from teacher where tslno = " +teachers.getTslno(); + int executeUpade = statement.executeUpdate(query); + } + } + } + + //update teachers data in database + public void updateTeacher(Teacher teach)throws SQLException{ + Teacher teacher = teach; + Connection conn = getConnection(); + Statement statement = conn.createStatement(); + try{ + String query = " UPDATE teacher SET tid = '"+teacher.getTid()+"', tteacherinitial = '"+teacher.getTteacherinitial()+"', tname = '"+teacher.getTname()+"', tmobile = '"+teacher.getTmobile()+"', temail = '"+teacher.getTemail()+"', tcoursecode = '"+teacher.getTcoursecode()+"', tcoursename ='"+teacher.getTcoursename()+"', tdepartment = '"+teacher.getTdepartment()+"', tfaculty = '"+teacher.getTfaculty()+"' WHERE tslno = "+teacher.getTslno()+";"; + statement.executeUpdate(query); + statement.close(); + }catch(SQLException e){ + + } + } + + +} diff --git a/src/diu/assist/pkg1/pkg0/Teacher.java b/src/diu/assist/pkg1/pkg0/Teacher.java index 0551b0c..22015fb 100644 --- a/src/diu/assist/pkg1/pkg0/Teacher.java +++ b/src/diu/assist/pkg1/pkg0/Teacher.java @@ -1,128 +1,128 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -/** - * - * @author Dell - */ -public class Teacher { - - private int tslno; - private String tid; - private String tteacherinitial; - private String tname; - private String tmobile; - private String temail; - private String tcoursecode; - private String tcoursename; - private String tdepartment; - private String tfaculty; - - - public Teacher() { - } - - public Teacher(int tslno, String tid, String tteacherinitial, String tname, String tmobile, String temail, String tcoursecode, String tcoursename, String tdepartment, String tfaculty) { - this.tslno = tslno; - this.tid = tid; - this.tteacherinitial = tteacherinitial; - this.tname = tname; - this.tmobile = tmobile; - this.temail = temail; - this.tcoursecode = tcoursecode; - this.tcoursename = tcoursename; - this.tdepartment = tdepartment; - this.tfaculty = tfaculty; - } - - public int getTslno() { - return tslno; - } - - public void setTslno(int tslno) { - this.tslno = tslno; - } - - public String getTid() { - return tid; - } - - public void setTid(String tid) { - this.tid = tid; - } - - public String getTteacherinitial() { - return tteacherinitial; - } - - public void setTteacherinitial(String tteacherinitial) { - this.tteacherinitial = tteacherinitial; - } - - public String getTname() { - return tname; - } - - public void setTname(String tname) { - this.tname = tname; - } - - public String getTmobile() { - return tmobile; - } - - public void setTmobile(String tmobile) { - this.tmobile = tmobile; - } - - public String getTemail() { - return temail; - } - - public void setTemail(String temail) { - this.temail = temail; - } - - public String getTcoursecode() { - return tcoursecode; - } - - public void setTcoursecode(String tcoursecode) { - this.tcoursecode = tcoursecode; - } - - public String getTcoursename() { - return tcoursename; - } - - public void setTcoursename(String tcoursename) { - this.tcoursename = tcoursename; - } - - public String getTdepartment() { - return tdepartment; - } - - public void setTdepartment(String tdepartment) { - this.tdepartment = tdepartment; - } - - public String getTfaculty() { - return tfaculty; - } - - public void setTfaculty(String tfaculty) { - this.tfaculty = tfaculty; - } - - @Override - public String toString() { - return "SL No. : " + tslno + ", Id: " + tid + ", TI : " + tteacherinitial + ", Name : " + tname + ", Email : " + temail + ", Coursecode : " + tcoursecode + ", Dept. :" + tdepartment + ", Faculty : " + tfaculty ; - } - - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +/** + * + * @author Dell + */ +public class Teacher { + + private int tslno; + private String tid; + private String tteacherinitial; + private String tname; + private String tmobile; + private String temail; + private String tcoursecode; + private String tcoursename; + private String tdepartment; + private String tfaculty; + + + public Teacher() { + } + + public Teacher(int tslno, String tid, String tteacherinitial, String tname, String tmobile, String temail, String tcoursecode, String tcoursename, String tdepartment, String tfaculty) { + this.tslno = tslno; + this.tid = tid; + this.tteacherinitial = tteacherinitial; + this.tname = tname; + this.tmobile = tmobile; + this.temail = temail; + this.tcoursecode = tcoursecode; + this.tcoursename = tcoursename; + this.tdepartment = tdepartment; + this.tfaculty = tfaculty; + } + + public int getTslno() { + return tslno; + } + + public void setTslno(int tslno) { + this.tslno = tslno; + } + + public String getTid() { + return tid; + } + + public void setTid(String tid) { + this.tid = tid; + } + + public String getTteacherinitial() { + return tteacherinitial; + } + + public void setTteacherinitial(String tteacherinitial) { + this.tteacherinitial = tteacherinitial; + } + + public String getTname() { + return tname; + } + + public void setTname(String tname) { + this.tname = tname; + } + + public String getTmobile() { + return tmobile; + } + + public void setTmobile(String tmobile) { + this.tmobile = tmobile; + } + + public String getTemail() { + return temail; + } + + public void setTemail(String temail) { + this.temail = temail; + } + + public String getTcoursecode() { + return tcoursecode; + } + + public void setTcoursecode(String tcoursecode) { + this.tcoursecode = tcoursecode; + } + + public String getTcoursename() { + return tcoursename; + } + + public void setTcoursename(String tcoursename) { + this.tcoursename = tcoursename; + } + + public String getTdepartment() { + return tdepartment; + } + + public void setTdepartment(String tdepartment) { + this.tdepartment = tdepartment; + } + + public String getTfaculty() { + return tfaculty; + } + + public void setTfaculty(String tfaculty) { + this.tfaculty = tfaculty; + } + + @Override + public String toString() { + return "SL No. : " + tslno + ", Id: " + tid + ", TI : " + tteacherinitial + ", Name : " + tname + ", Email : " + temail + ", Coursecode : " + tcoursecode + ", Dept. :" + tdepartment + ", Faculty : " + tfaculty ; + } + + +} diff --git a/src/diu/assist/pkg1/pkg0/UpdateStudentLayoutController.java b/src/diu/assist/pkg1/pkg0/UpdateStudentLayoutController.java index 73ba79a..2fd2882 100644 --- a/src/diu/assist/pkg1/pkg0/UpdateStudentLayoutController.java +++ b/src/diu/assist/pkg1/pkg0/UpdateStudentLayoutController.java @@ -1,121 +1,121 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -//imports -import java.net.URL; -import java.sql.SQLException; -import java.util.ResourceBundle; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.fxml.Initializable; -import javafx.scene.control.Label; -import javafx.scene.control.TextArea; -import javafx.scene.control.TextField; - -/** - * FXML Controller class - * - * @author Dell - */ -public class UpdateStudentLayoutController implements Initializable { - - @FXML - private Label notification; - @FXML - private TextField slnoField; - @FXML - private TextField idField; - @FXML - private TextField nameField; - @FXML - private TextField mobileField; - @FXML - private TextField emailField; - @FXML - private TextField sectionField; - @FXML - private TextArea departmentField; - - private Student student2; - @FXML - private TextField batchField; - - /** - * Initializes the controller class. - * - * @param url - * @param rb - */ - @Override - public void initialize(URL url, ResourceBundle rb) { - // TODOS - notification.setText(""); - student2 = ShowAllStudentsController.student1; - int x = student2.getSlno(); - slnoField.setText("" + x); - slnoField.setEditable(false); - nameField.setText(student2.getName()); - idField.setText(student2.getId()); - emailField.setText(student2.getEmail()); - mobileField.setText(student2.getMobile()); - sectionField.setText(student2.getSection()); - batchField.setText(student2.getBatch()); - departmentField.setText(student2.getDepartment()); - - } - - //reset button action - @FXML - private void reset(ActionEvent event) { - slnoField.clear(); - nameField.clear(); - idField.clear(); - emailField.clear(); - mobileField.clear(); - sectionField.clear(); - batchField.clear(); - departmentField.clear(); - notification.setText(""); - } - - //update button action - @FXML - private void update(ActionEvent event) throws SQLException { - - try { - SDatabaseAction sdbAction = new SDatabaseAction(); - if (slnoField.getText().equals("")) { - notification.setText("Please Enter Serial. No For Update.."); - return; - } - int slno = Integer.parseInt(slnoField.getText()); - String id = idField.getText(); - String batch = batchField.getText(); - String name = nameField.getText(); - String mobile = mobileField.getText(); - String email = emailField.getText(); - String section = sectionField.getText(); - String department = departmentField.getText(); - - Student std = new Student(slno, id, batch, name, mobile, email, section, department); - sdbAction.updateStudent(std); - slnoField.clear(); - nameField.clear(); - idField.clear(); - emailField.clear(); - mobileField.clear(); - sectionField.clear(); - batchField.clear(); - departmentField.clear(); - notification.setText(""); - notification.setText("Data Updated Successfully..."); - } catch (NumberFormatException e) { - notification.setText("Sorry Can't Update Data to DataBase"); - } - } - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +//imports +import java.net.URL; +import java.sql.SQLException; +import java.util.ResourceBundle; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.Label; +import javafx.scene.control.TextArea; +import javafx.scene.control.TextField; + +/** + * FXML Controller class + * + * @author Dell + */ +public class UpdateStudentLayoutController implements Initializable { + + @FXML + private Label notification; + @FXML + private TextField slnoField; + @FXML + private TextField idField; + @FXML + private TextField nameField; + @FXML + private TextField mobileField; + @FXML + private TextField emailField; + @FXML + private TextField sectionField; + @FXML + private TextArea departmentField; + + private Student student2; + @FXML + private TextField batchField; + + /** + * Initializes the controller class. + * + * @param url + * @param rb + */ + @Override + public void initialize(URL url, ResourceBundle rb) { + // TODOS + notification.setText(""); + student2 = ShowAllStudentsController.student1; + int x = student2.getSlno(); + slnoField.setText("" + x); + slnoField.setEditable(false); + nameField.setText(student2.getName()); + idField.setText(student2.getId()); + emailField.setText(student2.getEmail()); + mobileField.setText(student2.getMobile()); + sectionField.setText(student2.getSection()); + batchField.setText(student2.getBatch()); + departmentField.setText(student2.getDepartment()); + + } + + //reset button action + @FXML + private void reset(ActionEvent event) { + slnoField.clear(); + nameField.clear(); + idField.clear(); + emailField.clear(); + mobileField.clear(); + sectionField.clear(); + batchField.clear(); + departmentField.clear(); + notification.setText(""); + } + + //update button action + @FXML + private void update(ActionEvent event) throws SQLException { + + try { + SDatabaseAction sdbAction = new SDatabaseAction(); + if (slnoField.getText().equals("")) { + notification.setText("Please Enter Serial. No For Update.."); + return; + } + int slno = Integer.parseInt(slnoField.getText()); + String id = idField.getText(); + String batch = batchField.getText(); + String name = nameField.getText(); + String mobile = mobileField.getText(); + String email = emailField.getText(); + String section = sectionField.getText(); + String department = departmentField.getText(); + + Student std = new Student(slno, id, batch, name, mobile, email, section, department); + sdbAction.updateStudent(std); + slnoField.clear(); + nameField.clear(); + idField.clear(); + emailField.clear(); + mobileField.clear(); + sectionField.clear(); + batchField.clear(); + departmentField.clear(); + notification.setText(""); + notification.setText("Data Updated Successfully..."); + } catch (NumberFormatException e) { + notification.setText("Sorry Can't Update Data to DataBase"); + } + } + +} diff --git a/src/diu/assist/pkg1/pkg0/UpdateteacherLayoutController.java b/src/diu/assist/pkg1/pkg0/UpdateteacherLayoutController.java index 36aa623..9ea33b9 100644 --- a/src/diu/assist/pkg1/pkg0/UpdateteacherLayoutController.java +++ b/src/diu/assist/pkg1/pkg0/UpdateteacherLayoutController.java @@ -1,135 +1,135 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -import java.net.URL; -import java.sql.SQLException; -import java.util.ResourceBundle; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.fxml.Initializable; -import javafx.scene.control.Label; -import javafx.scene.control.TextArea; -import javafx.scene.control.TextField; - -/** - * FXML Controller class - * - * @author Dell - */ -public class UpdateteacherLayoutController implements Initializable { - - @FXML - private Label notification; - @FXML - private TextField tslnoField; - @FXML - private TextField tidField; - @FXML - private TextField tnameField; - @FXML - private TextField tmobileField; - @FXML - private TextField temailField; - @FXML - private TextField tcoursecodeField; - @FXML - private TextArea tdepartmentField; - @FXML - private TextField tteacherinitialField; - @FXML - private TextField tcoursenameField; - @FXML - private TextField tfacultyField; - - Teacher teacher2; - - /** - * Initializes the controller class. - * - * @param url - * @param rb - */ - @Override - public void initialize(URL url, ResourceBundle rb) { - // TODO - notification.setText(""); - teacher2 = ShowAllTeachersController.teacher1; - int y = teacher2.getTslno(); - tslnoField.setText("" + y); - tslnoField.setEditable(false); - tnameField.setText(teacher2.getTname()); - tidField.setText(teacher2.getTid()); - tmobileField.setText(teacher2.getTmobile()); - temailField.setText(teacher2.getTemail()); - tcoursecodeField.setText(teacher2.getTcoursecode()); - tcoursenameField.setText(teacher2.getTcoursename()); - tdepartmentField.setText(teacher2.getTdepartment()); - tteacherinitialField.setText(teacher2.getTteacherinitial()); - tfacultyField.setText(teacher2.getTfaculty()); - } - - //reset button action - @FXML - private void treset(ActionEvent event) { - tslnoField.clear(); - tnameField.clear(); - tidField.clear(); - tmobileField.clear(); - temailField.clear(); - tcoursecodeField.clear(); - tcoursenameField.clear(); - tdepartmentField.clear(); - tfacultyField.clear(); - tteacherinitialField.clear(); - notification.setText(""); - } - - //update button action - @FXML - private void tupdateRecord(ActionEvent event) throws SQLException { - - try { - TDatabaseAction tdbAction = new TDatabaseAction(); - if (tslnoField.getText().equals("")) { - notification.setText("Please Enter Serial. No For Update.."); - return; - } - - int tslno = Integer.parseInt(tslnoField.getText()); - String tid = tidField.getText(); - String tteacherinitial = tteacherinitialField.getText(); - String tname = tnameField.getText(); - String tmobile = tmobileField.getText(); - String temail = temailField.getText(); - String tcoursecode = tcoursecodeField.getText(); - String tcoursename = tcoursenameField.getText(); - String tdepartment = tdepartmentField.getText(); - String tfaculty = tfacultyField.getText(); - - Teacher teach = new Teacher(tslno, tid, tteacherinitial, tname, tmobile, temail, tcoursecode, tcoursename, tdepartment, tfaculty); - tdbAction.updateTeacher(teach); - - tslnoField.clear(); - tnameField.clear(); - tidField.clear(); - tmobileField.clear(); - temailField.clear(); - tcoursecodeField.clear(); - tcoursenameField.clear(); - tdepartmentField.clear(); - tfacultyField.clear(); - tteacherinitialField.clear(); - notification.setText(""); - notification.setText("Data Updated Successfully..."); - - - } catch (NumberFormatException e) { - notification.setText("Sorry Can't Update Data to DataBase"); - } - } - -} +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +import java.net.URL; +import java.sql.SQLException; +import java.util.ResourceBundle; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.Label; +import javafx.scene.control.TextArea; +import javafx.scene.control.TextField; + +/** + * FXML Controller class + * + * @author Dell + */ +public class UpdateteacherLayoutController implements Initializable { + + @FXML + private Label notification; + @FXML + private TextField tslnoField; + @FXML + private TextField tidField; + @FXML + private TextField tnameField; + @FXML + private TextField tmobileField; + @FXML + private TextField temailField; + @FXML + private TextField tcoursecodeField; + @FXML + private TextArea tdepartmentField; + @FXML + private TextField tteacherinitialField; + @FXML + private TextField tcoursenameField; + @FXML + private TextField tfacultyField; + + Teacher teacher2; + + /** + * Initializes the controller class. + * + * @param url + * @param rb + */ + @Override + public void initialize(URL url, ResourceBundle rb) { + // TODO + notification.setText(""); + teacher2 = ShowAllTeachersController.teacher1; + int y = teacher2.getTslno(); + tslnoField.setText("" + y); + tslnoField.setEditable(false); + tnameField.setText(teacher2.getTname()); + tidField.setText(teacher2.getTid()); + tmobileField.setText(teacher2.getTmobile()); + temailField.setText(teacher2.getTemail()); + tcoursecodeField.setText(teacher2.getTcoursecode()); + tcoursenameField.setText(teacher2.getTcoursename()); + tdepartmentField.setText(teacher2.getTdepartment()); + tteacherinitialField.setText(teacher2.getTteacherinitial()); + tfacultyField.setText(teacher2.getTfaculty()); + } + + //reset button action + @FXML + private void treset(ActionEvent event) { + tslnoField.clear(); + tnameField.clear(); + tidField.clear(); + tmobileField.clear(); + temailField.clear(); + tcoursecodeField.clear(); + tcoursenameField.clear(); + tdepartmentField.clear(); + tfacultyField.clear(); + tteacherinitialField.clear(); + notification.setText(""); + } + + //update button action + @FXML + private void tupdateRecord(ActionEvent event) throws SQLException { + + try { + TDatabaseAction tdbAction = new TDatabaseAction(); + if (tslnoField.getText().equals("")) { + notification.setText("Please Enter Serial. No For Update.."); + return; + } + + int tslno = Integer.parseInt(tslnoField.getText()); + String tid = tidField.getText(); + String tteacherinitial = tteacherinitialField.getText(); + String tname = tnameField.getText(); + String tmobile = tmobileField.getText(); + String temail = temailField.getText(); + String tcoursecode = tcoursecodeField.getText(); + String tcoursename = tcoursenameField.getText(); + String tdepartment = tdepartmentField.getText(); + String tfaculty = tfacultyField.getText(); + + Teacher teach = new Teacher(tslno, tid, tteacherinitial, tname, tmobile, temail, tcoursecode, tcoursename, tdepartment, tfaculty); + tdbAction.updateTeacher(teach); + + tslnoField.clear(); + tnameField.clear(); + tidField.clear(); + tmobileField.clear(); + temailField.clear(); + tcoursecodeField.clear(); + tcoursenameField.clear(); + tdepartmentField.clear(); + tfacultyField.clear(); + tteacherinitialField.clear(); + notification.setText(""); + notification.setText("Data Updated Successfully..."); + + + } catch (NumberFormatException e) { + notification.setText("Sorry Can't Update Data to DataBase"); + } + } + +} diff --git a/src/diu/assist/pkg1/pkg0/WebviewprojectController.java b/src/diu/assist/pkg1/pkg0/WebviewprojectController.java index 03da72f..3635c16 100644 --- a/src/diu/assist/pkg1/pkg0/WebviewprojectController.java +++ b/src/diu/assist/pkg1/pkg0/WebviewprojectController.java @@ -1,330 +1,330 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package diu.assist.pkg1.pkg0; - -//imports -import java.net.URL; -import java.util.ResourceBundle; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.fxml.Initializable; -import javafx.scene.control.Button; -import static diu.assist.pkg1.pkg0.WebviewprojectController.webengine; -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.logging.Level; -import java.util.logging.Logger; -import javafx.scene.control.TextField; -import javafx.scene.layout.BorderPane; -import javafx.scene.web.WebEngine; -import javafx.scene.web.WebView; -import javafx.scene.web.WebHistory; - -/** - * FXML Controller class - * - * @author Dell - */ -public class WebviewprojectController implements Initializable { - - @FXML - private Button reload; - @FXML - private Button facebook; - - public static WebEngine webengine; - @FXML - private WebView webview; - @FXML - private Button linkedin; - @FXML - private Button instagram; - @FXML - private Button youtube; - @FXML - private Button twitter; - @FXML - private TextField searchField; - - public static WebHistory webHistory; - @FXML - private BorderPane webpane; - - //constructor - public WebviewprojectController() { - } - - /** - * Initializes the controller class. - * - * @param url - * @param rb - */ - @Override - public void initialize(URL url, ResourceBundle rb) { - try { - // TODO - browseNow("https://duckduckgo.com"); - } catch (URISyntaxException | IOException ex) { - Logger.getLogger(WebviewprojectController.class.getName()).log(Level.SEVERE, null, ex); - } - searchField.clear(); - } - - @FXML - private void reloadBtn(ActionEvent event) { - webengine.reload(); - } - - @FXML - private void facebookBtn(ActionEvent event) throws URISyntaxException, IOException { - String url = "https://www.facebook.com/daffodilvarsity.edu.bd/?_rdc=1&_rdr"; - browseNow(url); - } - - @FXML - private void linkedInBtn(ActionEvent event) throws URISyntaxException, IOException { - String url = "https://www.linkedin.com/school/daffodil-international-university/?originalSubdomain=bd"; - browseNow(url); - } - - @FXML - private void instagramBtn(ActionEvent event) throws URISyntaxException, IOException { - String url = "https://www.instagram.com/daffodil.university/?hl=en"; - browseNow(url); - - } - - @FXML - private void studentportaBtn(ActionEvent event) throws URISyntaxException, IOException { - browseNow("http://studentportal.diu.edu.bd"); - } - - @FXML - private void homeBtn(ActionEvent event) throws URISyntaxException, IOException { - browseNow("https://www.daffodilvarsity.edu.bd/"); - } - - @FXML - private void youtubeBtn(ActionEvent event) throws URISyntaxException, IOException { - String url = "https://www.youtube.com/channel/UC9PzvD1qa4IPN4sBZ_gMeQQ"; - browseNow(url); - } - - @FXML - private void twitterBtn(ActionEvent event) throws URISyntaxException, IOException { - String url = "https://mobile.twitter.com/daffodilvarsity"; - browseNow(url); - } - - @FXML - private void blcBtn(ActionEvent event)throws URISyntaxException, IOException { - browseNow("https://elearn.daffodilvarsity.edu.bd/"); - } - - @FXML - private void iqac(ActionEvent event) throws URISyntaxException, IOException{ - browseNow("http://iqac.daffodilvarsity.edu.bd/"); - } - - @FXML - private void hrdi(ActionEvent event)throws URISyntaxException, IOException { - browseNow("http://hrdinstitute.org/"); - } - - @FXML - private void calender(ActionEvent event)throws URISyntaxException, IOException { - browseNow("https://daffodilvarsity.edu.bd/department/accounts"); - } - - @FXML - private void libbrary(ActionEvent event) throws URISyntaxException, IOException{ - browseNow("https://library.daffodilvarsity.edu.bd/"); - } - - @FXML - private void hostel(ActionEvent event)throws URISyntaxException, IOException { - browseNow("https://hostel.daffodilvarsity.edu.bd/"); - } - - @FXML - private void noticeboard(ActionEvent event)throws URISyntaxException, IOException{ - browseNow("https://daffodilvarsity.edu.bd/noticeboard"); - } - - private void sbsfbd(ActionEvent event)throws URISyntaxException, IOException { - browseNow("http://ww1.sbsfbd.com/"); - } - - @FXML - private void studentapplication(ActionEvent event)throws URISyntaxException, IOException { - browseNow("http://203.190.9.108/diu-sac/"); - } - - @FXML - private void doierp(ActionEvent event) throws URISyntaxException, IOException{ - browseNow("https://daffodilvarsity.edu.bd/article/erp"); - } - - @FXML - private void projectintern(ActionEvent event) throws URISyntaxException, IOException{ - browseNow("https://sites.google.com/daffodilvarsity.edu.bd/picsediu/home?authuser=0"); - } - - @FXML - private void wikipedia(ActionEvent event)throws URISyntaxException, IOException { - browseNow("https://en.wikipedia.org/wiki/Daffodil_International_University"); - } - - @FXML - private void Maps(ActionEvent event)throws URISyntaxException, IOException { - browseNow("https://www.google.com/maps/d/u/0/viewer?ie=UTF&msa=0&mid=1DA3oU1bJLKevmpUej54D9NJYOhg&ll=23.752471000000014%2C90.37793399999997&z=17"); - } - - @FXML - private void pmiscse(ActionEvent event)throws URISyntaxException, IOException { - browseNow("https://pmiscse.daffodilvarsity.edu.bd/"); - - } - - @FXML - private void cpc(ActionEvent event) throws URISyntaxException, IOException{ - browseNow("http://cpc.daffodilvarsity.edu.bd/"); - } - - @FXML - private void gcpc(ActionEvent event) throws URISyntaxException, IOException{ - browseNow("https://gcpc.daffodilvarsity.edu.bd/"); - } - - @FXML - private void campustv(ActionEvent event)throws URISyntaxException, IOException { - browseNow("http://www.campustv.ac/"); - } - - @FXML - private void campusradio(ActionEvent event)throws URISyntaxException, IOException { - browseNow("http://campusradio.ac/"); - } - - @FXML - private void more(ActionEvent event)throws URISyntaxException, IOException { - browseNow("http://international.daffodilvarsity.edu.bd/index.php/events/useful-links"); - } - - - //forword & back button action - @FXML - private void backBtn(ActionEvent event) { - try { - webHistory.go(-1); - } catch (Exception e) { - - } - } - - @FXML - private void forwordBtn(ActionEvent event) { - try { - webHistory.go(1); - } catch (Exception e) { - - } - } - - //search button action - @FXML - private void searchBtn(ActionEvent event)throws URISyntaxException, IOException { - webengine = webview.getEngine(); - - String link = searchField.getText(); - - if (link.equals("")) { - return; - } else if (link.toLowerCase().contains("https://") || link.toLowerCase().contains("https://www.")) { - String url = link; - if (!link.toLowerCase().contains(".com")) { - url += ".com"; - } - browseNow(url); - } else if (link.toLowerCase().contains("www.") || link.toLowerCase().contains("mobile.")) { - try { - String url = "https://" + link; - browseNow(url); - } catch (Exception e) { - - } - } else if (!(link.toLowerCase().contains("mobile.")) || !(link.toLowerCase().contains("www."))) { - try { - String url = "https://www.google.com/search?q="; - browseNow(url + link); - } catch (Exception e) { - - } - } else { - try { - String url = "https://www.google.com/search?q="; - for (String v : link.split(" ")) { - browseNow(url + v); - Thread.sleep(1000); - } - - } catch (Exception e) { - - } - } - searchField.clear(); - } - - //zoom out action - @FXML - private void zoomoutBtn(ActionEvent event) { - double size = 1.0; - size = webview.getZoom() - 0.1; - webview.setZoom(size); - } - - //zoom out action - @FXML - private void zoomInBtn(ActionEvent event) { - double size = 1.0; - size = webview.getZoom() + 0.1; - webview.setZoom(size); - } - - public void addurl(String url) throws URISyntaxException, IOException{ - browseNow(url); - } - - //browse method - /** - * - * @param o - * @throws java.net.URISyntaxException - * @throws java.io.IOException - */ - @SuppressWarnings("empty-statement") - public void browseNow(Object o) throws URISyntaxException, IOException { - - String url = (String) o; - try { - webengine = webview.getEngine(); - webengine.setUserAgent("use required / intended UA string"); - webengine.setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"); - searchField.setText(url); - webengine.setJavaScriptEnabled(true); - webengine.load(url); - webHistory = webengine.getHistory(); - - } catch (Exception e) { - Desktop.getDesktop().browse(new URI(url)); - } - } - -} -//Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36 +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package diu.assist.pkg1.pkg0; + +//imports +import java.net.URL; +import java.util.ResourceBundle; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.Button; +import static diu.assist.pkg1.pkg0.WebviewprojectController.webengine; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.logging.Level; +import java.util.logging.Logger; +import javafx.scene.control.TextField; +import javafx.scene.layout.BorderPane; +import javafx.scene.web.WebEngine; +import javafx.scene.web.WebView; +import javafx.scene.web.WebHistory; + +/** + * FXML Controller class + * + * @author Dell + */ +public class WebviewprojectController implements Initializable { + + @FXML + private Button reload; + @FXML + private Button facebook; + + public static WebEngine webengine; + @FXML + private WebView webview; + @FXML + private Button linkedin; + @FXML + private Button instagram; + @FXML + private Button youtube; + @FXML + private Button twitter; + @FXML + private TextField searchField; + + public static WebHistory webHistory; + @FXML + private BorderPane webpane; + + //constructor + public WebviewprojectController() { + } + + /** + * Initializes the controller class. + * + * @param url + * @param rb + */ + @Override + public void initialize(URL url, ResourceBundle rb) { + try { + // TODO + browseNow("https://duckduckgo.com"); + } catch (URISyntaxException | IOException ex) { + Logger.getLogger(WebviewprojectController.class.getName()).log(Level.SEVERE, null, ex); + } + searchField.clear(); + } + + @FXML + private void reloadBtn(ActionEvent event) { + webengine.reload(); + } + + @FXML + private void facebookBtn(ActionEvent event) throws URISyntaxException, IOException { + String url = "https://www.facebook.com/daffodilvarsity.edu.bd/?_rdc=1&_rdr"; + browseNow(url); + } + + @FXML + private void linkedInBtn(ActionEvent event) throws URISyntaxException, IOException { + String url = "https://www.linkedin.com/school/daffodil-international-university/?originalSubdomain=bd"; + browseNow(url); + } + + @FXML + private void instagramBtn(ActionEvent event) throws URISyntaxException, IOException { + String url = "https://www.instagram.com/daffodil.university/?hl=en"; + browseNow(url); + + } + + @FXML + private void studentportaBtn(ActionEvent event) throws URISyntaxException, IOException { + browseNow("http://studentportal.diu.edu.bd"); + } + + @FXML + private void homeBtn(ActionEvent event) throws URISyntaxException, IOException { + browseNow("https://www.daffodilvarsity.edu.bd/"); + } + + @FXML + private void youtubeBtn(ActionEvent event) throws URISyntaxException, IOException { + String url = "https://www.youtube.com/channel/UC9PzvD1qa4IPN4sBZ_gMeQQ"; + browseNow(url); + } + + @FXML + private void twitterBtn(ActionEvent event) throws URISyntaxException, IOException { + String url = "https://mobile.twitter.com/daffodilvarsity"; + browseNow(url); + } + + @FXML + private void blcBtn(ActionEvent event)throws URISyntaxException, IOException { + browseNow("https://elearn.daffodilvarsity.edu.bd/"); + } + + @FXML + private void iqac(ActionEvent event) throws URISyntaxException, IOException{ + browseNow("http://iqac.daffodilvarsity.edu.bd/"); + } + + @FXML + private void hrdi(ActionEvent event)throws URISyntaxException, IOException { + browseNow("http://hrdinstitute.org/"); + } + + @FXML + private void calender(ActionEvent event)throws URISyntaxException, IOException { + browseNow("https://daffodilvarsity.edu.bd/department/accounts"); + } + + @FXML + private void libbrary(ActionEvent event) throws URISyntaxException, IOException{ + browseNow("https://library.daffodilvarsity.edu.bd/"); + } + + @FXML + private void hostel(ActionEvent event)throws URISyntaxException, IOException { + browseNow("https://hostel.daffodilvarsity.edu.bd/"); + } + + @FXML + private void noticeboard(ActionEvent event)throws URISyntaxException, IOException{ + browseNow("https://daffodilvarsity.edu.bd/noticeboard"); + } + + private void sbsfbd(ActionEvent event)throws URISyntaxException, IOException { + browseNow("http://ww1.sbsfbd.com/"); + } + + @FXML + private void studentapplication(ActionEvent event)throws URISyntaxException, IOException { + browseNow("http://203.190.9.108/diu-sac/"); + } + + @FXML + private void doierp(ActionEvent event) throws URISyntaxException, IOException{ + browseNow("https://daffodilvarsity.edu.bd/article/erp"); + } + + @FXML + private void projectintern(ActionEvent event) throws URISyntaxException, IOException{ + browseNow("https://sites.google.com/daffodilvarsity.edu.bd/picsediu/home?authuser=0"); + } + + @FXML + private void wikipedia(ActionEvent event)throws URISyntaxException, IOException { + browseNow("https://en.wikipedia.org/wiki/Daffodil_International_University"); + } + + @FXML + private void Maps(ActionEvent event)throws URISyntaxException, IOException { + browseNow("https://www.google.com/maps/d/u/0/viewer?ie=UTF&msa=0&mid=1DA3oU1bJLKevmpUej54D9NJYOhg&ll=23.752471000000014%2C90.37793399999997&z=17"); + } + + @FXML + private void pmiscse(ActionEvent event)throws URISyntaxException, IOException { + browseNow("https://pmiscse.daffodilvarsity.edu.bd/"); + + } + + @FXML + private void cpc(ActionEvent event) throws URISyntaxException, IOException{ + browseNow("http://cpc.daffodilvarsity.edu.bd/"); + } + + @FXML + private void gcpc(ActionEvent event) throws URISyntaxException, IOException{ + browseNow("https://gcpc.daffodilvarsity.edu.bd/"); + } + + @FXML + private void campustv(ActionEvent event)throws URISyntaxException, IOException { + browseNow("http://www.campustv.ac/"); + } + + @FXML + private void campusradio(ActionEvent event)throws URISyntaxException, IOException { + browseNow("http://campusradio.ac/"); + } + + @FXML + private void more(ActionEvent event)throws URISyntaxException, IOException { + browseNow("http://international.daffodilvarsity.edu.bd/index.php/events/useful-links"); + } + + + //forword & back button action + @FXML + private void backBtn(ActionEvent event) { + try { + webHistory.go(-1); + } catch (Exception e) { + + } + } + + @FXML + private void forwordBtn(ActionEvent event) { + try { + webHistory.go(1); + } catch (Exception e) { + + } + } + + //search button action + @FXML + private void searchBtn(ActionEvent event)throws URISyntaxException, IOException { + webengine = webview.getEngine(); + + String link = searchField.getText(); + + if (link.equals("")) { + return; + } else if (link.toLowerCase().contains("https://") || link.toLowerCase().contains("https://www.")) { + String url = link; + if (!link.toLowerCase().contains(".com")) { + url += ".com"; + } + browseNow(url); + } else if (link.toLowerCase().contains("www.") || link.toLowerCase().contains("mobile.")) { + try { + String url = "https://" + link; + browseNow(url); + } catch (Exception e) { + + } + } else if (!(link.toLowerCase().contains("mobile.")) || !(link.toLowerCase().contains("www."))) { + try { + String url = "https://www.google.com/search?q="; + browseNow(url + link); + } catch (Exception e) { + + } + } else { + try { + String url = "https://www.google.com/search?q="; + for (String v : link.split(" ")) { + browseNow(url + v); + Thread.sleep(1000); + } + + } catch (Exception e) { + + } + } + searchField.clear(); + } + + //zoom out action + @FXML + private void zoomoutBtn(ActionEvent event) { + double size = 1.0; + size = webview.getZoom() - 0.1; + webview.setZoom(size); + } + + //zoom out action + @FXML + private void zoomInBtn(ActionEvent event) { + double size = 1.0; + size = webview.getZoom() + 0.1; + webview.setZoom(size); + } + + public void addurl(String url) throws URISyntaxException, IOException{ + browseNow(url); + } + + //browse method + /** + * + * @param o + * @throws java.net.URISyntaxException + * @throws java.io.IOException + */ + @SuppressWarnings("empty-statement") + public void browseNow(Object o) throws URISyntaxException, IOException { + + String url = (String) o; + try { + webengine = webview.getEngine(); + webengine.setUserAgent("use required / intended UA string"); + webengine.setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"); + searchField.setText(url); + webengine.setJavaScriptEnabled(true); + webengine.load(url); + webHistory = webengine.getHistory(); + + } catch (Exception e) { + Desktop.getDesktop().browse(new URI(url)); + } + } + +} +//Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36 diff --git a/src/icons/icons8_women's_macbook_500px.png b/src/icons/icons8_women's_macbook_500px.png new file mode 100644 index 0000000..a258670 Binary files /dev/null and b/src/icons/icons8_women's_macbook_500px.png differ