stid.setText(wNumber);
stname.setText(wName);
stsalary.setText(wBasicWage);
stboon.setText(wBoon);
stprize.setText(wBonus);
stcounter.setText(wCountMethod);
stfact.setText(wFactWage);
}
}
catch(Exception esql){
System.out.println("薪资信息管理-初始化数据失败!");
}
//------按钮事件--------------------------------------------------------------------------
up.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
try{
if(Database.rs.previous()){
String wNumber=(""+Database.rs.getString("W_Number"));
String wName=Database.rs.getString("W_Name");
String wBasicWage=Database.rs.getString("W_BasicWage");
String wBoon=Database.rs.getString("W_Boon");
String wBonus=Database.rs.getString("W_Bonus");
String wCountMethod=Database.rs.getString("W_CountMethod");
String wFactWage=Database.rs.getString("W_FactWage");
stid.setText(wNumber);
stname.setText(wName);
stsalary.setText(wBasicWage);
stboon.setText(wBoon);
stprize.setText(wBonus);
stcounter.setText(wCountMethod);
stfact.setText(wFactWage);
}
}
catch(Exception eup){
System.out.println("以到最前一条!");
}
}
});
next.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
try{
if(Database.rs.next()){
String wNumber=(""+Database.rs.getString("W_Number"));
String wName=Database.rs.getString("W_Name");
String wBasicWage=Database.rs.getString("W_BasicWage");
String wBoon=Database.rs.getString("W_Boon");
String wBonus=Database.rs.getString("W_Bonus");
String wCountMethod=Database.rs.getString("W_CountMethod");
String wFactWage=Database.rs.getString("W_FactWage");
stid.setText(wNumber);
stname.setText(wName);
stsalary.setText(wBasicWage);
stboon.setText(wBoon);
stprize.setText(wBonus);
stcounter.setText(wCountMethod);
stfact.setText(wFactWage);
}
}
catch(Exception enext){
System.out.println("以到最后一条");
}
}
});
//为添加删除保存修改按钮加事件----------------------------------------
//添加
btnadd.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
save.setEnabled(true);
stid.setText("");
stid.setEditable(false);
stname.setText("");
stsalary.setText("");
stboon.setText("");
stprize.setText("");
stcounter.setText("");
stfact.setText("");
}
});
//保存
save.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(stname.getText().equals("")||stsalary.getText().equals("")||stboon.getText().equals("")||
stprize.getText().equals("")||stcounter.getText().equals("")||stfact.getText().equals("")){
www.751com.cn!");
}
else{
// String wNumber=stid.getText();
String wName=stname.getText();
String wBasicWage=stsalary.getText();
String wBoon=stboon.getText();
String wBonus=stprize.getText();
String wCountMethod=stcounter.getText();
String wFactWage=stfact.getText();
String Insert="insert WageInformation values('"+wName+"','"+wBasicWage+"','"+wBoon+"','"+wBonus+"','"+wCountMethod+"','"+wFactWage+"')";
try{
if(Database.executeSQL(Insert)){
stid.setEditable(true);