private void button1_Click(object sender, EventArgs e) { OperacionesUsuario operacion = new OperacionesUsuario(); int respuesta = operacion.login(this.textUsuario.Text, this.textContrasena.Text); if (respuesta == 1) { this.Hide(); new ChatGeneral().ShowDialog(); this.Close(); } else if (respuesta == 0) { MessageBox.Show("El usuario no existe."); this.textUsuario.Text = ""; this.textContrasena.Text = ""; } else if (respuesta == -1) { MessageBox.Show("La contraseña es incorrecta."); this.textContrasena.Text = ""; } else { MessageBox.Show("Error desconocido: " + respuesta); this.textUsuario.Text = ""; this.textContrasena.Text = ""; } }
private void buttonAceptar_Click(object sender, EventArgs e) { OperacionesUsuario operacion = new OperacionesUsuario(); int respuesta = operacion.registro(textUsuario.Text, textContrasena.Text, textConfirmar.Text); if (respuesta == 1) { MessageBox.Show("Usuario registrado con éxito!"); this.Close(); } else if (respuesta == 0) { MessageBox.Show("Las contraseñas no coinciden."); this.textContrasena.Text = ""; this.textConfirmar.Text = ""; } else if (respuesta == -1) { MessageBox.Show("El usuario ya está registrado."); this.textUsuario.Text = ""; this.textContrasena.Text = ""; this.textConfirmar.Text = ""; } else { MessageBox.Show("Error desconocido: " + respuesta); this.textUsuario.Text = ""; this.textContrasena.Text = ""; this.textConfirmar.Text = ""; } }