Exemplo n.º 1
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == addbt) {
     if (bankAccountBLService != null) {
       JDialog dialog = new JDialog(parent, "新建银行账户", true);
       dialog
           .getContentPane()
           .add(new BankAccountAddPanel(parent, dialog, this, bankAccountBLService));
       dialog.setLocationRelativeTo(parent);
       dialog.setLocation(dialog.getX() / 2, dialog.getY() / 2);
       dialog.pack();
       dialog.setVisible(true);
     } else {
       initBL();
     }
   } else if (e.getSource() == deletebt) {
     int row = table.getSelectedRow();
     if (row >= 0) {
       if (bankAccountBLService != null) {
         String account = (String) table.getValueAt(row, 0);
         try {
           bankAccountBLService.deleteBankAccount(account);
           refresh();
           new TranslucentFrame(this, MessageType.DELETE_SUCCESS, Color.GREEN);
         } catch (RemoteException e1) {
           new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE);
         } catch (SQLException e1) {
           System.out.println(e1.getMessage());
         }
       } else {
         initBL();
       }
     }
   } else if (e.getSource() == refreshbt) {
     refresh();
     new TranslucentFrame(this, "刷新成功", Color.GREEN);
   }
 }
Exemplo n.º 2
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == approvebt) {
      int[] rows = table.getSelectedRows();
      if (rows.length <= 0) {
        new TranslucentFrame(this, "请选择要审批的单据(按住ctrl可多选)", Color.RED);
      } else { // 选择了行
        if (isBLInited()) {
          for (int i : rows) {
            String id = (String) table.getValueAt(i, 0);
            String receiptType = (String) table.getValueAt(i, 1);
            try {
              if (receiptType.equals("付款单")) {
                payReceiptBLService.updateState(id, ReceiptState.APPROVED);
              } else if (receiptType.equals("中转单")) {
                transferReceiptBLService.updateState(id, ReceiptState.APPROVED);
              }

            } catch (RemoteException e1) {
              new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE);
            } catch (SQLException e1) {
              System.out.println(e1.getMessage());
            }
          }
          refreshList();
          new TranslucentFrame(this, "审批成功", Color.GREEN);
        } else {
          initBL();
        }
      }
    } else if (e.getSource() == disappbt) {
      int[] rows = table.getSelectedRows();
      if (rows.length <= 0) {
        new TranslucentFrame(this, "请选择要审批的单据(按住ctrl可多选)", Color.RED);
      } else { // 选择了行
        if (isBLInited()) {
          for (int i : rows) {
            String id = (String) table.getValueAt(i, 0);
            String receiptType = (String) table.getValueAt(i, 1);
            try {
              if (receiptType.equals("付款单")) {
                payReceiptBLService.updateState(id, ReceiptState.UNAPPROVED);
              } else if (receiptType.equals("中转单")) {
                transferReceiptBLService.updateState(id, ReceiptState.UNAPPROVED);
              }

            } catch (RemoteException e1) {
              new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE);
            } catch (SQLException e1) {
              System.out.println(e1.getMessage());
            }
          }
          refreshList();
          new TranslucentFrame(this, "审批成功", Color.GREEN);
        } else {
          initBL();
        }
      }
    } else if (e.getSource() == refreshbt) {
      refreshList();
      new TranslucentFrame(this, "刷新成功", Color.GREEN);
    }
  }