private void btnConfirmar_Click(object sender, EventArgs e) { try { if (accion == 0) //CONFIRMAR AUTORIZACION DE UN SOCIO { if (txtNIP.Text == "" && txtConfirmarNIP.Text == "") { MessageBox.Show("¡Complete los campos!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning); cerrarbandera = 0; } else { if (txtNIP.Text != txtConfirmarNIP.Text) { MessageBox.Show("¡Las contraseñas no coinciden!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning); cerrarbandera = 0; } else { nip = txtNIP.Text; cerrarbandera = 1; this.Close(); } } } else if (accion == 1) { if (txtNIP.Text == "" && txtConfirmarNIP.Text == "") { MessageBox.Show("¡Complete los campos!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning); cerrarbandera = 1; } else { if (txtNIP.Text != txtConfirmarNIP.Text) { MessageBox.Show("¡Las contraseñas no coinciden!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning); cerrarbandera = 1; } else { DialogResult mensaje = MessageBox.Show("¿Desea modificar el NIP de autorización del socio?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (mensaje == DialogResult.Yes) { string nipaut = txtNIP.Text; socioscontroller.cambiarNIP(id, nipaut); MessageBox.Show("¡El nip de autorización ha sido modificado exitosamente!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); cerrarbandera = 1; this.Close(); } } } } else //PARA AGREGAR EL NIP DE UN SOCIO { if (txtNIP.Text == "" && txtConfirmarNIP.Text == "") { MessageBox.Show("¡Complete los campos!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning); cerrarbandera = 0; } else { if (txtNIP.Text != txtConfirmarNIP.Text) { MessageBox.Show("¡Las contraseñas no coinciden!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning); cerrarbandera = 0; } else { DialogResult mensaje = MessageBox.Show("¿Confirma la contraseña?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (mensaje == DialogResult.Yes) { nip = txtNIP.Text; cerrarbandera = 1; this.Close(); } } } } } catch (Exception ex) { MessageBox.Show("Error: " + ex, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }