-
Notifications
You must be signed in to change notification settings - Fork 1
/
UpdateIssues.java
193 lines (139 loc) · 5.94 KB
/
UpdateIssues.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package opensource.contribution.management;
import java.awt.*;
import javax.swing.*;
import com.toedter.calendar.JDateChooser;
import java.util.*;
import java.awt.event.*;
import java.sql.*;
public class UpdateIssues extends JFrame implements ActionListener{
//Random ran = new Random();
// int number = ran.nextInt(999999);
JTextField tplead;
JDateChooser dcdob;
JComboBox tpdesc;
JLabel prId;
Choice tpname;
JButton add, back;
String Is_Id;
UpdateIssues(String ID) {
this.Is_Id=ID;
getContentPane().setBackground(Color.WHITE);
setLayout(null);
JLabel heading = new JLabel("Update Issues Details");
heading.setBounds(320, 30, 500, 50);
heading.setFont(new Font("SAN_SERIF", Font.BOLD, 25));
add(heading);
JLabel labelfname = new JLabel("Project Id");
labelfname.setBounds(50, 150, 150, 30);
labelfname.setFont(new Font("serif", Font.PLAIN, 20));
add(labelfname);
tpname = new Choice();
tpname.setBounds(200, 150, 150, 30);
try {
Conn c = new Conn();
ResultSet rs = c.s.executeQuery("select * from projects");
while(rs.next()) {
tpname.add(rs.getString("Project_Id"));
}
} catch (Exception e) {
e.printStackTrace();
}
add(tpname);
JLabel labelsalary = new JLabel("Status");
labelsalary.setBounds(50, 200, 150, 30);
labelsalary.setFont(new Font("serif", Font.PLAIN, 20));
add(labelsalary);
String typ[] = {"Open","Close"};
tpdesc = new JComboBox(typ);
tpdesc.setBackground(Color.WHITE);
tpdesc.setBounds(200, 200, 150, 30);
add(tpdesc);
JLabel labeladdress = new JLabel("Issue Info");
labeladdress.setBounds(50, 250, 150, 30);
labeladdress.setFont(new Font("serif", Font.PLAIN, 20));
add(labeladdress);
tplead = new JTextField();
tplead.setBounds(200, 250, 150, 30);
add(tplead);
//JLabel labeldob = new JLabel("Date");
//labeldob.setBounds(50, 200, 150, 30);
// labeldob.setFont(new Font("serif", Font.PLAIN, 20));
// add(labeldob);
// dcdob = new JDateChooser();
// dcdob.setBounds(200, 200, 150, 30);
// add(dcdob);
JLabel labelempId = new JLabel("Issue ID");
labelempId.setBounds(50, 400, 150, 30);
labelempId.setFont(new Font("serif", Font.PLAIN, 20));
add(labelempId);
prId = new JLabel();
prId.setBounds(200, 400, 150, 30);
prId.setFont(new Font("serif", Font.PLAIN, 20));
add(prId);
try{
Conn c = new Conn();
String query = "select * from issues where Issue_Id = '"+Is_Id+"'";
ResultSet rs =c.s.executeQuery(query);
while (rs.next())
{
tpname.addItem(rs.getString("Project_Id"));
tpdesc.addItem(rs.getString("Issue_Status"));
tplead.setText(rs.getString("Issue_Info"));
//dcdob.setDate(rs.getDate("Start_date"));
prId.setText(rs.getString("Issue_Id"));
}
}
catch (Exception e) {
e.printStackTrace();
}
add = new JButton("Update Details");
add.setBounds(250, 550, 150, 40);
add.addActionListener(this);
add.setBackground(Color.BLACK);
add.setForeground(Color.WHITE);
add(add);
back = new JButton("Back");
back.setBounds(450, 550, 150, 40);
back.addActionListener(this);
back.setBackground(Color.BLACK);
back.setForeground(Color.WHITE);
add(back);
setSize(900, 700);
setLocation(300, 50);
setVisible(true);
}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == add) {
String pr_id = tpname.getSelectedItem();
String Is_status = (String) tpdesc.getSelectedItem();
String Is_info = tplead.getText();
// String dob = ((JTextField) dcdob.getDateEditor().getUiComponent()).getText();
// String phone = tfphone.getText();
// String email = tfemail.getText();
// String education = (String) cbeducation.getSelectedItem();
// String designation = tfdesignation.getText();
// String aadhar = tfaadhar.getText();
// String empId = lblempId.getText();
try {
Conn conn = new Conn();
String query = "update issues set Project_Id = '"+pr_id+"', Issue_Status = '"+Is_status+"', Issue_Info = '"+Is_info+"' where Issue_Id = '"+Is_Id+"'";
conn.s.executeUpdate(query);
JOptionPane.showMessageDialog(null, "Details Updated successfully");
setVisible(false);
new ViewIssues().setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
} else {
setVisible(false);
new ViewIssues().setVisible(true);
}
}
public static void main(String[] args) {
new UpdateIssues("");
}
}