示例#1
0
        private void VoltarToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            Hide();
            frmMenuAdmin frmMenuAdmin = new frmMenuAdmin();

            frmMenuAdmin.ShowDialog();
        }
示例#2
0
        private void menuPrincipalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Hide();
            frmMenuAdmin frmMenuAdmin = new frmMenuAdmin();

            frmMenuAdmin.ShowDialog();
        }
示例#3
0
        private void btnEntrar_Click_1(object sender, EventArgs e)
        {
            login = txtLogin.Text.ToString();
            string          senha   = txtSenha.Text;
            string          CONFIG  = "Server = 127.0.0.1; Database = bd_elaborator; user = Jonathan; pwd = 1234";
            MySqlConnection Conexao = new MySqlConnection(CONFIG);
            MySqlCommand    Query   = new MySqlCommand();

            Conexao.Open();
            Query.Connection  = Conexao;
            Query.CommandText = "select idprofessor, login, senha FROM professor WHERE login ='******' AND senha = sha1('" + senha + "')";

            MySqlDataReader Reader = Query.ExecuteReader();

            bool verifica = Reader.HasRows;

            if (verifica == true)
            {
                Reader.Read();
                string login = Reader.GetString("login");
                idProfLogado = Reader.GetInt32(0);
                if (login.Equals("admin"))
                {
                    MessageBox.Show("Usuário administrador logado", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Hide();
                    frmMenuAdmin frmMenuAdmin = new frmMenuAdmin();
                    frmMenuAdmin.Show();
                }

                else
                {
                    MessageBox.Show("Docente logado", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Hide();
                    frmMenuDocente frmMenuDocente = new frmMenuDocente();
                    frmMenuDocente.Show();
                }
            }
            else
            {
                MessageBox.Show("Login e/ou senha incorreto(s)!", "login Incorreto", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Conexao.Close();
        }