private void btnAceptarActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnAceptarActionPerformed
    // TODO add your handling code here:
    try {
      btnAceptar.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      if (!editar) {
        if (!txtNombre.getText().trim().isEmpty()
            && !txtCorreo.getText().trim().isEmpty()
            && !txtCalle.getText().trim().isEmpty()
            && !txtNumero.getText().trim().isEmpty()
            && !txtColonia.getText().trim().isEmpty()
            && !txtCiudad.getText().trim().isEmpty()) {
          if (!txtCelular.getText().trim().isEmpty() || !txtTelefono.getText().trim().isEmpty()) {

            direccion.setCalle(txtCalle.getText());
            direccion.setCiudad(txtCiudad.getText());
            direccion.setColonia(txtColonia.getText());
            direccion.setNumero(txtNumero.getText());
            this.id =
                ClienteNegocio.Guardar(
                    txtNombre.getText(),
                    direccion,
                    txtCelular.getText(),
                    txtTelefono.getText(),
                    txtCorreo.getText());
            if (id > 0) {
              JOptionPane.showMessageDialog(
                  this,
                  ResourceBundle.getBundle("gdm/entidades/clases/resource")
                      .getString("ClienteAgregado"),
                  ResourceBundle.getBundle("gdm/entidades/clases/resource")
                      .getString("TituloCliente"),
                  JOptionPane.INFORMATION_MESSAGE);
              this.DialogResult = true;
              this.dispose();

            } else {
              JOptionPane.showMessageDialog(
                  this,
                  ResourceBundle.getBundle("gdm/entidades/clases/resource")
                      .getString("ErrorMensaje"),
                  ResourceBundle.getBundle("gdm/entidades/clases/resource")
                      .getString("TituloError"),
                  JOptionPane.INFORMATION_MESSAGE);
            }

          } else {
            JOptionPane.showMessageDialog(
                this,
                ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("Telefono"),
                ResourceBundle.getBundle("gdm/entidades/clases/resource")
                    .getString("TituloCliente"),
                JOptionPane.INFORMATION_MESSAGE);
          }
        } else {
          JOptionPane.showMessageDialog(
              this,
              ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("CamposVacios"),
              ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("TituloCliente"),
              JOptionPane.INFORMATION_MESSAGE);
        }
      } else {
        if (!txtNombre.getText().trim().isEmpty()
            && !txtCorreo.getText().trim().isEmpty()
            && !txtCalle.getText().trim().isEmpty()
            && !txtNumero.getText().trim().isEmpty()
            && !txtColonia.getText().trim().isEmpty()
            && !txtCiudad.getText().trim().isEmpty()) {
          if (!txtCelular.getText().trim().isEmpty() || !txtTelefono.getText().trim().isEmpty()) {
            direccion.setCalle(txtCalle.getText());
            direccion.setCiudad(txtCiudad.getText());
            direccion.setColonia(txtColonia.getText());
            direccion.setNumero(txtNumero.getText());

            if (ClienteNegocio.Editar(
                id,
                txtNombre.getText(),
                direccion,
                txtCorreo.getText(),
                txtTelefono.getText(),
                txtCelular.getText())) {
              JOptionPane.showMessageDialog(
                  this,
                  ResourceBundle.getBundle("gdm/entidades/clases/resource")
                      .getString("ClienteEditado"),
                  ResourceBundle.getBundle("gdm/entidades/clases/resource")
                      .getString("TituloCliente"),
                  JOptionPane.INFORMATION_MESSAGE);
              this.DialogResult = true;
              this.dispose();

            } else {
              JOptionPane.showMessageDialog(
                  this,
                  ResourceBundle.getBundle("gdm/entidades/clases/resource")
                      .getString("ErrorMensaje"),
                  ResourceBundle.getBundle("gdm/entidades/clases/resource")
                      .getString("TituloError"),
                  JOptionPane.INFORMATION_MESSAGE);
            }
          } else {
            JOptionPane.showMessageDialog(
                this,
                ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("Telefono"),
                ResourceBundle.getBundle("gdm/entidades/clases/resource")
                    .getString("TituloCliente"),
                JOptionPane.INFORMATION_MESSAGE);
          }

        } else {
          JOptionPane.showMessageDialog(
              this,
              ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("CamposVacios"),
              ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("TituloCliente"),
              JOptionPane.INFORMATION_MESSAGE);
        }
      }

    } catch (Exception e) {
      JOptionPane.showMessageDialog(
          this,
          ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("ErrorMensaje"),
          ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("TituloError"),
          JOptionPane.INFORMATION_MESSAGE);
    }
  } // GEN-LAST:event_btnAceptarActionPerformed