Ejemplo n.º 1
0
  private void btnProcessActionActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnProcessActionActionPerformed
    if (this.entity == null) {
      this.entity = new StoreEntity();
    } else {
      this.entity.setId(((Number) txtId.getValue()).intValue());
    }

    if (txtCompany.getText() != null) {
      entity.setCompany(txtCompany.getText());
    }
    if (txtName.getText() != null) {
      entity.setProductName(txtName.getText());
    }
    if (txtCount.getValue() != null) {
      entity.setCount(((Number) txtCount.getValue()).intValue());
    }
    if (txtMinCount.getValue() != null) {
      entity.setMinCount(((Number) txtMinCount.getValue()).intValue());
    }
    if (txtCode.getText() != null) {
      entity.setCode(txtCode.getText());
    }
    if (txtPrice.getValue() != null) {
      entity.setPrice(((Number) txtPrice.getValue()).floatValue());
    }

    if (this.action == Action.CREATE) {
      this.dao.saveEntity(entity);
    } else if (this.action == Action.UPDATE) {
      this.dao.updateEntity(entity);
    }

    this.dispose();
  } // GEN-LAST:event_btnProcessActionActionPerformed