├── LICENSE
├── README.md
├── build.xml
├── db
└── db.sql
├── manifest.mf
├── nbproject
├── build-impl.xml
├── genfiles.properties
├── project.properties
└── project.xml
└── src
├── gamemarkstudiio
├── DataConnection
│ └── ConnectionClass.java
└── salaryslips
│ ├── SalarySlip.form
│ ├── SalarySlip.java
│ ├── SalarySlipDetail.form
│ └── SalarySlipDetail.java
└── gamemarkstudio
├── dailywork
├── DailyTask.java
├── DailyTaskHandling.java
├── DailyWorkPanel.form
└── DailyWorkPanel.java
├── images
├── 1.png
├── 15780805_592901627582475_404159619298736519_n.jpg
├── Animated-American-Money-Falling-Into-a-Pile.jpg
├── Home.PNG
├── Teacher-and-students-by-algogenius.jpg
├── Update.png
├── animation-employee.gif
├── blank-profile-head-hi.png
├── icon2.png
├── newUpdate.jpg
├── sad-face.png
└── url.jpg
├── login
├── AddNewLogin.form
├── AddNewLogin.java
├── ForgotPassword.form
├── ForgotPassword.java
├── Login.form
├── Login.java
├── LoginHandling.java
└── Login_1.java
├── mainframe
├── FontPanel.form
├── FontPanel.java
├── MainOfficeManagement.form
└── MainOfficeManagement.java
├── newemployeepane
├── NewEmployeePane.form
├── NewEmployeePane.java
├── PersonalHandling.java
└── PersonalInfo.java
├── searchemployee
├── SearchEmployee.form
└── SearchEmployee.java
├── splashScreen
├── SplashForm.form
├── SplashForm.java
└── SplashGMS.gif
├── update
├── TitlePane.form
├── TitlePane.java
├── UpdatePanel.form
├── UpdatePanel.java
├── updateemployeepanel
│ ├── UpdateEmployee.form
│ ├── UpdateEmployee.java
│ ├── UpdateEmployeeDialog.form
│ └── UpdateEmployeeDialog.java
├── updatepassword
│ ├── ChangePassword.form
│ └── ChangePassword.java
└── updatesalaryslips
│ ├── SalaryHandling.java
│ ├── SalarySlipClass.java
│ ├── UpdateSalarySlips.form
│ └── UpdateSalarySlips.java
└── uploadwork
├── UploadHandling.java
└── UploadWork.java
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Hamza Yasin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HR-Management-System-in-Java-using-swing-framework
2 | I've Develop this HR Management System in Java swing framework for learning purpose using MySql Database.
3 | ## Features
4 | Although its a basic HR Management System made with java and MySQL database, but it has alot of versatile functionalities. Mentioning below.
5 | 1. You can add, delete, update and search Employee record in database.
6 | 2. You can add, delete, update and search Salary Slip of employee in database.
7 | 3. You can add, delete, update and search Daily Task of employee in database.
8 | 4. You can create , delete , update , search and forget password login results in database.
9 | 5. You can generate, delete, update and search Salry Slip of employee in database.
10 | 6. Multi-Threaded Splash Screen.
11 |
12 | ## Interface
13 | 
14 |
15 | ## Dependencies
16 | You must have Java JDK 1.8 or microsoft MySQL connector for database.
17 | 1. mysql-connector-java-5.1.39-bin.jar
18 | 2. JDK 1.8
19 | ## Built with
20 | 1. Java
21 | 2. Swing Framework
22 | 3. MySQL database
23 |
24 | ## Support Developer
25 | You can Donate Some Ether to the Developer.
26 |
27 | Ethereum Address : 0x39886D0BFccc74D8CCb21c44534a41eC626620b3
28 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project GameMarkStudio.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/db/db.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/db/db.sql
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=1853ac60
2 | build.xml.script.CRC32=031c40d1
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=1853ac60
7 | nbproject/build-impl.xml.script.CRC32=f4d70b42
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processors.list=
4 | annotation.processing.run.all.processors=true
5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
6 | application.title=GameMarkStudio
7 | application.vendor=zainm
8 | build.classes.dir=${build.dir}/classes
9 | build.classes.excludes=**/*.java,**/*.form
10 | # This directory is removed when the project is cleaned:
11 | build.dir=build
12 | build.generated.dir=${build.dir}/generated
13 | build.generated.sources.dir=${build.dir}/generated-sources
14 | # Only compile against the classpath explicitly listed here:
15 | build.sysclasspath=ignore
16 | build.test.classes.dir=${build.dir}/test/classes
17 | build.test.results.dir=${build.dir}/test/results
18 | # Uncomment to specify the preferred debugger connection transport:
19 | #debug.transport=dt_socket
20 | debug.classpath=\
21 | ${run.classpath}
22 | debug.test.classpath=\
23 | ${run.test.classpath}
24 | # Files in build.classes.dir which should be excluded from distribution jar
25 | dist.archive.excludes=
26 | # This directory is removed when the project is cleaned:
27 | dist.dir=dist
28 | dist.jar=${dist.dir}/GameMarkStudio.jar
29 | dist.javadoc.dir=${dist.dir}/javadoc
30 | endorsed.classpath=
31 | excludes=
32 | file.reference.mysql-connector-java-5.1.39-bin.jar=C:\\Program Files (x86)\\MySQL\\Connector.J 5.1\\mysql-connector-java-5.1.39-bin.jar
33 | file.reference.mysql-connector-java-5.1.39-bin.jar-1=C:\\Users\\mubas\\Desktop\\mysql-connector-java-5.1.39-bin.jar
34 | includes=**
35 | jar.compress=false
36 | javac.classpath=\
37 | ${file.reference.mysql-connector-java-5.1.39-bin.jar}:\
38 | ${libs.absolutelayout.classpath}:\
39 | ${file.reference.mysql-connector-java-5.1.39-bin.jar-1}
40 | # Space-separated list of extra javac options
41 | javac.compilerargs=
42 | javac.deprecation=false
43 | javac.external.vm=true
44 | javac.processorpath=\
45 | ${javac.classpath}
46 | javac.source=1.8
47 | javac.target=1.8
48 | javac.test.classpath=\
49 | ${javac.classpath}:\
50 | ${build.classes.dir}
51 | javac.test.processorpath=\
52 | ${javac.test.classpath}
53 | javadoc.additionalparam=
54 | javadoc.author=false
55 | javadoc.encoding=${source.encoding}
56 | javadoc.noindex=false
57 | javadoc.nonavbar=false
58 | javadoc.notree=false
59 | javadoc.private=false
60 | javadoc.splitindex=true
61 | javadoc.use=true
62 | javadoc.version=false
63 | javadoc.windowtitle=
64 | main.class=gamemarkstudio.splashScreen.SplashForm
65 | manifest.file=manifest.mf
66 | meta.inf.dir=${src.dir}/META-INF
67 | mkdist.disabled=false
68 | platform.active=default_platform
69 | run.classpath=\
70 | ${javac.classpath}:\
71 | ${build.classes.dir}
72 | # Space-separated list of JVM arguments used when running the project.
73 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
74 | # To set system properties for unit tests define test-sys-prop.name=value:
75 | run.jvmargs=
76 | run.test.classpath=\
77 | ${javac.test.classpath}:\
78 | ${build.test.classes.dir}
79 | source.encoding=UTF-8
80 | src.dir=src
81 | test.src.dir=test
82 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | GameMarkStudio
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/gamemarkstudiio/DataConnection/ConnectionClass.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 |
13 | package gamemarkstudiio.DataConnection;
14 |
15 | import java.sql.Connection;
16 | import java.sql.DriverManager;
17 | import java.sql.PreparedStatement;
18 | import java.sql.ResultSet;
19 | import java.sql.SQLException;
20 | import java.sql.Statement;
21 | import javax.swing.JOptionPane;
22 |
23 | /**
24 | * This class is written for establishing connection between database and java code
25 | * @version 1.10 25 Aug 2017
26 | * @author Hamza Yasin
27 | */
28 |
29 | public class ConnectionClass {
30 | private static final String URL = "jdbc:mysql://localhost:3306/gms";
31 | private static final String USER_NAME = "root";
32 | private static final String PASSWORD = "12345";
33 |
34 | private static Connection connection = null;
35 | private static Statement statement = null;
36 |
37 | /* Creating Connection*/
38 | public static void connection(){
39 | try{
40 | connection = DriverManager.getConnection(URL, USER_NAME, PASSWORD);
41 | statement = connection.createStatement();
42 | System.out.println("Connection Opened");
43 | }catch(SQLException e){
44 | JOptionPane.showMessageDialog(null, "Connection is not Opened ! " + e.getMessage());
45 | }
46 | }
47 | /* Selecting Query */
48 | public static ResultSet selectQuery(String query) {
49 | try{
50 | return statement.executeQuery(query);
51 | }catch(SQLException e){
52 | e.getMessage();
53 | return null;
54 |
55 | }
56 | }
57 | /* Executing Query */
58 | public static boolean query(String query) {
59 | try{
60 | return statement.execute(query);
61 | }catch(SQLException e){
62 | e.getMessage();
63 | throw new IllegalArgumentException();
64 | }
65 | }
66 | /* Prepares the data first then execute it */
67 | public static PreparedStatement getPreStatement(String query)
68 | {
69 | try {
70 | return statement.getConnection().prepareStatement(query);
71 | } catch (SQLException e) {}
72 | return null;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/gamemarkstudiio/salaryslips/SalarySlip.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudiio.salaryslips;
13 |
14 | import gamemarkstudio.update.updatesalaryslips.SalaryHandling;
15 | import gamemarkstudio.update.updatesalaryslips.SalarySlipClass;
16 | import javax.swing.JOptionPane;
17 |
18 | /**
19 | * @version 1.10 25 Aug 2017
20 | * @author Hamza Yasin
21 | */
22 | public class SalarySlip extends javax.swing.JPanel {
23 |
24 | /**
25 | * Creates new form SalarySlip
26 | */
27 | public SalarySlip() {
28 | initComponents();
29 | }
30 |
31 | /**
32 | * This method is called from within the constructor to initialize the form.
33 | * WARNING: Do NOT modify this code. The content of this method is always
34 | * regenerated by the Form Editor.
35 | */
36 | @SuppressWarnings("unchecked")
37 | // //GEN-BEGIN:initComponents
38 | private void initComponents() {
39 |
40 | jLabel1 = new javax.swing.JLabel();
41 | jLabel4 = new javax.swing.JLabel();
42 | idTextField = new javax.swing.JTextField();
43 | jLabel5 = new javax.swing.JLabel();
44 | jLabel6 = new javax.swing.JLabel();
45 | advanceTextField = new javax.swing.JTextField();
46 | jLabel7 = new javax.swing.JLabel();
47 | deductionTextField = new javax.swing.JTextField();
48 | generateSlipButton = new javax.swing.JButton();
49 | jLabel2 = new javax.swing.JLabel();
50 | jLabel8 = new javax.swing.JLabel();
51 | salaryMonth = new javax.swing.JComboBox<>();
52 | salaryDays = new javax.swing.JComboBox<>();
53 |
54 | setBackground(new java.awt.Color(255, 255, 255));
55 |
56 | jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
57 | jLabel1.setForeground(new java.awt.Color(0, 102, 204));
58 | jLabel1.setText("Salary Slips");
59 | jLabel1.setToolTipText("");
60 |
61 | jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
62 | jLabel4.setText("ID: ");
63 |
64 | idTextField.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
65 | idTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
66 |
67 | jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
68 | jLabel5.setText("Days:");
69 |
70 | jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
71 | jLabel6.setText("Advance:");
72 |
73 | advanceTextField.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
74 | advanceTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
75 |
76 | jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
77 | jLabel7.setText("Deduction:");
78 |
79 | deductionTextField.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
80 | deductionTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
81 |
82 | generateSlipButton.setBackground(new java.awt.Color(255, 255, 255));
83 | generateSlipButton.setFont(new java.awt.Font("Tahoma", 1, 22)); // NOI18N
84 | generateSlipButton.setForeground(new java.awt.Color(0, 102, 0));
85 | generateSlipButton.setText("Generate Slip");
86 | generateSlipButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
87 | generateSlipButton.addActionListener(new java.awt.event.ActionListener() {
88 | public void actionPerformed(java.awt.event.ActionEvent evt) {
89 | generateSlipButtonActionPerformed(evt);
90 | }
91 | });
92 |
93 | jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gamemarkstudio/images/Animated-American-Money-Falling-Into-a-Pile.jpg"))); // NOI18N
94 |
95 | jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
96 | jLabel8.setText("Salary Month:");
97 |
98 | salaryMonth.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
99 | salaryMonth.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Jan", "Feb", "Mar", "Aprl", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" }));
100 | salaryMonth.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
101 |
102 | salaryDays.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
103 | salaryDays.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
104 | salaryDays.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
105 |
106 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
107 | this.setLayout(layout);
108 | layout.setHorizontalGroup(
109 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
110 | .addGroup(layout.createSequentialGroup()
111 | .addContainerGap()
112 | .addComponent(jLabel1)
113 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
114 | .addGroup(layout.createSequentialGroup()
115 | .addGap(49, 49, 49)
116 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
117 | .addComponent(generateSlipButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
118 | .addGroup(layout.createSequentialGroup()
119 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
120 | .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
121 | .addComponent(jLabel5)
122 | .addGap(111, 111, 111)
123 | .addComponent(salaryDays, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
124 | .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
125 | .addComponent(jLabel4)
126 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
127 | .addComponent(idTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
128 | .addGroup(layout.createSequentialGroup()
129 | .addComponent(jLabel6)
130 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 85, Short.MAX_VALUE)
131 | .addComponent(advanceTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
132 | .addGroup(layout.createSequentialGroup()
133 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
134 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
135 | .addComponent(jLabel7)
136 | .addGap(74, 74, 74))
137 | .addGroup(layout.createSequentialGroup()
138 | .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
139 | .addGap(44, 44, 44)))
140 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
141 | .addComponent(deductionTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)
142 | .addComponent(salaryMonth, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
143 | .addGap(0, 324, Short.MAX_VALUE)))
144 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
145 | .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 601, javax.swing.GroupLayout.PREFERRED_SIZE)
146 | .addGap(29, 29, 29))
147 | );
148 | layout.setVerticalGroup(
149 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
150 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
151 | .addContainerGap()
152 | .addComponent(jLabel1)
153 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 97, Short.MAX_VALUE)
154 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
155 | .addGroup(layout.createSequentialGroup()
156 | .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 457, javax.swing.GroupLayout.PREFERRED_SIZE)
157 | .addGap(80, 80, 80))
158 | .addGroup(layout.createSequentialGroup()
159 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
160 | .addComponent(jLabel4)
161 | .addComponent(idTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
162 | .addGap(45, 45, 45)
163 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
164 | .addComponent(jLabel5)
165 | .addComponent(salaryDays, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
166 | .addGap(46, 46, 46)
167 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
168 | .addComponent(jLabel6)
169 | .addComponent(advanceTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
170 | .addGap(56, 56, 56)
171 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
172 | .addComponent(jLabel7)
173 | .addComponent(deductionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
174 | .addGap(59, 59, 59)
175 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
176 | .addComponent(jLabel8)
177 | .addComponent(salaryMonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
178 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
179 | .addComponent(generateSlipButton, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
180 | .addGap(67, 67, 67))))
181 | );
182 | }// //GEN-END:initComponents
183 |
184 | private void generateSlipButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateSlipButtonActionPerformed
185 | try{
186 | java.util.Calendar cal = new java.util.GregorianCalendar();
187 | SalaryHandling.Save(new SalarySlipClass(Integer.parseInt(idTextField.getText()),
188 | "", "", salaryMonth.getSelectedItem().toString(),
189 | Integer.parseInt(salaryDays.getSelectedItem().toString()),
190 | Double.parseDouble(advanceTextField.getText()),
191 | Double.parseDouble(deductionTextField.getText()), 1,
192 | cal.getTime().toString()));
193 |
194 | }catch(NumberFormatException e){
195 | JOptionPane.showMessageDialog(null, "Invalid Data Entered.");
196 | }
197 | }//GEN-LAST:event_generateSlipButtonActionPerformed
198 |
199 |
200 |
201 | // Variables declaration - do not modify//GEN-BEGIN:variables
202 | private javax.swing.JTextField advanceTextField;
203 | private javax.swing.JTextField deductionTextField;
204 | private javax.swing.JButton generateSlipButton;
205 | private javax.swing.JTextField idTextField;
206 | private javax.swing.JLabel jLabel1;
207 | private javax.swing.JLabel jLabel2;
208 | private javax.swing.JLabel jLabel4;
209 | private javax.swing.JLabel jLabel5;
210 | private javax.swing.JLabel jLabel6;
211 | private javax.swing.JLabel jLabel7;
212 | private javax.swing.JLabel jLabel8;
213 | private javax.swing.JComboBox salaryDays;
214 | private javax.swing.JComboBox salaryMonth;
215 | // End of variables declaration//GEN-END:variables
216 | }
217 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/dailywork/DailyTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.dailywork;
13 |
14 | /**
15 | * @version 1.10 25 Aug 2017
16 | * @author Hamza Yasin
17 | */
18 | public class DailyTask {
19 | private int id;
20 | private String attndnc;
21 | private String work;
22 | private String assignDate;
23 | private String assignStatus;
24 |
25 | /* Constructor */
26 |
27 | public DailyTask(int id, String attndnc, String work, String assignDate, String assignStatus) {
28 | setId(id);
29 | setAttndnc(attndnc);
30 | setWork(work);
31 | setAssignDate(assignDate);
32 | setAssignStatus(assignStatus);
33 | }
34 |
35 | public boolean setId(int id) {
36 | if (id > 0)
37 | this.id = id;
38 | else {
39 | this.id = id *-1;
40 | throw new IllegalArgumentException("Employee ID must be in positive Integers.");
41 | }
42 | return true;
43 | }
44 |
45 |
46 | public void setAttndnc(String attndnc) {
47 | if (!attndnc.equals("Choose"))
48 | this.attndnc = attndnc;
49 | else
50 | this.attndnc = "Wrong Selection";
51 | }
52 |
53 | public void setWork(String work) {
54 | this.work = work;
55 | }
56 |
57 | public void setAssignDate(String assignDatel) {
58 | this.assignDate = assignDatel;
59 | }
60 |
61 | public void setAssignStatus(String assignStatus) {
62 | this.assignStatus = assignStatus;
63 | }
64 |
65 | public int getId() {
66 | return id;
67 | }
68 |
69 | public String getAttndnc() {
70 | return attndnc;
71 | }
72 |
73 | public String getWork() {
74 | return work;
75 | }
76 |
77 | public String getAssignDate() {
78 | return assignDate;
79 | }
80 |
81 | public String getAssignStatus() {
82 | return assignStatus;
83 | }
84 |
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/dailywork/DailyTaskHandling.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.dailywork;
13 |
14 | import gamemarkstudiio.DataConnection.ConnectionClass;
15 | import java.sql.ResultSet;
16 | import java.sql.SQLException;
17 | import java.util.ArrayList;
18 |
19 | /**
20 | * This class is written to handle the methods of class DailyTask.
21 | * @version 1.10 25 Aug 2017
22 | * @author Hamza Yasin
23 | */
24 |
25 | public class DailyTaskHandling {
26 |
27 | private static ArrayList dailylist = new ArrayList();
28 | /* Loading the data from database*/
29 | public static boolean Load()
30 | {
31 | if(!dailylist.isEmpty())
32 | return false;
33 | ResultSet resultSet = ConnectionClass.selectQuery("select * from dailywork;");
34 | try{
35 | while(resultSet.next()){
36 | dailylist.add(new DailyTask(Integer.parseInt(resultSet.getObject(1).toString()),
37 | resultSet.getObject(2).toString(),
38 | resultSet.getObject(3).toString(),
39 | resultSet.getString(4),
40 | resultSet.getString(5)));
41 | }
42 | System.out.println("loaded with size of " + dailylist.size());
43 | }catch(SQLException e){
44 | e.getMessage();
45 | }
46 | return true;
47 |
48 | }
49 | /* Saving data in database*/
50 | public static void Save(DailyTask dt) {
51 | try {
52 | // unique(dt); (sr, attndnc, work, assignTime, assignStatus)"
53 | ConnectionClass.query("insert into dailywork " +
54 | "values ("+ dt.getId()+", '"
55 | + dt.getAttndnc()+"', '"
56 | +dt.getWork()+"', '"
57 | +dt.getAssignDate()+"', '"
58 | +dt.getAssignStatus()+"');");
59 | dailylist.add(dt);
60 | }catch(IllegalArgumentException e){
61 | e.getMessage();
62 | throw new IllegalArgumentException("Employee Against this id don't exist");
63 | }
64 | }
65 | /* Deleting single data from database*/
66 | public static void DeleteRecord(DailyTask dt)
67 | {
68 | try {
69 | Load();
70 | ConnectionClass.query("DELETE FROM dailwork WHERE sr = "+ dt.getId() + ";");
71 | }catch(Exception e)
72 | {
73 | throw new IllegalArgumentException(e.getMessage());
74 | }
75 | }
76 | /* Deleting the whole data from database*/
77 | public static void DeleteAllData(DailyTask dt)
78 | {
79 | try {
80 | Load();
81 | for (int i = 0; i< dailylist.size(); i++){
82 | ConnectionClass.query("DELETE FROM personalinfo WHERE sr = "+ dailylist.get(i).getId() + ";");
83 | }
84 | }catch(Exception e)
85 | {
86 | throw new IllegalArgumentException(e.getMessage());
87 | }
88 |
89 | }
90 | /* Cleaing the ArrayList*/
91 | public static void arrayDispose()
92 | {
93 | dailylist.clear();
94 | }
95 | /* Getting the data in ArrayList*/
96 | public static ArrayList getArray()
97 | {
98 | return dailylist;
99 | }
100 | /* Updating data in database*/
101 | public static void UpdateRecord(DailyTask dt)
102 | {
103 | try {
104 | Load();
105 | ConnectionClass.query("UPDATE dailywork SET attndnc = '" + dt.getAttndnc()
106 | + "',work = '"
107 | + dt.getWork()
108 | + "'WHERE sr = "
109 | + dt.getId() +" ;");
110 | }catch(Exception e)
111 | {
112 | throw new IllegalArgumentException(e.getMessage());
113 | }
114 |
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/dailywork/DailyWorkPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
227 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/dailywork/DailyWorkPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.dailywork;
13 |
14 | import java.awt.HeadlessException;
15 | import javax.swing.JOptionPane;
16 | /*
17 | * @version 1.10 25 Aug 2017
18 | * @author Hamza Yasin
19 | */
20 | public class DailyWorkPanel extends javax.swing.JPanel {
21 |
22 | /**
23 | * Creates new form DailyWorkPanel
24 | */
25 | public DailyWorkPanel() {
26 | initComponents();
27 | DailyTaskHandling.Load();
28 | }
29 |
30 | /**
31 | * This method is called from within the constructor to initialize the form.
32 | * WARNING: Do NOT modify this code. The content of this method is always
33 | * regenerated by the Form Editor.
34 | */
35 | @SuppressWarnings("unchecked")
36 | // //GEN-BEGIN:initComponents
37 | private void initComponents() {
38 |
39 | jLabel2 = new javax.swing.JLabel();
40 | jLabel1 = new javax.swing.JLabel();
41 | jLabel3 = new javax.swing.JLabel();
42 | jLabel4 = new javax.swing.JLabel();
43 | idTextField = new javax.swing.JTextField();
44 | jLabel5 = new javax.swing.JLabel();
45 | attendenceTextField = new javax.swing.JTextField();
46 | jLabel6 = new javax.swing.JLabel();
47 | jScrollPane1 = new javax.swing.JScrollPane();
48 | workTextPane = new javax.swing.JTextPane();
49 | jButton1 = new javax.swing.JButton();
50 | clearButton = new javax.swing.JButton();
51 |
52 | jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
53 | jLabel2.setText("ID: ");
54 |
55 | setBackground(new java.awt.Color(255, 255, 255));
56 |
57 | jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
58 | jLabel1.setForeground(new java.awt.Color(0, 102, 204));
59 | jLabel1.setText("Daily Work");
60 | jLabel1.setToolTipText("");
61 |
62 | jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gamemarkstudio/images/animation-employee.gif"))); // NOI18N
63 |
64 | jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
65 | jLabel4.setText("ID: ");
66 |
67 | idTextField.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
68 | idTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
69 |
70 | jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
71 | jLabel5.setText("Attendence:");
72 |
73 | attendenceTextField.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
74 | attendenceTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
75 |
76 | jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
77 | jLabel6.setText("Daily Work:");
78 |
79 | workTextPane.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
80 | jScrollPane1.setViewportView(workTextPane);
81 |
82 | jButton1.setBackground(new java.awt.Color(255, 255, 255));
83 | jButton1.setFont(new java.awt.Font("Tahoma", 1, 17)); // NOI18N
84 | jButton1.setForeground(new java.awt.Color(0, 102, 0));
85 | jButton1.setText("Submit");
86 | jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
87 | jButton1.addActionListener(new java.awt.event.ActionListener() {
88 | public void actionPerformed(java.awt.event.ActionEvent evt) {
89 | jButton1ActionPerformed(evt);
90 | }
91 | });
92 |
93 | clearButton.setBackground(new java.awt.Color(255, 255, 255));
94 | clearButton.setFont(new java.awt.Font("Tahoma", 1, 17)); // NOI18N
95 | clearButton.setForeground(new java.awt.Color(153, 0, 0));
96 | clearButton.setText("Clear");
97 | clearButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
98 | clearButton.addActionListener(new java.awt.event.ActionListener() {
99 | public void actionPerformed(java.awt.event.ActionEvent evt) {
100 | clearButtonActionPerformed(evt);
101 | }
102 | });
103 |
104 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
105 | this.setLayout(layout);
106 | layout.setHorizontalGroup(
107 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
108 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
109 | .addGap(42, 42, 42)
110 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
111 | .addGroup(layout.createSequentialGroup()
112 | .addGap(8, 8, 8)
113 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
114 | .addComponent(jLabel5)
115 | .addComponent(jLabel6)
116 | .addComponent(jLabel4))
117 | .addGap(37, 37, 37))
118 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
119 | .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
120 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
121 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
122 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
123 | .addComponent(attendenceTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
124 | .addComponent(clearButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
125 | .addComponent(idTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
126 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 445, javax.swing.GroupLayout.PREFERRED_SIZE))
127 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 130, Short.MAX_VALUE)
128 | .addComponent(jLabel3)
129 | .addGap(52, 52, 52))
130 | .addGroup(layout.createSequentialGroup()
131 | .addContainerGap()
132 | .addComponent(jLabel1)
133 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
134 | );
135 | layout.setVerticalGroup(
136 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
137 | .addGroup(layout.createSequentialGroup()
138 | .addContainerGap()
139 | .addComponent(jLabel1)
140 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
141 | .addGroup(layout.createSequentialGroup()
142 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
143 | .addComponent(jLabel3)
144 | .addGap(48, 48, 48))
145 | .addGroup(layout.createSequentialGroup()
146 | .addGap(149, 149, 149)
147 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
148 | .addComponent(jLabel4)
149 | .addComponent(idTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
150 | .addGap(69, 69, 69)
151 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
152 | .addComponent(jLabel5)
153 | .addComponent(attendenceTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
154 | .addGap(69, 69, 69)
155 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
156 | .addComponent(jLabel6)
157 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
158 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 106, Short.MAX_VALUE)
159 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
160 | .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
161 | .addComponent(clearButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
162 | .addGap(79, 79, 79))))
163 | );
164 | }// //GEN-END:initComponents
165 |
166 | private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed
167 | // TODO add your handling code here:
168 | idTextField.setText("");
169 | attendenceTextField.setText("");
170 | workTextPane.setText("");
171 | }//GEN-LAST:event_clearButtonActionPerformed
172 |
173 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
174 | try{
175 | DailyTaskHandling.Save(getData());
176 | JOptionPane.showMessageDialog(null, "Daily Work Posted");
177 | }catch(HeadlessException e){
178 | JOptionPane.showMessageDialog(null, "Not Posted. " + e.getMessage());
179 | }
180 | }//GEN-LAST:event_jButton1ActionPerformed
181 |
182 | public DailyTask getData(){
183 | int id = Integer.parseInt(idTextField.getText());
184 |
185 | String attndnc = attendenceTextField.getText();
186 | String work = workTextPane.getText();
187 | java.util.Calendar cal = new java.util.GregorianCalendar();
188 | return new DailyTask(id, attndnc, work, cal.getTime().toString(), "Not Available");
189 | }
190 |
191 |
192 | // Variables declaration - do not modify//GEN-BEGIN:variables
193 | private javax.swing.JTextField attendenceTextField;
194 | private javax.swing.JButton clearButton;
195 | private javax.swing.JTextField idTextField;
196 | private javax.swing.JButton jButton1;
197 | private javax.swing.JLabel jLabel1;
198 | private javax.swing.JLabel jLabel2;
199 | private javax.swing.JLabel jLabel3;
200 | private javax.swing.JLabel jLabel4;
201 | private javax.swing.JLabel jLabel5;
202 | private javax.swing.JLabel jLabel6;
203 | private javax.swing.JScrollPane jScrollPane1;
204 | private javax.swing.JTextPane workTextPane;
205 | // End of variables declaration//GEN-END:variables
206 | }
207 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/1.png
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/15780805_592901627582475_404159619298736519_n.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/15780805_592901627582475_404159619298736519_n.jpg
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/Animated-American-Money-Falling-Into-a-Pile.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/Animated-American-Money-Falling-Into-a-Pile.jpg
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/Home.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/Home.PNG
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/Teacher-and-students-by-algogenius.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/Teacher-and-students-by-algogenius.jpg
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/Update.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/Update.png
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/animation-employee.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/animation-employee.gif
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/blank-profile-head-hi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/blank-profile-head-hi.png
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/icon2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/icon2.png
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/newUpdate.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/newUpdate.jpg
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/sad-face.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/sad-face.png
--------------------------------------------------------------------------------
/src/gamemarkstudio/images/url.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/images/url.jpg
--------------------------------------------------------------------------------
/src/gamemarkstudio/login/Login.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
214 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/login/Login.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.login;
13 |
14 | import gamemarkstudio.mainframe.MainOfficeManagement;
15 | import javax.swing.JOptionPane;
16 |
17 | /*
18 | * @version 1.10 25 Aug 2017
19 | * @author Hamza Yasin
20 | */
21 |
22 | public class Login extends javax.swing.JFrame {
23 |
24 | public Login() {
25 | initComponents();
26 | }
27 | @SuppressWarnings("unchecked")
28 | // //GEN-BEGIN:initComponents
29 | private void initComponents() {
30 |
31 | jPanel1 = new javax.swing.JPanel();
32 | jLabel1 = new javax.swing.JLabel();
33 | jLabel2 = new javax.swing.JLabel();
34 | jLabel3 = new javax.swing.JLabel();
35 | usernameTextField = new javax.swing.JTextField();
36 | PasswordField = new javax.swing.JPasswordField();
37 | jButton1 = new javax.swing.JButton();
38 | forgotPasswordButton = new javax.swing.JButton();
39 | forgotPasswordButton1 = new javax.swing.JButton();
40 | jSeparator1 = new javax.swing.JSeparator();
41 |
42 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
43 |
44 | jPanel1.setBackground(new java.awt.Color(255, 255, 255));
45 |
46 | jLabel1.setFont(new java.awt.Font("Trajan Pro", 1, 22)); // NOI18N
47 | jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gamemarkstudio/images/1.png"))); // NOI18N
48 | jLabel1.setText(" Game Mark Studio");
49 |
50 | jLabel2.setFont(new java.awt.Font("Tahoma", 0, 19)); // NOI18N
51 | jLabel2.setText("Username:");
52 |
53 | jLabel3.setFont(new java.awt.Font("Tahoma", 0, 19)); // NOI18N
54 | jLabel3.setText("Password:");
55 |
56 | usernameTextField.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
57 | usernameTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
58 |
59 | PasswordField.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
60 | PasswordField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
61 |
62 | jButton1.setBackground(new java.awt.Color(255, 255, 255));
63 | jButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
64 | jButton1.setForeground(new java.awt.Color(0, 102, 0));
65 | jButton1.setText("Login");
66 | jButton1.setToolTipText("");
67 | jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
68 | jButton1.addActionListener(new java.awt.event.ActionListener() {
69 | public void actionPerformed(java.awt.event.ActionEvent evt) {
70 | jButton1ActionPerformed(evt);
71 | }
72 | });
73 |
74 | forgotPasswordButton.setBackground(new java.awt.Color(255, 255, 255));
75 | forgotPasswordButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
76 | forgotPasswordButton.setForeground(new java.awt.Color(153, 0, 0));
77 | forgotPasswordButton.setText("Forgot Password ?");
78 | forgotPasswordButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
79 | forgotPasswordButton.addActionListener(new java.awt.event.ActionListener() {
80 | public void actionPerformed(java.awt.event.ActionEvent evt) {
81 | forgotPasswordButtonActionPerformed(evt);
82 | }
83 | });
84 |
85 | forgotPasswordButton1.setBackground(new java.awt.Color(255, 255, 255));
86 | forgotPasswordButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
87 | forgotPasswordButton1.setText("Close");
88 | forgotPasswordButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
89 | forgotPasswordButton1.addActionListener(new java.awt.event.ActionListener() {
90 | public void actionPerformed(java.awt.event.ActionEvent evt) {
91 | forgotPasswordButton1ActionPerformed(evt);
92 | }
93 | });
94 |
95 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
96 | jPanel1.setLayout(jPanel1Layout);
97 | jPanel1Layout.setHorizontalGroup(
98 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
99 | .addComponent(jSeparator1)
100 | .addGroup(jPanel1Layout.createSequentialGroup()
101 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
102 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
103 | .addGap(0, 0, Short.MAX_VALUE)
104 | .addComponent(forgotPasswordButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
105 | .addGroup(jPanel1Layout.createSequentialGroup()
106 | .addGap(100, 100, 100)
107 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
108 | .addComponent(jLabel2)
109 | .addComponent(jLabel3))
110 | .addGap(62, 62, 62)
111 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
112 | .addGroup(jPanel1Layout.createSequentialGroup()
113 | .addComponent(forgotPasswordButton)
114 | .addGap(18, 18, 18)
115 | .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
116 | .addComponent(PasswordField)
117 | .addComponent(usernameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 283, javax.swing.GroupLayout.PREFERRED_SIZE))
118 | .addGap(0, 195, Short.MAX_VALUE))
119 | .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
120 | .addContainerGap())
121 | );
122 | jPanel1Layout.setVerticalGroup(
123 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
124 | .addGroup(jPanel1Layout.createSequentialGroup()
125 | .addContainerGap()
126 | .addComponent(jLabel1)
127 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
128 | .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
129 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 56, Short.MAX_VALUE)
130 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
131 | .addComponent(jLabel2)
132 | .addComponent(usernameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
133 | .addGap(40, 40, 40)
134 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
135 | .addComponent(jLabel3)
136 | .addComponent(PasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
137 | .addGap(18, 18, 18)
138 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
139 | .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
140 | .addComponent(forgotPasswordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
141 | .addGap(18, 18, 18)
142 | .addComponent(forgotPasswordButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
143 | .addGap(18, 18, 18))
144 | );
145 |
146 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
147 | getContentPane().setLayout(layout);
148 | layout.setHorizontalGroup(
149 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
150 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
151 | );
152 | layout.setVerticalGroup(
153 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
154 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
155 | );
156 |
157 | pack();
158 | setLocationRelativeTo(null);
159 | }// //GEN-END:initComponents
160 |
161 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
162 | access();
163 | }//GEN-LAST:event_jButton1ActionPerformed
164 |
165 | private void forgotPasswordButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_forgotPasswordButton1ActionPerformed
166 | System.exit(0);
167 | }//GEN-LAST:event_forgotPasswordButton1ActionPerformed
168 |
169 | private void forgotPasswordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_forgotPasswordButtonActionPerformed
170 | this.setVisible(false);
171 | new ForgotPassword(this, true, this).setVisible(true);
172 | }//GEN-LAST:event_forgotPasswordButtonActionPerformed
173 |
174 |
175 | public void access()
176 | {
177 | if (LoginHandling.access(usernameTextField.getText(),PasswordField.getText()))
178 | {
179 | new MainOfficeManagement(this, usernameTextField.getText()).setVisible(true);
180 | this.dispose();
181 |
182 | }
183 | else
184 | JOptionPane.showMessageDialog(null, "Invalid Username or Password");
185 |
186 | }
187 |
188 | // Variables declaration - do not modify//GEN-BEGIN:variables
189 | private javax.swing.JPasswordField PasswordField;
190 | private javax.swing.JButton forgotPasswordButton;
191 | private javax.swing.JButton forgotPasswordButton1;
192 | private javax.swing.JButton jButton1;
193 | private javax.swing.JLabel jLabel1;
194 | private javax.swing.JLabel jLabel2;
195 | private javax.swing.JLabel jLabel3;
196 | private javax.swing.JPanel jPanel1;
197 | private javax.swing.JSeparator jSeparator1;
198 | private javax.swing.JTextField usernameTextField;
199 | // End of variables declaration//GEN-END:variables
200 | }
201 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/login/LoginHandling.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.login;
13 |
14 | import gamemarkstudiio.DataConnection.ConnectionClass;
15 | import java.sql.ResultSet;
16 | import java.sql.SQLException;
17 | import java.util.ArrayList;
18 | /**
19 | * This class is written to handle the methods of class Login_1.
20 | * @version 1.10 25 Aug 2017
21 | * @author Hamza Yasin
22 | */
23 | public class LoginHandling {
24 |
25 | private static ArrayList loginList = new ArrayList();
26 | /* Loading the data from database*/
27 | public static boolean load()
28 | {
29 | if (!loginList.isEmpty())
30 | return false;
31 |
32 | ResultSet resultSet = ConnectionClass.selectQuery("SELECT * FROM login;");
33 |
34 | if(resultSet == null)
35 | return false;
36 |
37 | try{
38 | while(resultSet.next()){
39 |
40 | loginList.add(new Login_1(Integer.parseInt(resultSet.getObject(1).toString()),resultSet.getObject(2).toString(),
41 | resultSet.getObject(3).toString(),resultSet.getObject(4).toString(), resultSet.getObject(5).toString(),
42 | resultSet.getObject(6).toString(), resultSet.getObject(7).toString(), resultSet.getObject(8).toString()));
43 | }
44 | System.out.println("loaded with size of " + loginList.size());
45 | }catch(SQLException e){
46 | }
47 | return true;
48 | }
49 | /* Generating the unique Login ID*/
50 | public static int LoginID()
51 | {
52 | if (!loginList.isEmpty())
53 | return loginList.get(loginList.size()-1).getSr()+1;
54 | else
55 | return 1;
56 |
57 | }
58 | /* Getting Access to the login */
59 | public static boolean access(String user, String pass)
60 | {
61 | load();
62 | for(int i=0; i search(String search)
161 | {
162 | load();
163 | ArrayList send = new ArrayList<>();
164 | for (int i =0; i < loginList.size();i++){
165 | if (loginList.get(i).getLogin().toUpperCase().contains(search.toUpperCase()))
166 | send.add(loginList.get(i));
167 | }
168 | arrayDispose();
169 | return send;
170 | }
171 |
172 | public static void arrayDispose()
173 | {
174 | loginList.clear();
175 | }
176 |
177 | /*Unique Check of ID*/
178 | private static void uniqueCheck(Login_1 login)
179 | {
180 | for(int i=0; i getArray()
218 | {
219 | return loginList;
220 | }
221 | }
222 |
223 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/login/Login_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.login;
13 | /**
14 | * @version 1.10 25 Aug 2017
15 | * @author Hamza Yasin
16 | */
17 | public class Login_1 {
18 |
19 | private int sr = 1;
20 | private String login;
21 | private String password;
22 | private String question;
23 | private String answer;
24 | private String name;
25 | private String status;
26 | private String dateTime;
27 | /* Constructor */
28 | public Login_1( int sr, String login, String password, String question, String answer, String name, String status, String time)
29 | {
30 | setSr(sr);
31 | setLogin(login);
32 | setPassword(password);
33 | setQuestion(question);
34 | setAnswer(answer);
35 | setName(name);
36 | setStatus(status);
37 | setDateTime(time);
38 |
39 | }
40 |
41 | public Login_1(String question, String ans) {
42 | setQuestion(question);
43 | setAnswer(ans);
44 | }
45 |
46 | public void setDateTime(String time)
47 | {
48 | this.dateTime = time;
49 | }
50 |
51 | public void setSr(int sr)
52 | {
53 | this.sr = sr;
54 | }
55 |
56 | public void setAnswer(String answer) {
57 | this.answer = answer;
58 | }
59 |
60 | public void setName(String name) {
61 | this.name = name;
62 | }
63 |
64 | public void setStatus(String status) {
65 | this.status = status;
66 | }
67 |
68 | public void setQuestion( String question)
69 | {
70 | this.question = question;
71 | }
72 | public boolean setLogin(String log)
73 | {
74 | login = log;
75 | return true;
76 | }
77 |
78 | public boolean setPassword(String pass)
79 | {
80 | password = pass;
81 | return true;
82 | }
83 |
84 | public String getLogin()
85 | {
86 | return login;
87 | }
88 |
89 | public String getPassword()
90 | {
91 | return password;
92 | }
93 |
94 | public String getAnswer() {
95 | return answer;
96 | }
97 |
98 | public String getName() {
99 | return name;
100 | }
101 |
102 | public String getStatus() {
103 | return status;
104 | }
105 |
106 | public String getQuestion() {
107 | return question;
108 | }
109 |
110 | public int getSr()
111 | {
112 | return sr ;
113 | }
114 | public String getDateTime()
115 | {
116 | return dateTime;
117 | }
118 |
119 |
120 |
121 | }
122 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/mainframe/FontPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
68 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/mainframe/FontPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.mainframe;
13 | /*
14 | * @version 1.10 25 Aug 2017
15 | * @author Hamza Yasin
16 | */
17 | public class FontPanel extends javax.swing.JPanel {
18 |
19 | /**
20 | * Creates new form FontPanel
21 | */
22 | public FontPanel() {
23 | initComponents();
24 | }
25 |
26 | /**
27 | * This method is called from within the constructor to initialize the form.
28 | * WARNING: Do NOT modify this code. The content of this method is always
29 | * regenerated by the Form Editor.
30 | */
31 | @SuppressWarnings("unchecked")
32 | // //GEN-BEGIN:initComponents
33 | private void initComponents() {
34 |
35 | jLabel1 = new javax.swing.JLabel();
36 | jLabel2 = new javax.swing.JLabel();
37 |
38 | setBackground(new java.awt.Color(255, 255, 255));
39 |
40 | jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gamemarkstudio/images/Home.PNG"))); // NOI18N
41 |
42 | jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gamemarkstudio/images/1.png"))); // NOI18N
43 |
44 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
45 | this.setLayout(layout);
46 | layout.setHorizontalGroup(
47 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
48 | .addGroup(layout.createSequentialGroup()
49 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
50 | .addGroup(layout.createSequentialGroup()
51 | .addGap(47, 47, 47)
52 | .addComponent(jLabel1))
53 | .addGroup(layout.createSequentialGroup()
54 | .addGap(551, 551, 551)
55 | .addComponent(jLabel2)))
56 | .addContainerGap(57, Short.MAX_VALUE))
57 | );
58 | layout.setVerticalGroup(
59 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
60 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
61 | .addContainerGap(194, Short.MAX_VALUE)
62 | .addComponent(jLabel2)
63 | .addGap(39, 39, 39)
64 | .addComponent(jLabel1)
65 | .addGap(271, 271, 271))
66 | );
67 | }// //GEN-END:initComponents
68 |
69 |
70 | // Variables declaration - do not modify//GEN-BEGIN:variables
71 | private javax.swing.JLabel jLabel1;
72 | private javax.swing.JLabel jLabel2;
73 | // End of variables declaration//GEN-END:variables
74 | }
75 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/newemployeepane/PersonalHandling.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.newemployeepane;
13 |
14 | import gamemarkstudiio.DataConnection.ConnectionClass;
15 | import gamemarkstudio.login.LoginHandling;
16 | import java.sql.PreparedStatement;
17 | import java.sql.ResultSet;
18 | import java.sql.SQLException;
19 | import java.util.ArrayList;
20 |
21 |
22 | /*
23 | * @version 1.10 25 Aug 2017
24 | * @author Hamza Yasin
25 | */
26 | public class PersonalHandling {
27 |
28 | private static ArrayList pi = new ArrayList();
29 | public static boolean Load()
30 | {
31 | if(!pi.isEmpty())
32 | return false;
33 |
34 | ResultSet resultSet = ConnectionClass.selectQuery("select * from personalinfo;");
35 |
36 | try{
37 | while(resultSet.next()){
38 | pi.add(new PersonalInfo(Integer.parseInt(resultSet.getObject(1).toString()), resultSet.getObject(2).toString(),
39 | resultSet.getObject(3).toString(),resultSet.getObject(4).toString(), resultSet.getObject(5).toString(),
40 | resultSet.getObject(6).toString(),resultSet.getObject(7).toString(), resultSet.getObject(8).toString()
41 | , resultSet.getObject(9).toString(), resultSet.getBytes(10), resultSet.getObject(11).toString(),
42 | Double.parseDouble(resultSet.getObject(12).toString()), resultSet.getObject(13).toString()));
43 | }
44 | System.out.println("loaded with size of " + pi.size());
45 | }catch(SQLException e){
46 | }
47 | return true;
48 |
49 | }
50 | public static int EmplyeeID()
51 | {
52 | if (!pi.isEmpty())
53 | return pi.get(pi.size()-1).getId()+1;
54 | else
55 | return 1;
56 |
57 | }
58 |
59 | public static void Save(PersonalInfo pi1) throws SQLException
60 | {
61 | try {
62 |
63 | unique(pi1);
64 | PreparedStatement ps= ConnectionClass.getPreStatement("insert into personalinfo(id, name, phone, cnic, emrgnc_name, emrgnc_phone, address, dob, email, emp_pic, post, salary, timing)" +
65 | "values ( ?,?,?,?,?,?,?,?,?,?,?,?,? )");
66 | ps.setInt(1, pi1.getId());
67 | ps.setString(2, pi1.getName());
68 | ps.setString(3, pi1.getPhone());
69 | ps.setString(4, pi1.getCnic());
70 | ps.setString(5, pi1.geteName());
71 | ps.setString(6, pi1.getePhone());
72 | ps.setString(7, pi1.getAddress());
73 | ps.setString(8, pi1.getDob());
74 | ps.setString(9, pi1.getEmail());
75 | ps.setBytes(10, pi1.getPic());
76 | ps.setString(11,pi1.getPost());
77 | ps.setDouble(12, pi1.getSalary());
78 | ps.setString(13, pi1.getTiming());
79 |
80 | ps.execute();
81 | }catch(IllegalArgumentException e){
82 |
83 | throw new IllegalArgumentException(e.getMessage() + "Record not saved");
84 | }
85 |
86 | }
87 |
88 | public static void unique(PersonalInfo pi1)
89 | {
90 | for (int i = 0; i < pi.size(); i ++)
91 | {
92 | if (pi1.getId() == pi.get(i).getId())
93 | throw new IllegalArgumentException("Record against this ID '"+pi1.getId()+"' is already exist ");
94 | }
95 | }
96 |
97 | public static void arrayDispose()
98 | {
99 | pi.clear();
100 | }
101 |
102 | public static PersonalInfo searchByID(int id)
103 | {
104 | try
105 | {
106 | Load();
107 | for(int i=0; i search(String search)
117 | {
118 | Load();
119 | ArrayList send = new ArrayList();
120 |
121 | for (int i = 0; i < pi.size(); i++)
122 | {
123 | if (String.valueOf(pi.get(i).getId()).toUpperCase().contains(search.toUpperCase()))
124 | send.add(pi.get(i));
125 | else if (pi.get(i).getName().toUpperCase().contains(search.toUpperCase()))
126 | send.add(pi.get(i));
127 | else if (String.valueOf(pi.get(i).getPhone()).toUpperCase().contains(search.toUpperCase()))
128 | send.add(pi.get(i));
129 | }
130 | arrayDispose();
131 | return send;
132 |
133 | }
134 | public static ArrayList getArray()
135 | {
136 | return pi;
137 | }
138 |
139 | public static void UpdateRecord(PersonalInfo pi1)
140 | {
141 | try {
142 |
143 | Load();
144 |
145 | PreparedStatement ps= ConnectionClass.getPreStatement("Update personalinfo SET name = ?, phone = ? , cnic = ?, "
146 | + "emrgnc_name = ?, emrgnc_phone = ? , address = ? , dob = ?, email = ?, emp_pic = ? , post = ?, salary = ?, timing = ? where id = "+pi1.getId());
147 |
148 | ps.setString(1, pi1.getName());
149 | ps.setString(2, pi1.getPhone());
150 | ps.setString(3, pi1.getCnic());
151 | ps.setString(4, pi1.geteName());
152 | ps.setString(5, pi1.getePhone());
153 | ps.setString(6, pi1.getAddress());
154 | ps.setString(7, pi1.getDob());
155 | ps.setString(8, pi1.getEmail());
156 | ps.setBytes(9, pi1.getPic());
157 | ps.setString(10,pi1.getPost());
158 | ps.setDouble(11, pi1.getSalary());
159 | ps.setString(12, pi1.getTiming());
160 |
161 | ps.execute();
162 |
163 | for(int i=0; i 0)
59 | this.id = id;
60 | else {
61 | this.id = id *-1;
62 | throw new IllegalArgumentException("Employee ID must be in positive Integers.");
63 | }
64 | return true;
65 | }
66 |
67 | public void setPost(String post) {
68 | this.post = post;
69 | }
70 |
71 | public boolean setSalary(double salary) {
72 | if(salary > 0)
73 | this.salary = salary;
74 | else
75 | throw new IllegalArgumentException("Salary must be in positive Integers.");
76 | return true;
77 | }
78 |
79 | public void setTiming(String timing) {
80 | this.timing = timing;
81 | }
82 |
83 |
84 | public void setName(String name) {
85 | this.name = name;
86 | }
87 |
88 | public void setAddress(String address) {
89 | this.address = address;
90 | }
91 |
92 | public void setCnic(String cnic) {
93 |
94 | this.cnic = cnic;
95 |
96 | }
97 |
98 | public void setPhone(String phone) {
99 | this.phone = phone;
100 | }
101 |
102 | public void seteName(String eName) {
103 | this.eName = eName;
104 | }
105 |
106 | public void setePhone(String ePhone) {
107 | this.ePhone = ePhone;
108 |
109 | }
110 |
111 | public void setPic(byte[] pic) {
112 | this.pic = pic;
113 | }
114 |
115 | public void setDob(String dob) {
116 | this.dob = dob;
117 | }
118 |
119 | public void setEmail(String email) {
120 | this.email = email;
121 | }
122 |
123 |
124 | public int getId() {
125 | return id;
126 | }
127 |
128 | public String getName() {
129 | return name;
130 | }
131 |
132 | public String getAddress() {
133 | return address;
134 | }
135 |
136 | public String getCnic() {
137 | return cnic;
138 | }
139 |
140 | public String getPhone() {
141 | return phone;
142 | }
143 |
144 | public String geteName() {
145 | return eName;
146 | }
147 |
148 | public String getePhone() {
149 | return ePhone;
150 | }
151 |
152 | public byte [] getPic()
153 | {
154 | if(img != null)
155 | return img.toByteArray();
156 | else
157 | return pic;
158 | }
159 |
160 | public String getDob() {
161 | return dob;
162 | }
163 |
164 | public String getEmail() {
165 | return email;
166 | }
167 |
168 | public String getPost() {
169 | return post;
170 | }
171 |
172 | public double getSalary() {
173 | return salary;
174 | }
175 |
176 | public String getTiming() {
177 | return timing;
178 | }
179 |
180 |
181 |
182 |
183 |
184 |
185 | }
186 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/searchemployee/SearchEmployee.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
113 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/searchemployee/SearchEmployee.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.searchemployee;
13 |
14 | import gamemarkstudio.newemployeepane.PersonalHandling;
15 | import gamemarkstudio.newemployeepane.PersonalInfo;
16 | import java.util.ArrayList;
17 | import javax.swing.table.DefaultTableModel;
18 | /*
19 | * @version 1.10 25 Aug 2017
20 | * @author Hamza Yasin
21 | */
22 | public class SearchEmployee extends javax.swing.JPanel {
23 |
24 | /**
25 | * Creates new form SearchEmployee
26 | */
27 | DefaultTableModel model;
28 | public SearchEmployee() {
29 | initComponents();
30 | PersonalHandling.Load();
31 | updateTable(PersonalHandling.getArray());
32 | }
33 |
34 | /**
35 | * This method is called from within the constructor to initialize the form.
36 | * WARNING: Do NOT modify this code. The content of this method is always
37 | * regenerated by the Form Editor.
38 | */
39 | @SuppressWarnings("unchecked")
40 | // //GEN-BEGIN:initComponents
41 | private void initComponents() {
42 |
43 | jLabel1 = new javax.swing.JLabel();
44 | searchTextField = new javax.swing.JTextField();
45 | jScrollPane1 = new javax.swing.JScrollPane();
46 | updateEmployeeTable = new javax.swing.JTable();
47 |
48 | setBackground(new java.awt.Color(255, 255, 255));
49 |
50 | jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
51 | jLabel1.setForeground(new java.awt.Color(0, 102, 204));
52 | jLabel1.setText("Search Employee");
53 | jLabel1.setToolTipText("");
54 |
55 | searchTextField.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
56 | searchTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
57 | searchTextField.setText("Search");
58 | searchTextField.addFocusListener(new java.awt.event.FocusAdapter() {
59 | public void focusGained(java.awt.event.FocusEvent evt) {
60 | searchTextFieldFocusGained(evt);
61 | }
62 | public void focusLost(java.awt.event.FocusEvent evt) {
63 | searchTextFieldFocusLost(evt);
64 | }
65 | });
66 | searchTextField.addKeyListener(new java.awt.event.KeyAdapter() {
67 | public void keyReleased(java.awt.event.KeyEvent evt) {
68 | searchTextFieldKeyReleased(evt);
69 | }
70 | });
71 |
72 | updateEmployeeTable.setModel(new javax.swing.table.DefaultTableModel(
73 | new Object [][] {
74 |
75 | },
76 | new String [] {
77 | "ID", "Full Name", "Phone", "Address", "Cnic", "Emergency Name", "Emergency Phone", "Date of Birth", "Email", "Position", "Date of Hiring", "Salary"
78 | }
79 | ) {
80 | Class[] types = new Class [] {
81 | java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Double.class
82 | };
83 | boolean[] canEdit = new boolean [] {
84 | false, false, false, false, false, false, false, false, false, false, false, false
85 | };
86 |
87 | public Class getColumnClass(int columnIndex) {
88 | return types [columnIndex];
89 | }
90 |
91 | public boolean isCellEditable(int rowIndex, int columnIndex) {
92 | return canEdit [columnIndex];
93 | }
94 | });
95 | updateEmployeeTable.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
96 | jScrollPane1.setViewportView(updateEmployeeTable);
97 |
98 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
99 | this.setLayout(layout);
100 | layout.setHorizontalGroup(
101 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
102 | .addGroup(layout.createSequentialGroup()
103 | .addContainerGap()
104 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
105 | .addComponent(jLabel1)
106 | .addComponent(searchTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 1321, Short.MAX_VALUE)
107 | .addComponent(jScrollPane1))
108 | .addContainerGap(46, Short.MAX_VALUE))
109 | );
110 | layout.setVerticalGroup(
111 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
112 | .addGroup(layout.createSequentialGroup()
113 | .addContainerGap()
114 | .addComponent(jLabel1)
115 | .addGap(78, 78, 78)
116 | .addComponent(searchTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
117 | .addGap(41, 41, 41)
118 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
119 | .addContainerGap(40, Short.MAX_VALUE))
120 | );
121 | }// //GEN-END:initComponents
122 |
123 | private void searchTextFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchTextFieldFocusGained
124 | if(searchTextField.getText().equals("Search"))
125 | searchTextField.setText("");
126 | }//GEN-LAST:event_searchTextFieldFocusGained
127 |
128 | private void searchTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchTextFieldFocusLost
129 | if(searchTextField.getText().equals(""))
130 | searchTextField.setText("Search");
131 | }//GEN-LAST:event_searchTextFieldFocusLost
132 |
133 | private void searchTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchTextFieldKeyReleased
134 | updateTable(PersonalHandling.search(searchTextField.getText()));
135 | }//GEN-LAST:event_searchTextFieldKeyReleased
136 |
137 | private void updateTable(ArrayList pi1)
138 | {
139 | model = (DefaultTableModel)updateEmployeeTable.getModel();
140 | model.setRowCount(0);
141 | for(int i = 0; i < pi1.size(); i++){
142 | model.insertRow(model.getRowCount(), new Object[]{pi1.get(i).getId(),pi1.get(i).getName(),
143 | pi1.get(i).getPhone(), pi1.get(i).getAddress(), pi1.get(i).getCnic(),
144 | pi1.get(i).geteName(), pi1.get(i).getePhone(), pi1.get(i).getDob(),
145 | pi1.get(i).getEmail(), pi1.get(i).getPost(), pi1.get(i).getTiming(),
146 | pi1.get(i).getSalary()});
147 |
148 | }
149 | }
150 |
151 | // Variables declaration - do not modify//GEN-BEGIN:variables
152 | private javax.swing.JLabel jLabel1;
153 | private javax.swing.JScrollPane jScrollPane1;
154 | private javax.swing.JTextField searchTextField;
155 | private javax.swing.JTable updateEmployeeTable;
156 | // End of variables declaration//GEN-END:variables
157 | }
158 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/splashScreen/SplashForm.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
50 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/splashScreen/SplashForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.splashScreen;
13 |
14 | import gamemarkstudio.login.Login;
15 | import java.util.logging.Level;
16 | import java.util.logging.Logger;
17 | /*
18 | * @version 1.10 25 Aug 2017
19 | * @author Hamza Yasin
20 | */
21 | public class SplashForm extends javax.swing.JFrame {
22 |
23 | /**
24 | * Creates new form SplashForm
25 | */
26 | public SplashForm() {
27 | initComponents();
28 | gamemarkstudiio.DataConnection.ConnectionClass.connection();
29 | new Thread()
30 | {
31 | @Override
32 | public void run()
33 | {
34 | for (int i = 0; i<101; i++)
35 | {
36 | try {
37 | sleep(50);
38 | jProgressBar1.setValue(i);
39 | } catch (InterruptedException ex) {
40 | Logger.getLogger(SplashForm.class.getName()).log(Level.SEVERE, null, ex);
41 | }
42 | }
43 | Login log = new Login();
44 | log.setVisible(true);
45 | dispose();
46 | }
47 | }.start();
48 | }
49 |
50 | @SuppressWarnings("unchecked")
51 | // //GEN-BEGIN:initComponents
52 | private void initComponents() {
53 |
54 | jProgressBar1 = new javax.swing.JProgressBar();
55 | jLabel1 = new javax.swing.JLabel();
56 |
57 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
58 | setUndecorated(true);
59 | getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
60 | getContentPane().add(jProgressBar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 350, 300, 10));
61 |
62 | jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gamemarkstudio/splashScreen/SplashGMS.gif"))); // NOI18N
63 | getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 800, 400));
64 |
65 | pack();
66 | setLocationRelativeTo(null);
67 | }// //GEN-END:initComponents
68 |
69 | /**
70 | * @param args the command line arguments
71 | */
72 | public static void main(String args[]) {
73 | /* Set the Nimbus look and feel */
74 | //
75 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
76 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
77 | */
78 | try {
79 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
80 | if ("Linux".equals(info.getName())) {
81 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
82 | break;
83 | }
84 | }
85 | } catch (ClassNotFoundException ex) {
86 | java.util.logging.Logger.getLogger(SplashForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
87 | } catch (InstantiationException ex) {
88 | java.util.logging.Logger.getLogger(SplashForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
89 | } catch (IllegalAccessException ex) {
90 | java.util.logging.Logger.getLogger(SplashForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
91 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
92 | java.util.logging.Logger.getLogger(SplashForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
93 | }
94 | //
95 |
96 | /* Create and display the form */
97 | java.awt.EventQueue.invokeLater(() -> {
98 | new SplashForm().setVisible(true);
99 | });
100 | }
101 |
102 | // Variables declaration - do not modify//GEN-BEGIN:variables
103 | private javax.swing.JLabel jLabel1;
104 | private javax.swing.JProgressBar jProgressBar1;
105 | // End of variables declaration//GEN-END:variables
106 | }
107 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/splashScreen/SplashGMS.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HamzaYasin1/HR-Management-System-in-Java-using-swing-framework/e5c95b57bdc8fd9efe74f3ac379e20de9ab6dd4d/src/gamemarkstudio/splashScreen/SplashGMS.gif
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/TitlePane.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
55 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/TitlePane.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.update;
13 |
14 | /*
15 | * @version 1.10 25 Aug 2017
16 | * @author Hamza Yasin
17 | */
18 | public class TitlePane extends javax.swing.JPanel {
19 |
20 | /**
21 | * Creates new form TitlePane
22 | */
23 | public TitlePane() {
24 | initComponents();
25 | }
26 |
27 | /**
28 | * This method is called from within the constructor to initialize the form.
29 | * WARNING: Do NOT modify this code. The content of this method is always
30 | * regenerated by the Form Editor.
31 | */
32 | @SuppressWarnings("unchecked")
33 | // //GEN-BEGIN:initComponents
34 | private void initComponents() {
35 |
36 | jLabel2 = new javax.swing.JLabel();
37 |
38 | setBackground(new java.awt.Color(255, 255, 255));
39 |
40 | jLabel2.setFont(new java.awt.Font("Tahoma", 0, 38)); // NOI18N
41 | jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gamemarkstudio/images/Update.png"))); // NOI18N
42 | jLabel2.setText(" Please select any option to update.");
43 |
44 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
45 | this.setLayout(layout);
46 | layout.setHorizontalGroup(
47 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
48 | .addGroup(layout.createSequentialGroup()
49 | .addGap(20, 20, 20)
50 | .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 1227, javax.swing.GroupLayout.PREFERRED_SIZE)
51 | .addContainerGap(81, Short.MAX_VALUE))
52 | );
53 | layout.setVerticalGroup(
54 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
55 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
56 | .addContainerGap(119, Short.MAX_VALUE)
57 | .addComponent(jLabel2)
58 | .addGap(113, 113, 113))
59 | );
60 | }// //GEN-END:initComponents
61 |
62 |
63 | // Variables declaration - do not modify//GEN-BEGIN:variables
64 | private javax.swing.JLabel jLabel2;
65 | // End of variables declaration//GEN-END:variables
66 | }
67 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/UpdatePanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
141 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/UpdatePanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.update;
13 |
14 | import gamemarkstudio.update.updateemployeepanel.UpdateEmployee;
15 | import gamemarkstudio.update.updatepassword.ChangePassword;
16 | import gamemarkstudio.update.updatesalaryslips.UpdateSalarySlips;
17 | /*
18 | * @version 1.10 25 Aug 2017
19 | * @author Hamza Yasin
20 | */
21 | public class UpdatePanel extends javax.swing.JPanel {
22 |
23 | TitlePane titlePane = null;
24 | UpdateEmployee updateEmployee = null;
25 | UpdateSalarySlips updateSalarySlip = null;
26 | ChangePassword changePassword = null;
27 |
28 | public UpdatePanel() {
29 | initComponents();
30 |
31 | loadPanels();
32 | titlePane.setVisible(true);
33 | }
34 |
35 | /**
36 | * This method is called from within the constructor to initialize the form.
37 | * WARNING: Do NOT modify this code. The content of this method is always
38 | * regenerated by the Form Editor.
39 | */
40 | @SuppressWarnings("unchecked")
41 | // //GEN-BEGIN:initComponents
42 | private void initComponents() {
43 |
44 | jLabel1 = new javax.swing.JLabel();
45 | updateEmployeeButton = new javax.swing.JButton();
46 | changePasswordButton = new javax.swing.JButton();
47 | backbonePanel = new javax.swing.JPanel();
48 | jSeparator1 = new javax.swing.JSeparator();
49 |
50 | setBackground(new java.awt.Color(255, 255, 255));
51 |
52 | jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
53 | jLabel1.setForeground(new java.awt.Color(0, 102, 204));
54 | jLabel1.setText("Update");
55 | jLabel1.setToolTipText("");
56 |
57 | updateEmployeeButton.setBackground(new java.awt.Color(255, 255, 255));
58 | updateEmployeeButton.setFont(new java.awt.Font("Tahoma", 0, 22)); // NOI18N
59 | updateEmployeeButton.setText("Update Employee");
60 | updateEmployeeButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
61 | updateEmployeeButton.addActionListener(new java.awt.event.ActionListener() {
62 | public void actionPerformed(java.awt.event.ActionEvent evt) {
63 | updateEmployeeButtonActionPerformed(evt);
64 | }
65 | });
66 |
67 | changePasswordButton.setBackground(new java.awt.Color(255, 255, 255));
68 | changePasswordButton.setFont(new java.awt.Font("Tahoma", 0, 22)); // NOI18N
69 | changePasswordButton.setForeground(new java.awt.Color(0, 102, 51));
70 | changePasswordButton.setText("Change Password");
71 | changePasswordButton.setToolTipText("");
72 | changePasswordButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
73 | changePasswordButton.addActionListener(new java.awt.event.ActionListener() {
74 | public void actionPerformed(java.awt.event.ActionEvent evt) {
75 | changePasswordButtonActionPerformed(evt);
76 | }
77 | });
78 |
79 | backbonePanel.setBackground(new java.awt.Color(255, 255, 255));
80 |
81 | javax.swing.GroupLayout backbonePanelLayout = new javax.swing.GroupLayout(backbonePanel);
82 | backbonePanel.setLayout(backbonePanelLayout);
83 | backbonePanelLayout.setHorizontalGroup(
84 | backbonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
85 | .addGap(0, 0, Short.MAX_VALUE)
86 | );
87 | backbonePanelLayout.setVerticalGroup(
88 | backbonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
89 | .addGap(0, 516, Short.MAX_VALUE)
90 | );
91 |
92 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
93 | this.setLayout(layout);
94 | layout.setHorizontalGroup(
95 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
96 | .addComponent(jSeparator1)
97 | .addGroup(layout.createSequentialGroup()
98 | .addContainerGap()
99 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
100 | .addGroup(layout.createSequentialGroup()
101 | .addComponent(backbonePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
102 | .addContainerGap())
103 | .addGroup(layout.createSequentialGroup()
104 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
105 | .addGap(0, 0, Short.MAX_VALUE))
106 | .addGroup(layout.createSequentialGroup()
107 | .addGap(30, 30, 30)
108 | .addComponent(updateEmployeeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)
109 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 838, Short.MAX_VALUE)
110 | .addComponent(changePasswordButton)
111 | .addGap(58, 58, 58))))
112 | );
113 | layout.setVerticalGroup(
114 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
115 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
116 | .addContainerGap()
117 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
118 | .addGap(18, 18, 18)
119 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
120 | .addComponent(updateEmployeeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
121 | .addComponent(changePasswordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
122 | .addGap(16, 16, 16)
123 | .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
124 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
125 | .addComponent(backbonePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
126 | .addContainerGap())
127 | );
128 | }// //GEN-END:initComponents
129 |
130 | private void updateEmployeeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateEmployeeButtonActionPerformed
131 | hidePanels();
132 | updateEmployee.setVisible(true);
133 | }//GEN-LAST:event_updateEmployeeButtonActionPerformed
134 |
135 | private void changePasswordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changePasswordButtonActionPerformed
136 | hidePanels();
137 | changePassword.setVisible(true);
138 | }//GEN-LAST:event_changePasswordButtonActionPerformed
139 |
140 | private void loadPanels()
141 | {
142 | //title_pane
143 | titlePane = new TitlePane();
144 | backbonePanel.add(titlePane);
145 | titlePane.setSize(1330, 482);
146 |
147 | //update_employee
148 | updateEmployee = new UpdateEmployee();
149 | backbonePanel.add(updateEmployee);
150 | updateEmployee.setSize(1330, 520);
151 |
152 | //update_Salaryslips
153 | updateSalarySlip = new UpdateSalarySlips();
154 | backbonePanel.add(updateSalarySlip);
155 | updateSalarySlip.setSize(1330, 520);
156 |
157 | //change_password_panel
158 | changePassword = new ChangePassword();
159 | backbonePanel.add(changePassword);
160 | changePassword.setSize(1330, 520);
161 |
162 | hidePanels();
163 | }
164 |
165 | private void hidePanels()
166 | {
167 | titlePane.setVisible(false);
168 | updateEmployee.setVisible(false);
169 | updateSalarySlip.setVisible(false);
170 | changePassword.setVisible(false);
171 | }
172 |
173 | // Variables declaration - do not modify//GEN-BEGIN:variables
174 | private javax.swing.JPanel backbonePanel;
175 | private javax.swing.JButton changePasswordButton;
176 | private javax.swing.JLabel jLabel1;
177 | private javax.swing.JSeparator jSeparator1;
178 | private javax.swing.JButton updateEmployeeButton;
179 | // End of variables declaration//GEN-END:variables
180 | }
181 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/updateemployeepanel/UpdateEmployee.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
183 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/updateemployeepanel/UpdateEmployee.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.update.updateemployeepanel;
13 |
14 | import gamemarkstudio.newemployeepane.PersonalHandling;
15 | import gamemarkstudio.newemployeepane.PersonalInfo;
16 | import java.util.ArrayList;
17 | import javax.swing.table.DefaultTableModel;
18 |
19 | /*
20 | * @version 1.10 25 Aug 2017
21 | * @author Hamza Yasin
22 | */
23 | public class UpdateEmployee extends javax.swing.JPanel {
24 |
25 | /**
26 | * Creates new form UpdateEmployee
27 | */
28 | DefaultTableModel model;
29 | public UpdateEmployee() {
30 | initComponents();
31 | PersonalHandling.Load();
32 | updateTable(PersonalHandling.getArray());
33 | }
34 |
35 | /**
36 | * This method is called from within the constructor to initialize the form.
37 | * WARNING: Do NOT modify this code. The content of this method is always
38 | * regenerated by the Form Editor.
39 | */
40 | @SuppressWarnings("unchecked")
41 | // //GEN-BEGIN:initComponents
42 | private void initComponents() {
43 |
44 | jLabel1 = new javax.swing.JLabel();
45 | searchTextField = new javax.swing.JTextField();
46 | jScrollPane1 = new javax.swing.JScrollPane();
47 | updateEmployeeTable = new javax.swing.JTable();
48 |
49 | setBackground(new java.awt.Color(255, 255, 255));
50 |
51 | jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
52 | jLabel1.setForeground(new java.awt.Color(0, 102, 204));
53 | jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
54 | jLabel1.setText("> Update Employee");
55 | jLabel1.setToolTipText("");
56 |
57 | searchTextField.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
58 | searchTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
59 | searchTextField.setText("Search");
60 | searchTextField.addFocusListener(new java.awt.event.FocusAdapter() {
61 | public void focusGained(java.awt.event.FocusEvent evt) {
62 | searchTextFieldFocusGained(evt);
63 | }
64 | public void focusLost(java.awt.event.FocusEvent evt) {
65 | searchTextFieldFocusLost(evt);
66 | }
67 | });
68 | searchTextField.addKeyListener(new java.awt.event.KeyAdapter() {
69 | public void keyPressed(java.awt.event.KeyEvent evt) {
70 | searchTextFieldKeyPressed(evt);
71 | }
72 | });
73 |
74 | updateEmployeeTable.setModel(new javax.swing.table.DefaultTableModel(
75 | new Object [][] {
76 |
77 | },
78 | new String [] {
79 | "ID", "Full Name", "Phone", "Address", "Cnic", "Emergency Name", "Emergency Phone", "Date of Birth", "Email", "Position", "Date of Hiring", "Salary"
80 | }
81 | ) {
82 | Class[] types = new Class [] {
83 | java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Double.class
84 | };
85 | boolean[] canEdit = new boolean [] {
86 | false, false, false, false, false, false, false, false, false, false, false, false
87 | };
88 |
89 | public Class getColumnClass(int columnIndex) {
90 | return types [columnIndex];
91 | }
92 |
93 | public boolean isCellEditable(int rowIndex, int columnIndex) {
94 | return canEdit [columnIndex];
95 | }
96 | });
97 | updateEmployeeTable.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
98 | updateEmployeeTable.addMouseListener(new java.awt.event.MouseAdapter() {
99 | public void mouseClicked(java.awt.event.MouseEvent evt) {
100 | updateEmployeeTableMouseClicked(evt);
101 | }
102 | });
103 | jScrollPane1.setViewportView(updateEmployeeTable);
104 |
105 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
106 | this.setLayout(layout);
107 | layout.setHorizontalGroup(
108 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
109 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
110 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
111 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1320, Short.MAX_VALUE)
112 | .addComponent(searchTextField))
113 | .addContainerGap())
114 | .addGroup(layout.createSequentialGroup()
115 | .addGap(38, 38, 38)
116 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
117 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
118 | );
119 | layout.setVerticalGroup(
120 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
121 | .addGroup(layout.createSequentialGroup()
122 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
123 | .addGap(31, 31, 31)
124 | .addComponent(searchTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
125 | .addGap(30, 30, 30)
126 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 356, javax.swing.GroupLayout.PREFERRED_SIZE)
127 | .addContainerGap(64, Short.MAX_VALUE))
128 | );
129 | }// //GEN-END:initComponents
130 |
131 | private void searchTextFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchTextFieldFocusGained
132 | if(searchTextField.getText().equals("Search"))
133 | searchTextField.setText("");
134 | }//GEN-LAST:event_searchTextFieldFocusGained
135 |
136 | private void searchTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchTextFieldFocusLost
137 | if(searchTextField.getText().equals(""))
138 | searchTextField.setText("Search");
139 | }//GEN-LAST:event_searchTextFieldFocusLost
140 |
141 | private void searchTextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchTextFieldKeyPressed
142 | updateTable(PersonalHandling.search(searchTextField.getText()));
143 | }//GEN-LAST:event_searchTextFieldKeyPressed
144 |
145 | private void updateEmployeeTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_updateEmployeeTableMouseClicked
146 | if(updateEmployeeTable.getRowCount()==0)
147 | return;
148 | new UpdateEmployeeDialog(null, true, PersonalHandling.searchByID(Integer.parseInt(updateEmployeeTable.getValueAt(updateEmployeeTable.getSelectedRow(), 0).toString()))).setVisible(true);
149 | updateTable(PersonalHandling.search(""));
150 | }//GEN-LAST:event_updateEmployeeTableMouseClicked
151 |
152 | private void updateTable(ArrayList pi1)
153 | {
154 | model = (DefaultTableModel)updateEmployeeTable.getModel();
155 | model.setRowCount(0);
156 | for(int i = 0; i < pi1.size(); i++){
157 | model.insertRow(model.getRowCount(), new Object[]{pi1.get(i).getId(),pi1.get(i).getName(),
158 | pi1.get(i).getPhone(), pi1.get(i).getAddress(), pi1.get(i).getCnic(),
159 | pi1.get(i).geteName(), pi1.get(i).getePhone(), pi1.get(i).getDob(),
160 | pi1.get(i).getEmail(), pi1.get(i).getPost(), pi1.get(i).getTiming(), pi1.get(i).getSalary()});
161 |
162 | }
163 | }
164 |
165 | // Variables declaration - do not modify//GEN-BEGIN:variables
166 | private javax.swing.JLabel jLabel1;
167 | private javax.swing.JScrollPane jScrollPane1;
168 | private javax.swing.JTextField searchTextField;
169 | private javax.swing.JTable updateEmployeeTable;
170 | // End of variables declaration//GEN-END:variables
171 | }
172 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/updatepassword/ChangePassword.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.update.updatepassword;
13 |
14 | import gamemarkstudio.login.LoginHandling;
15 | import gamemarkstudio.login.Login_1;
16 | import java.util.ArrayList;
17 | import javax.swing.JOptionPane;
18 | import javax.swing.table.DefaultTableModel;
19 | /*
20 | * @version 1.10 25 Aug 2017
21 | * @author Hamza Yasin
22 | */
23 |
24 | public class ChangePassword extends javax.swing.JPanel {
25 |
26 | /**
27 | * Creates new form ChangePassword
28 | */
29 | DefaultTableModel model;
30 | public ChangePassword() {
31 | initComponents();
32 | model = (DefaultTableModel)jTable1.getModel();
33 | updateTable(LoginHandling.search(""));
34 | }
35 |
36 | /**
37 | * This method is called from within the constructor to initialize the form.
38 | * WARNING: Do NOT modify this code. The content of this method is always
39 | * regenerated by the Form Editor.
40 | */
41 | @SuppressWarnings("unchecked")
42 | // //GEN-BEGIN:initComponents
43 | private void initComponents() {
44 |
45 | jLabel1 = new javax.swing.JLabel();
46 | jLabel3 = new javax.swing.JLabel();
47 | jLabel4 = new javax.swing.JLabel();
48 | jLabel5 = new javax.swing.JLabel();
49 | jLabel6 = new javax.swing.JLabel();
50 | usernameTextField = new javax.swing.JTextField();
51 | currentPasswordField = new javax.swing.JPasswordField();
52 | newPasswordField = new javax.swing.JPasswordField();
53 | confirmPasswordField = new javax.swing.JPasswordField();
54 | deletePasswordButton = new javax.swing.JButton();
55 | jScrollPane1 = new javax.swing.JScrollPane();
56 | jTable1 = new javax.swing.JTable();
57 | changePasswordButton1 = new javax.swing.JButton();
58 |
59 | setBackground(new java.awt.Color(255, 255, 255));
60 |
61 | jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
62 | jLabel1.setForeground(new java.awt.Color(0, 102, 204));
63 | jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
64 | jLabel1.setText("> Change Password");
65 | jLabel1.setToolTipText("");
66 |
67 | jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
68 | jLabel3.setText("Username:");
69 |
70 | jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
71 | jLabel4.setText("Current Password:");
72 |
73 | jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
74 | jLabel5.setText("New Password:");
75 |
76 | jLabel6.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
77 | jLabel6.setText("Confirm Password:");
78 |
79 | usernameTextField.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
80 | usernameTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
81 |
82 | currentPasswordField.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
83 | currentPasswordField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
84 |
85 | newPasswordField.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
86 | newPasswordField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
87 |
88 | confirmPasswordField.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
89 | confirmPasswordField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
90 |
91 | deletePasswordButton.setBackground(new java.awt.Color(255, 255, 255));
92 | deletePasswordButton.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
93 | deletePasswordButton.setForeground(new java.awt.Color(153, 0, 0));
94 | deletePasswordButton.setText("Delete Record");
95 | deletePasswordButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
96 | deletePasswordButton.addActionListener(new java.awt.event.ActionListener() {
97 | public void actionPerformed(java.awt.event.ActionEvent evt) {
98 | deletePasswordButtonActionPerformed(evt);
99 | }
100 | });
101 |
102 | jTable1.setForeground(new java.awt.Color(51, 51, 51));
103 | jTable1.setModel(new javax.swing.table.DefaultTableModel(
104 | new Object [][] {
105 |
106 | },
107 | new String [] {
108 | "ID", "User Name", "Password", "Full Name", "Security Question", "Security Answer", "Status"
109 | }
110 | ) {
111 | Class[] types = new Class [] {
112 | java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
113 | };
114 | boolean[] canEdit = new boolean [] {
115 | false, false, false, false, false, false, false
116 | };
117 |
118 | public Class getColumnClass(int columnIndex) {
119 | return types [columnIndex];
120 | }
121 |
122 | public boolean isCellEditable(int rowIndex, int columnIndex) {
123 | return canEdit [columnIndex];
124 | }
125 | });
126 | jScrollPane1.setViewportView(jTable1);
127 |
128 | changePasswordButton1.setBackground(new java.awt.Color(255, 255, 255));
129 | changePasswordButton1.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
130 | changePasswordButton1.setForeground(new java.awt.Color(0, 102, 0));
131 | changePasswordButton1.setText("Update Password");
132 | changePasswordButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
133 |
134 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
135 | this.setLayout(layout);
136 | layout.setHorizontalGroup(
137 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
138 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
139 | .addContainerGap()
140 | .addComponent(jScrollPane1)
141 | .addContainerGap())
142 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
143 | .addGap(31, 31, 31)
144 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
145 | .addGroup(layout.createSequentialGroup()
146 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
147 | .addComponent(jLabel3)
148 | .addComponent(jLabel4))
149 | .addGap(140, 140, 140)
150 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
151 | .addComponent(currentPasswordField)
152 | .addComponent(usernameTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)))
153 | .addGroup(layout.createSequentialGroup()
154 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
155 | .addComponent(jLabel5)
156 | .addComponent(jLabel6))
157 | .addGap(138, 138, 138)
158 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
159 | .addComponent(newPasswordField)
160 | .addComponent(confirmPasswordField))))
161 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
162 | .addGroup(layout.createSequentialGroup()
163 | .addGap(548, 548, 548)
164 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
165 | .addGap(33, 33, 33))
166 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
167 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
168 | .addComponent(deletePasswordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE)
169 | .addGap(19, 19, 19))))
170 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
171 | .addGroup(layout.createSequentialGroup()
172 | .addGap(1068, 1068, 1068)
173 | .addComponent(changePasswordButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
174 | .addGap(20, 20, 20)))
175 | );
176 | layout.setVerticalGroup(
177 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
178 | .addGroup(layout.createSequentialGroup()
179 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
180 | .addGap(39, 39, 39)
181 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
182 | .addComponent(jLabel3)
183 | .addComponent(usernameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
184 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
185 | .addGroup(layout.createSequentialGroup()
186 | .addGap(34, 34, 34)
187 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
188 | .addComponent(jLabel4)
189 | .addComponent(currentPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
190 | .addGap(34, 34, 34)
191 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
192 | .addComponent(jLabel5)
193 | .addComponent(newPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
194 | .addGap(47, 47, 47)
195 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
196 | .addGroup(layout.createSequentialGroup()
197 | .addGap(0, 69, Short.MAX_VALUE)
198 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)
199 | .addGap(36, 36, 36))
200 | .addGroup(layout.createSequentialGroup()
201 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
202 | .addComponent(jLabel6)
203 | .addComponent(confirmPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
204 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
205 | .addGroup(layout.createSequentialGroup()
206 | .addGap(41, 41, 41)
207 | .addComponent(deletePasswordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
208 | .addGap(0, 0, Short.MAX_VALUE))))
209 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
210 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
211 | .addContainerGap(259, Short.MAX_VALUE)
212 | .addComponent(changePasswordButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
213 | .addGap(250, 250, 250)))
214 | );
215 | }// //GEN-END:initComponents
216 |
217 | private void deletePasswordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deletePasswordButtonActionPerformed
218 | try{
219 | LoginHandling.DeleteRecordById(usernameTextField.getText());
220 | updateTable(LoginHandling.search(""));
221 | }catch(Exception e){
222 | JOptionPane.showMessageDialog(null, e.getMessage());
223 | }
224 | }//GEN-LAST:event_deletePasswordButtonActionPerformed
225 |
226 | private void updateTable(ArrayList pi1)
227 | {
228 | model.setRowCount(0);
229 | for(int i = 0; i < pi1.size(); i++){
230 | model.insertRow(model.getRowCount(), new Object[]{pi1.get(i).getSr(),pi1.get(i).getLogin(), pi1.get(i).getPassword(), pi1.get(i).getName(), pi1.get(i).getQuestion(),
231 | pi1.get(i).getAnswer(), pi1.get(i).getStatus()});
232 |
233 | }
234 | }
235 |
236 | // Variables declaration - do not modify//GEN-BEGIN:variables
237 | private javax.swing.JButton changePasswordButton1;
238 | private javax.swing.JPasswordField confirmPasswordField;
239 | private javax.swing.JPasswordField currentPasswordField;
240 | private javax.swing.JButton deletePasswordButton;
241 | private javax.swing.JLabel jLabel1;
242 | private javax.swing.JLabel jLabel3;
243 | private javax.swing.JLabel jLabel4;
244 | private javax.swing.JLabel jLabel5;
245 | private javax.swing.JLabel jLabel6;
246 | private javax.swing.JScrollPane jScrollPane1;
247 | private javax.swing.JTable jTable1;
248 | private javax.swing.JPasswordField newPasswordField;
249 | private javax.swing.JTextField usernameTextField;
250 | // End of variables declaration//GEN-END:variables
251 | }
252 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/updatesalaryslips/SalaryHandling.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * %W% %E% Hamza Yasin
4 | *
5 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
6 | *
7 | * This software is the confidential and proprietary information of Miranz
8 | * technology. You shall not disclose such Confidential Information and
9 | * shall use it only in accordance with the terms of the license agreement
10 | * you entered into with Miranz.
11 | *
12 | */
13 | package gamemarkstudio.update.updatesalaryslips;
14 |
15 | import gamemarkstudiio.DataConnection.ConnectionClass;
16 | import gamemarkstudiio.salaryslips.SalarySlipDetail;
17 | import gamemarkstudio.newemployeepane.PersonalHandling;
18 | import gamemarkstudio.newemployeepane.PersonalInfo;
19 | import java.sql.ResultSet;
20 | import java.sql.SQLException;
21 | import java.util.ArrayList;
22 | /*
23 | * @version 1.10 25 Aug 2017
24 | * @author Hamza Yasin
25 | */
26 |
27 | public class SalaryHandling {
28 |
29 | private static ArrayList ss = new ArrayList<>();
30 |
31 | public static boolean Load()
32 | {
33 | if(!ss.isEmpty())
34 | return false;
35 |
36 | ResultSet resultSet = ConnectionClass.selectQuery("select * from salaryslip;");
37 |
38 | try{
39 | while(resultSet.next()){
40 | ss.add(new SalarySlipClass(Integer.parseInt(resultSet.getObject(1).toString()), resultSet.getObject(2).toString(),
41 | resultSet.getObject(3).toString(),resultSet.getObject(4).toString(), Integer.parseInt(resultSet.getObject(5).toString()),
42 | Double.parseDouble(resultSet.getObject(6).toString()), Double.parseDouble(resultSet.getObject(7).toString()),
43 | Double.parseDouble(resultSet.getObject(8).toString()),resultSet.getObject(9).toString()));
44 | }
45 | System.out.println("loaded with size of " + ss.size());
46 | }catch(SQLException e){
47 | }
48 | return true;
49 |
50 | }
51 |
52 |
53 |
54 | public static void Save(SalarySlipClass ssc)
55 | {
56 | try {
57 | PersonalInfo personalInfo = PersonalHandling.searchByID(ssc.getId());
58 |
59 | if(personalInfo==null)
60 | throw new IllegalArgumentException("No Record Found Against ID " + ssc.getId());
61 |
62 | ssc.setNetSalary(personalInfo.getSalary());
63 | ssc.setName(personalInfo.getName());
64 | ssc.setPost(personalInfo.getPost());
65 |
66 | ConnectionClass.query("insert into salaryslip(sr, name, post, month, days, advance, deduction, net_salary, date, gross_salary)" +
67 | "values ("+ ssc.getId()+", '"+ ssc.getName()+"', '"+ ssc.getPost() +"', '"+ssc.getMonthName() +"', "+ ssc.getTotalWorkingDays()+","+ ssc.getAdvance()+
68 | ", "+ ssc.getDeduction() +" , " + ssc.getNetSalary() + " ,'" + ssc.getDate() + "' , " + ssc.getGross() +");");
69 |
70 | ss.add(ssc);
71 | new SalarySlipDetail(null, true, ssc).setVisible(true);
72 |
73 | }catch(IllegalArgumentException e){
74 | throw new IllegalArgumentException(e.getMessage() + "Record not saved");
75 | }
76 |
77 | }
78 |
79 | public static void unique(SalarySlipClass ssc)
80 | {
81 | for (int i = 0; i < ss.size(); i ++)
82 | {
83 | if (ssc.getId() == ss.get(i).getId())
84 | throw new IllegalArgumentException("Record against this ID '"+ssc.getId()+"' is already exist ");
85 | }
86 | }
87 |
88 |
89 | public static void arrayDispose()
90 | {
91 | ss.clear();
92 | }
93 |
94 | public static SalarySlipClass searchByID(int id)
95 | {
96 | try
97 | {
98 | Load();
99 | for(int i=0; i getArray()
110 | {
111 | return ss;
112 | }
113 |
114 |
115 | public static void DeleteRecord(SalarySlipClass ssc)
116 | {
117 | try {
118 | Load();
119 |
120 | ConnectionClass.query("DELETE FROM salaryslip WHERE sr = "+ ssc.getId() + ";");
121 |
122 | }catch(Exception e)
123 | {
124 | throw new IllegalArgumentException(e.getMessage());
125 | }
126 |
127 |
128 | }
129 | public static void UpdateRecord(SalarySlipClass ssc)
130 | {
131 | try {
132 |
133 | Load();
134 |
135 | ConnectionClass.query("UPDATE salaryslip SET name = '" + ssc.getName() + "', post = '"+ ssc.getPost() +
136 | "', month = '"+ ssc.getMonthName() + "', days = '" + ssc.getTotalWorkingDays()+ "', advance = '" + ssc.getAdvance()
137 | + "', deduction = '"+ ssc.getDeduction() + "', net_salary = '" + ssc.getNetSalary() + "', date = '" + ssc.getDate()
138 | +"', gross_salary = '" + ssc.getGross() +"'WHERE sr = " + ssc.getId() +" ;");
139 |
140 | }catch(Exception e)
141 | {
142 | throw new IllegalArgumentException(e.getMessage());
143 | }
144 |
145 | }
146 |
147 |
148 |
149 | }
150 |
151 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/updatesalaryslips/SalarySlipClass.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.update.updatesalaryslips;
13 | /*
14 | * @version 1.10 25 Aug 2017
15 | * @author Hamza Yasin
16 | */
17 |
18 | public class SalarySlipClass {
19 |
20 | private int id;
21 | private String name;
22 | private String post;
23 | private String monthName;
24 | private int totalWorkingDays;
25 | private double advance;
26 | private double deduction;
27 | private String date;
28 | private double netSalary;
29 |
30 | /* Constructor */
31 | public SalarySlipClass(int id, String name, String post, String monthName, int totalWorkingDays, double advance, double deduction, double netSalary ,String date) {
32 | setId(id);
33 | setName(name);
34 | setPost(post);
35 | setMonthName(monthName);
36 | setTotalWorkingDays(totalWorkingDays);
37 | setAdvance(advance);
38 | setDeduction(deduction);
39 | setNetSalary(netSalary);
40 | setDate(date);
41 | }
42 |
43 | public boolean setId(int id) {
44 | if (id > 0)
45 | this.id = id;
46 | else {
47 | this.id = id *-1;
48 | throw new IllegalArgumentException("Employee ID must be in positive Integers.");
49 | }
50 | return true;
51 | }
52 |
53 | public void setName(String name) {
54 | this.name = name;
55 | }
56 |
57 | public boolean setNetSalary(double netSalary) {
58 | if (netSalary > 0)
59 | this.netSalary = netSalary;
60 | else{
61 | this.netSalary = netSalary*-1;
62 | throw new IllegalArgumentException("Net Salary must be in positive integers.");
63 | }
64 | return true;
65 | }
66 | public void setPost(String post) {
67 | if (!post.equals("Choose"))
68 | this.post = post;
69 | else
70 | this.post = "Wrong Selection.";
71 | }
72 |
73 | public void setMonthName(String monthName) {
74 | if (!monthName.equals("Choose"))
75 | this.monthName = monthName;
76 | else
77 | this.monthName = "Wrong Selection.";
78 | }
79 |
80 | public boolean setTotalWorkingDays(int totalWorkingDays) {
81 | if (totalWorkingDays > 0)
82 | this.totalWorkingDays = totalWorkingDays;
83 | else {
84 | this.totalWorkingDays = totalWorkingDays*-1;
85 | throw new IllegalArgumentException("Working Days must be in positive integers.");
86 | }
87 | return true;
88 | }
89 |
90 | public boolean setAdvance(double advance) {
91 | if (advance > 0)
92 | this.advance = advance;
93 | else{
94 | this.advance = advance *-1;
95 | throw new IllegalArgumentException("Advance must be in positive integers.");
96 | }
97 | return true;
98 | }
99 |
100 | public boolean setDeduction(double deduction) {
101 | if (deduction > 0)
102 | this.deduction = deduction;
103 | else {
104 | this.deduction = deduction *-1;
105 | throw new IllegalArgumentException("Deduction must be in positive integers.");
106 | }
107 | return true;
108 | }
109 |
110 | public void setDate(String date) {
111 | if (!date.equals("Choose"))
112 | this.date = date;
113 | else
114 | this.date = "Wrong Selection";
115 | }
116 |
117 | public int getId() {
118 | return id;
119 | }
120 |
121 | public String getName() {
122 | return name;
123 | }
124 |
125 | public String getPost() {
126 | return post;
127 | }
128 |
129 | public String getMonthName() {
130 | return monthName;
131 | }
132 |
133 | public int getTotalWorkingDays() {
134 | return totalWorkingDays;
135 | }
136 |
137 | public double getGross() {
138 | return getNetSalary() - (getAdvance() + getDeduction());
139 | }
140 |
141 | public double getAdvance() {
142 | return advance;
143 | }
144 |
145 | public double getDeduction() {
146 | return deduction;
147 | }
148 |
149 | public String getDate() {
150 | return date;
151 | }
152 |
153 | public double getNetSalary() {
154 | return netSalary;
155 | }
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | }
164 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/updatesalaryslips/UpdateSalarySlips.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
104 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/update/updatesalaryslips/UpdateSalarySlips.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * %W% %E% Hamza Yasin
4 | *
5 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
6 | *
7 | * This software is the confidential and proprietary information of Miranz
8 | * technology. You shall not disclose such Confidential Information and
9 | * shall use it only in accordance with the terms of the license agreement
10 | * you entered into with Miranz.
11 | *
12 | */
13 | package gamemarkstudio.update.updatesalaryslips;
14 |
15 | /*
16 | * @version 1.10 25 Aug 2017
17 | * @author Hamza Yasin
18 | */
19 | public class UpdateSalarySlips extends javax.swing.JPanel {
20 |
21 | /**
22 | * Creates new form NewJPanel
23 | */
24 | public UpdateSalarySlips() {
25 | initComponents();
26 | }
27 |
28 | /**
29 | * This method is called from within the constructor to initialize the form.
30 | * WARNING: Do NOT modify this code. The content of this method is always
31 | * regenerated by the Form Editor.
32 | */
33 | @SuppressWarnings("unchecked")
34 | // //GEN-BEGIN:initComponents
35 | private void initComponents() {
36 |
37 | jLabel1 = new javax.swing.JLabel();
38 | jScrollPane1 = new javax.swing.JScrollPane();
39 | updateSalarySlipTable = new javax.swing.JTable();
40 | searchTextField = new javax.swing.JTextField();
41 |
42 | setBackground(new java.awt.Color(255, 255, 255));
43 |
44 | jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
45 | jLabel1.setForeground(new java.awt.Color(0, 102, 204));
46 | jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
47 | jLabel1.setText("> Update Salary Slips");
48 | jLabel1.setToolTipText("");
49 |
50 | updateSalarySlipTable.setModel(new javax.swing.table.DefaultTableModel(
51 | new Object [][] {
52 |
53 | },
54 | new String [] {
55 | "ID", "Full Name", "Position", "Timing"
56 | }
57 | ) {
58 | boolean[] canEdit = new boolean [] {
59 | false, false, false, false
60 | };
61 |
62 | public boolean isCellEditable(int rowIndex, int columnIndex) {
63 | return canEdit [columnIndex];
64 | }
65 | });
66 | updateSalarySlipTable.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
67 | jScrollPane1.setViewportView(updateSalarySlipTable);
68 |
69 | searchTextField.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
70 | searchTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
71 | searchTextField.setText("Search");
72 | searchTextField.addFocusListener(new java.awt.event.FocusAdapter() {
73 | public void focusGained(java.awt.event.FocusEvent evt) {
74 | searchTextFieldFocusGained(evt);
75 | }
76 | public void focusLost(java.awt.event.FocusEvent evt) {
77 | searchTextFieldFocusLost(evt);
78 | }
79 | });
80 |
81 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
82 | this.setLayout(layout);
83 | layout.setHorizontalGroup(
84 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
85 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
86 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
87 | .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
88 | .addComponent(searchTextField))
89 | .addContainerGap())
90 | .addGroup(layout.createSequentialGroup()
91 | .addGap(537, 537, 537)
92 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
93 | .addContainerGap(574, Short.MAX_VALUE))
94 | );
95 | layout.setVerticalGroup(
96 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
97 | .addGroup(layout.createSequentialGroup()
98 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
99 | .addGap(32, 32, 32)
100 | .addComponent(searchTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
101 | .addGap(30, 30, 30)
102 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 356, javax.swing.GroupLayout.PREFERRED_SIZE)
103 | .addContainerGap(64, Short.MAX_VALUE))
104 | );
105 | }// //GEN-END:initComponents
106 |
107 | private void searchTextFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchTextFieldFocusGained
108 | if(searchTextField.getText().equals("Search"))
109 | searchTextField.setText("");
110 | }//GEN-LAST:event_searchTextFieldFocusGained
111 |
112 | private void searchTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchTextFieldFocusLost
113 | if(searchTextField.getText().equals(""))
114 | searchTextField.setText("Search");
115 | }//GEN-LAST:event_searchTextFieldFocusLost
116 |
117 |
118 | // Variables declaration - do not modify//GEN-BEGIN:variables
119 | private javax.swing.JLabel jLabel1;
120 | private javax.swing.JScrollPane jScrollPane1;
121 | private javax.swing.JTextField searchTextField;
122 | private javax.swing.JTable updateSalarySlipTable;
123 | // End of variables declaration//GEN-END:variables
124 | }
125 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/uploadwork/UploadHandling.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.uploadwork;
13 |
14 | import gamemarkstudiio.DataConnection.ConnectionClass;
15 | import java.sql.ResultSet;
16 | import java.sql.SQLException;
17 | import java.util.ArrayList;
18 | /*
19 | * @version 1.10 25 Aug 2017
20 | * @author Hamza Yasin
21 | */
22 |
23 |
24 | public class UploadHandling {
25 |
26 | private static ArrayListupload = new ArrayList();
27 |
28 | public static boolean load()
29 | {
30 | if (!upload.isEmpty())
31 | return false;
32 |
33 | ResultSet resultSet = ConnectionClass.selectQuery("SELECT * FROM gms.uploadwork;");
34 |
35 | if(resultSet == null)
36 | return false;
37 |
38 | try{
39 | while(resultSet.next()){
40 |
41 | upload.add(new UploadWork(Integer.parseInt(resultSet.getObject(1).toString()),resultSet.getObject(2).toString(),
42 | resultSet.getObject(3).toString(),resultSet.getObject(4).toString(), resultSet.getObject(5).toString(),
43 | resultSet.getObject(6).toString()));
44 | }
45 | System.out.println("loaded with size of " + upload.size());
46 | }catch(SQLException e){
47 | }
48 | return true;
49 | }
50 |
51 |
52 | public static void save(UploadWork up)
53 | {
54 | try {
55 |
56 | uniqueCheck(up);
57 | ConnectionClass.query("Insert into uploadwork ( id, description, upload_date, developer_name, designer_name, game_link)\n" + "values ( "+up.getIdGame()+
58 | ",'"+ up.getGameDescription()+"', '"
59 | + up.getUploadDate()+"','" + up.getDeveloperName()+ "', '" +up.getDesignerName()+"', '" + up.getGameLink() + "' );");
60 | upload.add(up);
61 |
62 | }catch(IllegalArgumentException e){
63 | throw new IllegalArgumentException(e.getMessage());
64 | }
65 |
66 | }
67 |
68 | private static void uniqueCheck(UploadWork up)
69 | {
70 | for(int i=0; i search(String search)
91 | {
92 | load();
93 | ArrayList send = new ArrayList();
94 |
95 | for (int i = 0; i < upload.size(); i++)
96 | {
97 | if (String.valueOf(upload.get(i).getIdGame()).toUpperCase().contains(search.toUpperCase()))
98 | send.add(upload.get(i));
99 | else if (upload.get(i).getDesignerName().toUpperCase().contains(search.toUpperCase()))
100 | send.add(upload.get(i));
101 | else if (upload.get(i).getDeveloperName().toUpperCase().contains(search.toUpperCase()))
102 | send.add(upload.get(i));
103 | else if (upload.get(i).getGameDescription().toUpperCase().contains(search.toUpperCase()))
104 | send.add(upload.get(i));
105 | else if (String.valueOf(upload.get(i).getUploadDate()).toUpperCase().contains(search.toUpperCase()))
106 | send.add(upload.get(i));
107 |
108 | }
109 | arrayDispose();
110 | return send;
111 |
112 | }
113 | public static void arrayDispose()
114 | {
115 | upload.clear();
116 | }
117 |
118 |
119 | public static void UpdateRecord(UploadWork up)
120 | {
121 | try {
122 |
123 | load();
124 |
125 | ConnectionClass.query("UPDATE uploadwork SET description = '" + up.getGameDescription()+ "', upload_date = '"+ up.getUploadDate()+
126 | "', developer_date = '"+ up.getDeveloperName() + "', designer_name = '" + up.getDesignerName() + "', game_link = '" + up.getGameLink()
127 | + " ' WHERE id = " + up.getIdGame() +" ;");
128 |
129 | }catch(Exception e)
130 | {
131 | throw new IllegalArgumentException(e.getMessage());
132 | }
133 |
134 | }
135 | public static ArrayList getArray()
136 | {
137 | return upload;
138 | }
139 |
140 |
141 | }
142 |
--------------------------------------------------------------------------------
/src/gamemarkstudio/uploadwork/UploadWork.java:
--------------------------------------------------------------------------------
1 | /*
2 | * %W% %E% Hamza Yasin
3 | *
4 | * Copyright (c) 2017-2018 Miranz Technology. All Rights Reserved.
5 | *
6 | * This software is the confidential and proprietary information of Miranz
7 | * technology. You shall not disclose such Confidential Information and
8 | * shall use it only in accordance with the terms of the license agreement
9 | * you entered into with Miranz.
10 | *
11 | */
12 | package gamemarkstudio.uploadwork;
13 |
14 | /*
15 | * @version 1.10 25 Aug 2017
16 | * @author Hamza Yasin
17 | */
18 |
19 | public class UploadWork {
20 |
21 |
22 | private String gameDescription;
23 | private int idGame = 1;
24 | private String uploadDate;
25 | private String developerName;
26 | private String designerName;
27 | private String gameLink;
28 |
29 | /* Constructor */
30 | public UploadWork(int id, String gameDescription, String uploadDate, String developerName, String designerName, String gameLink) {
31 |
32 | setIdGame(id);
33 | setGameDescription(gameDescription);
34 | setUploadDate(uploadDate);
35 | setDeveloperName(developerName);
36 | setDesignerName(designerName);
37 | setGameLink(gameLink);
38 |
39 | }
40 |
41 |
42 | public boolean setIdGame(int id) {
43 | if (id > 0)
44 | this.idGame = id;
45 | else {
46 | this.idGame = id *-1;
47 | throw new IllegalArgumentException("Game ID must be in positive Integers.");
48 | }
49 | return true;
50 | }
51 | public void setGameDescription(String gameDescription) {
52 | this.gameDescription = gameDescription;
53 | }
54 |
55 | public void setUploadDate(String uploadDate) {
56 | this.uploadDate = uploadDate;
57 | }
58 |
59 | public void setDeveloperName(String developerName) {
60 | this.developerName = developerName;
61 | }
62 |
63 | public void setDesignerName(String designerName) {
64 | this.designerName = designerName;
65 | }
66 |
67 | public void setGameLink(String gameLink) {
68 | this.gameLink = gameLink;
69 | }
70 |
71 | public String getGameDescription() {
72 | return gameDescription;
73 | }
74 |
75 | public String getUploadDate() {
76 | return uploadDate;
77 | }
78 |
79 | public String getDeveloperName() {
80 | return developerName;
81 | }
82 |
83 | public String getDesignerName() {
84 | return designerName;
85 | }
86 |
87 | public String getGameLink() {
88 | return gameLink;
89 | }
90 | public int getIdGame()
91 | {
92 | return idGame;
93 | }
94 |
95 |
96 |
97 |
98 | }
99 |
--------------------------------------------------------------------------------