private void btn_Login_Click(object sender, EventArgs e) { SqlCommand sqlCommand = new SqlCommand("[dbo].[sp_LogIn]", acceso.getConnection()); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(new SqlParameter("@ID_profesional", SqlDbType.Int)); sqlCommand.Parameters.Add(new SqlParameter("@email", SqlDbType.VarChar, 30)); sqlCommand.Parameters.Add(new SqlParameter("@pass", SqlDbType.VarChar, 10)); sqlCommand.Parameters["@ID_profesional"].Direction = ParameterDirection.Output; sqlCommand.Parameters["@email"].Value = txt_Email.Text; sqlCommand.Parameters["@pass"].Value = txt_Password.Text; try { acceso.conectar(); sqlCommand.ExecuteNonQuery(); id_Profesional = (int)sqlCommand.Parameters["@ID_profesional"].Value; } catch (Exception ex) { MessageBox.Show("No se ha podido conectar: " + ex.Message); } finally { acceso.desconectar(); } if (id_Profesional != id_ProfesionalInvalido) { MessageBox.Show("Loggin válido, bienvenido usuario " + id_Profesional); PantallaProfesional pantalla = new PantallaProfesional(this, id_Profesional); this.Hide(); pantalla.Show(); } else { MessageBox.Show("Loggin inválido, vuelva a inentarlo, por favor"); } }
private void btn_Atras2_Click(object sender, EventArgs e) { this.Close(); pantallaProfesional.Show(); }