Beispiel #1
0
        private void Entrar_Click(object sender, EventArgs e)
        {
            Form1        frm  = new Form1();
            Funcionarios func = new Funcionarios();

            func.LoginFuncionario = Login.Text;
            string Loginfunc = func.LoginFuncionario;

            func.Senha = Senha.Text;
            if (String.IsNullOrEmpty(func.LoginFuncionario) || (String.IsNullOrEmpty(func.Senha)))
            {
                MessageBox.Show("É necessário informar o login e a senha");
            }

            MySqlConnection conexao = new MySqlConnection(ConfigurationManager.AppSettings["conexao"]);

            conexao.Open();
            MySqlDataReader reader;
            MySqlCommand    cmd = conexao.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = (" SELECT* FROM FUNCIONARIOS WHERE LOGINFUNC = '" + func.LoginFuncionario + "' AND SENHAFUNC = '" + func.Senha + "'");
            reader          = cmd.ExecuteReader();
            Boolean result = reader.HasRows;

            if (result == false)
            {
                MessageBox.Show("O usuário " + func.LoginFuncionario + " não está cadastrado ou a senha não confere ");
                conexao.Close();
            }
            else
            {
                SelecaoTarefa st = new SelecaoTarefa();
                st.ShowDialog();
            }
        }
        private void VoltarCadastro_Click(object sender, EventArgs e)
        {
            SelecaoTarefa sf = new SelecaoTarefa();

            this.Close();
        }