Пример #1
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getSource() == table && e.getClickCount() == 2) {
     // 表格
     String id = table.getValueAt(table.getSelectedRow(), -1).toString();
     try {
       TShopCharge tshopcharge = tShopChargeService.getByIdService(id);
       if (tshopcharge == null) {
         JOptionPane.showMessageDialog(null, "当前会员不存在");
         return;
       }
       memberShopChargeUpdate = new MemberShopChargeUpdate(null, "修改页面", true);
       memberShopChargeUpdate.showDialog(tshopcharge);
     } catch (Exception e1) {
       e1.printStackTrace();
     }
   }
 }
Пример #2
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == queryButton) {

      // 查询
      this.termQuery(1);

    } else if (e.getSource() == addButton) {
      // 添加
      memberShopChargeAdd = new MemberShopChargeAdd(null, "添加充值规则", true);
      memberShopChargeAdd.showDialog();
      if (memberShopChargeAdd.isSuccess) {
        this.termQuery(1);
      }

    } else if (e.getSource() == cleateButton) {
      // 清除
      // cardNumTF.getText().setText("");
      startTimeTF.setDate(null);
      timeTF.setDate(null);
    } else if (e.getSource() == deleteButton) {
      int row = table.getSelectedRow();
      if (row != -1) {
        if (Util.showConfirmDialog("是否要删除选择记录") == 0) {
          String id = table.getValueAt(table.getSelectedRow(), -1).toString();
          try {
            tShopChargeService.deleteService(id);
            JOptionPane.showMessageDialog(null, "删除成功");
            this.termQuery(1);
          } catch (Exception e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
            JOptionPane.showMessageDialog(null, "删除失败(请确定商品未被其他数据库表使用)");
          }
        }
      } else {
        JOptionPane.showMessageDialog(null, "请选择行在进行删除");
        return;
      }
    }
  }
 @Override
 public void keyReleased(KeyEvent e) {
   if (e.getSource() == fillMoneyTF.getText()) {
     if (e.getKeyCode() == KeyEvent.VK_ENTER) {
       TShopCharge tShopCharge = new TShopCharge();
       tShopCharge.setAMount(Double.parseDouble(fillMoneyTF.getText().getText()));
       try {
         PageModel<TShopCharge> pageModel =
             tShopChargeService.getTShopChargeService(0, 2, tShopCharge);
         if (pageModel != null) {
           giftMoneyTF.getText().setText(pageModel.getResultList().get(0).getGiftAmount() + "");
         } else {
           giftMoneyTF.getText().setText(0 + "");
         }
       } catch (Exception e1) {
         // TODO Auto-generated catch block
         e1.printStackTrace();
       }
     }
   }
 }