-
Notifications
You must be signed in to change notification settings - Fork 0
/
Driver_Verify_Frame.java
75 lines (62 loc) · 2.3 KB
/
Driver_Verify_Frame.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
import java.awt.event.ActionEvent;
import java.sql.ResultSet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
class Driver_Verify_Frame extends Basic_Frame {
JFrame jf_vd=new JFrame();
JPanel vd=new JPanel();
JLabel pro_submit_name=new JLabel("姓名",JLabel.CENTER);
JTextField text_submit_name=new JTextField(20);
JLabel pro_submit_file_number=new JLabel("档案编号",JLabel.CENTER);
JTextField text_submit_file_number=new JTextField(20);
JButton submit_driver_verify=new JButton("提交");
int mode;
Driver_Verify_Frame() {
this.create_jf_jp(jf_vd,vd,400,400,"驾驶员登录");
this.JLabel_add(pro_submit_name,vd,0,50,125,50);
this.JTextField_add(text_submit_name,vd,125,50,225,50);
this.JLabel_add(pro_submit_file_number,vd,0,150,125,50);
this.JTextField_add(text_submit_file_number,vd,125,150,225,50);
this.JButton_add(submit_driver_verify,vd,150,250,100,50);
}
Driver_Verify_Frame(int mode) {
this();
this.mode=mode;
}
public void actionPerformed(ActionEvent e) {
try {
if (e.getSource()==submit_driver_verify) {
String name=text_submit_name.getText();
String file_number=text_submit_file_number.getText();
ResultSet rs=Driving_System_MySQL.execQuery("select * from DRIVER where name='"+name+"' and file_number='"+file_number+"'");
if (rs.next()) {
if (mode==4) {
ResultSet rs_car=Driving_System_MySQL.execQuery("select * from CAR where person='"+name+"' and address='"+rs.getString(3)+"'");
String str="select * from CAR where person='"+name+"' and address='"+rs.getString(3)+"'";
// System.out.println(str);
if (rs_car.next()) {
Car_Frame cf=new Car_Frame(2, rs_car.getInt(21));
while (rs_car.next()) {
cf=new Car_Frame(2, rs_car.getInt(21));
}
jf_vd.dispose();
} else {
JOptionPane.showMessageDialog(null, "无拥有汽车,请添加", "信息", JOptionPane.CLOSED_OPTION);
}
} else {
jf_vd.dispose();
Driver_Frame df=new Driver_Frame(mode, rs.getInt(17));
}
} else {
JOptionPane.showMessageDialog(null, "提交失败", "信息", JOptionPane.CLOSED_OPTION);
}
}
} catch(Exception e1) {
System.out.println(e1.getMessage());
}
}
}