Ejemplo n.º 1
0
 private void btnEliminarActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnEliminarActionPerformed
   classEstados estados = new classEstados();
   estados.lngIdEstado = Long.valueOf(this.txtIdEstado.getText());
   estados.StrPais = (this.cboPaises.getSelectedItem().toString().substring(0, 4).toString());
   try {
     estados.eliminarEstado();
     defineTablaEstados("", 1, 1);
     this.limpiar();
     JOptionPane.showInternalMessageDialog(rootPane, "Eliminado Correctamente");
   } catch (SQLException ex) {
     Logger.getLogger(frmGruposUsuarios.class.getName()).log(Level.SEVERE, null, ex);
   }
 } // GEN-LAST:event_btnEliminarActionPerformed
Ejemplo n.º 2
0
  private void btnRegEstadoActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnRegEstadoActionPerformed

    if (this.btnRegEstado.getLabel() == "Registrar") {
      classEstados estados = new classEstados();
      String strRespuesta = "";

      if (this.cboPaises.getSelectedItem().toString() == "") {
        JOptionPane.showInternalMessageDialog(rootPane, "Es necesario elegir un país");
        return;
      }
      estados.strEstado = this.txtNombreEstado.getText();

      estados.StrPais = (this.cboPaises.getSelectedItem().toString().substring(0, 4).toString());

      try {
        estados.ingresarEstado();
        defineTablaEstados(
            "",
            1,
            Long.parseLong(this.cboPaises.getSelectedItem().toString().substring(0, 4).toString()));
        limpiar();
        JOptionPane.showInternalMessageDialog(rootPane, "Registrado Correctamente");
      } catch (SQLException ex) {
        Logger.getLogger(frmEstados.class.getName()).log(Level.SEVERE, null, ex);
      }

    } else {
      classEstados estados = new classEstados();
      estados.lngIdEstado = Long.valueOf(this.txtIdEstado.getText());
      estados.StrPais = (this.cboPaises.getSelectedItem().toString().substring(0, 4).toString());
      estados.strEstado = this.txtNombreEstado.getText();

      try {
        if (estados.actualizarEstado() == true) {
          this.defineTablaEstados(
              this.txtBuscar.getText(),
              Long.valueOf(this.txtPagina.getText()),
              Long.parseLong(
                  this.cboPaises.getSelectedItem().toString().substring(0, 4).toString()));
          JOptionPane.showInternalMessageDialog(rootPane, "Actualizado Correctamente");
        }
      } catch (SQLException ex) {
        Logger.getLogger(frmGruposUsuarios.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  } // GEN-LAST:event_btnRegEstadoActionPerformed