예제 #1
0
        private void concluir()
        {
            this.Hide();
            Form f = new list_project();

            f.Closed += (s, args) => this.Close();
            f.Show();
        }
예제 #2
0
        private void voltarBtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form f = new list_project();

            f.Closed += (s, args) => this.Close();
            f.Show();
        }
예제 #3
0
        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();
                }
            }
        }