📄 refundlistener.java
字号:
package control.takeClothes;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import view.dialog.takeClothes.RefundDlg;
import vo.OperatorVo;
import vo.RefundmentVo;
import dao.common.DbException;
import dao.takeClothesDao.TakeClothesDao;
import dao.takeClothesDao.takeClothesDaoImpl.TakeClothesDaoImpl;
public class RefundListener implements ActionListener {
private RefundDlg refundDlg;
public RefundListener(RefundDlg refundDlg) {
super();
this.refundDlg = refundDlg;
}
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if (command.equals("确定")) {
OperatorVo operatorVo = this.refundDlg.getRefundPanel()
.getOperatorVo();
TakeClothesDao takeClothesDao = new TakeClothesDaoImpl();
try {
if (takeClothesDao.isThisOperatorExists(operatorVo)) {
RefundmentVo refundmentVo = null;
try{
refundmentVo = this.refundDlg.getRefundPanel()
.getRefundmentVo();
if(refundmentVo == null){
return;
}
}catch(NumberFormatException nfe){
JOptionPane.showMessageDialog(null, "赔偿金额格式不正确!");
return;
}
if(takeClothesDao.registRefundment(refundmentVo)){
JOptionPane.showMessageDialog(null, "已将洗衣单"+refundmentVo.getOrderId()+"赔偿记录添加到数据库中");
this.refundDlg.dispose();
}
} else {
JOptionPane.showMessageDialog(null, "密码错误,请重洗输入");
refundDlg.getRefundPanel().buildOperatorPswFld().setText(null);
}
} catch (DbException de) {
JOptionPane.showMessageDialog(null, de.getMessage());
}
}else if(command.equals("取消")){
this.refundDlg.dispose();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -