コード例 #1
0
 @Override
 public void setViewDatas() {
   Vector<Payment> payments = paymentblservice.getAll();
   // 转换显示格式
   Vector<Vector> datas = changeDatas(payments);
   // 调用父类方法设置结果集合
   setDatas(datas);
 }
コード例 #2
0
 private void view() {
   int id = getSelectId(getJTable());
   Payment payment = paymentblservice.getById(id);
   MainFrame.getLoglabel().setText("查看付款单");
   this.textField_paymentId.setText(id + "");
   this.comboBox_paymentType.setSelectedItem(payment.getPayment_type());
   this.textField_paymentdatetime.setText(
       DateUtil.getStringByDateTime(payment.getPayment_datetime()));
   this.textField_paymentamount.setText(payment.getPayment_amount() + "");
   this.comboBox_user.setSelectedItem(makeUser(payment.getFinance_user()));
 }
コード例 #3
0
 private void update() {
   Payment payment = getPayment();
   int paymentId = Integer.parseInt(this.textField_paymentId.getText());
   payment.setId(paymentId);
   boolean result = paymentblservice.update(payment);
   // 重新读取数据
   setViewDatas();
   // 刷新列表, 清空表单
   clear();
   // 通知更新结果
   if (result) {
     MainFrame.getLoglabel().setText("更新付款信息成功");
     logger.info("更新付款信息成功");
   } else {
     MainFrame.getLoglabel().setText("更新付款信息失败");
     logger.error("更新付款信息失败");
   }
 }
コード例 #4
0
  private void add() {
    if (isTextExist() && isTextValidate()) {

      Payment payment = getPayment();
      int result = paymentblservice.add(payment);
      // 重新读取数据
      setViewDatas();
      // 刷新列表, 清空表单
      clear();
      // 通知添加结果
      if (result == 0) {
        MainFrame.getLoglabel().setText("新增付款信息失败");
        logger.error("新增付款信息失败");
      } else {
        MainFrame.getLoglabel().setText("新增付款信息成功");
        logger.info("新增付款信息成功");
      }
    }
  }
コード例 #5
0
  private void delete() {
    if (!this.textField_paymentId.getText().equals("")) {
      int paymentId = Integer.parseInt(this.textField_paymentId.getText());
      boolean result = paymentblservice.delete(paymentId);
      // 重新读取数据
      setViewDatas();
      // 刷新列表, 清空表单
      clear();
      if (result) {

        MainFrame.getLoglabel().setText("刪除付款信息成功");
        logger.info("刪除付款信息成功");
      } else {
        MainFrame.getLoglabel().setText("刪除付款信息失败");
        logger.error("刪除付款信息失败");
      }
    } else {
      showWarn("未选择付款单");
    }
  }
コード例 #6
0
  private void query() {
    String text = this.textField_query.getText().trim();
    Vector<Payment> payments;
    Vector<Vector> datas;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Date date = null;
    try {
      date = dateFormat.parse(text);
    } catch (Exception e) {
      showWarn("请输入yyyy-MM-dd的格式日期");
      return;
    }
    Date nextDate = DateUtil.getNextDateByDate(date);
    String today = DateUtil.getStringByDateTime(date);
    String tomorrow = DateUtil.getStringByDateTime(nextDate);

    String sql = " select * from payment where payment_datetime > ?  and payment_datetime < ? ";
    Object[] values = {today, tomorrow};
    payments = paymentblservice.getBySql(sql, values);
    datas = changeDatas(payments);
    this.datas = datas;
    refreshTable();
  }