private void concluir() { this.Hide(); Form f = new list_project(); f.Closed += (s, args) => this.Close(); f.Show(); }
private void voltarBtn_Click(object sender, EventArgs e) { this.Hide(); Form f = new list_project(); f.Closed += (s, args) => this.Close(); f.Show(); }
private void btnLogin_Click(object sender, EventArgs e) { string autorizacao = "select count(1) from usuario where nome = @nome and senha = @senha"; using (NpgsqlConnection conexao = new NpgsqlConnection(strConexao)) { conexao.Open(); try { using (NpgsqlCommand comando = new NpgsqlCommand(autorizacao, conexao)) { comando.Parameters.AddWithValue("@nome", lineUsuario.Text); comando.Parameters.AddWithValue("@senha", lineSenha.Text); string userFound = comando.ExecuteScalar().ToString(); if (int.Parse(userFound) >= 1) { this.Hide(); Form f = new list_project(); f.Closed += (s, args) => this.Close(); f.Show(); } else { MessageBox.Show("Acesso negado"); } } } catch (NpgsqlException ex) { MessageBox.Show(ex.Message + ex.StackTrace); } finally { conexao.Close(); } } }