Example #1
0
        private void BtnDeslogar_Click(object sender, EventArgs e)
        {
            telaLogin     tela  = new telaLogin();
            telaPrincipal tela2 = new telaPrincipal();

            tela2.Hide();
            tela.Show();
        }
Example #2
0
        private void TelaPrincipal_Load(object sender, EventArgs e)
        {
            if (Conta.Permissao == "assistente")
            {
                btnCadastrar.Visible   = true;
                btnEditar.Visible      = true;
                btnExcluir.Visible     = true;
                btnPesquisar.Visible   = true;
                btnEditarNotas.Visible = false;
                btnVerNotas.Visible    = false;
                btnLançarNotas.Visible = false;
                label1.Visible         = true;
                label2.Visible         = true;
                label3.Visible         = true;
                label4.Visible         = true;
                label5.Visible         = false;
                label6.Visible         = false;
                label7.Visible         = false;
            }
            else if (Conta.Permissao == "aluno")
            {
                btnEditarNotas.Visible = false;
                btnCadastrar.Visible   = false;
                btnEditar.Visible      = false;
                btnExcluir.Visible     = false;
                btnPesquisar.Visible   = false;
                btnVerNotas.Visible    = true;
                btnLançarNotas.Visible = false;
                label1.Visible         = false;
                label2.Visible         = false;
                label3.Visible         = false;
                label4.Visible         = false;
                label5.Visible         = true;
                label6.Visible         = false;
                label7.Visible         = false;
            }
            else if (Conta.Permissao == "professor")
            {
                btnCadastrar.Visible   = false;
                btnEditar.Visible      = false;
                btnExcluir.Visible     = false;
                btnPesquisar.Visible   = false;
                btnVerNotas.Visible    = false;
                btnEditarNotas.Visible = true;
                btnLançarNotas.Visible = true;
                label1.Visible         = false;
                label2.Visible         = false;
                label3.Visible         = false;
                label4.Visible         = false;
                label5.Visible         = false;
                label6.Visible         = true;
                label7.Visible         = true;
            }

            _obj = this;

            UCHome uc = new UCHome();

            uc.Dock = DockStyle.Fill;
            panelContainer.Controls.Add(uc);
        }
Example #3
0
        private void BtnLogar_Click(object sender, EventArgs e)
        {
            //SE TODOS OS CAMPOS ESTIVEREM PREENCHIDOS
            if ((!txtEmail.Text.Equals("")) &&
                (!txtSenha.Text.Equals("")))
            {
                Login login = new Login();
                login.Email = txtEmail.Text;
                login.Senha = txtSenha.Text;
                Conta.Email = txtEmail.Text;
                Conta.Senha = txtSenha.Text;

                if (login.VerificarAssistente())
                {
                    if (login.VerificarAssistente())
                    {
                        Conta.Permissao = "assistente";
                        telaPrincipal tela = new telaPrincipal {
                            tela = this
                        };
                        this.Hide();
                        tela.Show();
                        MessageBox.Show("Bem vindo " + login.Email);
                    }
                    else
                    {
                        telaLogin tela = new telaLogin {
                            tela = this
                        };
                        this.Hide();
                        tela.Show();
                    }
                }
                else if (login.VerificarAluno())
                {
                    if (login.VerificarAluno())
                    {
                        Conta.Permissao = "aluno";
                        telaPrincipal tela = new telaPrincipal {
                            tela = this
                        };
                        this.Hide();
                        tela.Show();
                        MessageBox.Show("Bem vindo " + login.Email);
                    }
                    else
                    {
                        telaLogin tela = new telaLogin {
                            tela = this
                        };
                        this.Hide();
                        tela.Show();
                    }
                }

                else if (login.VerificarProfessor())
                {
                    if (login.VerificarProfessor())
                    {
                        Conta.Permissao = "professor";
                        telaPrincipal tela = new telaPrincipal {
                            tela = this
                        };
                        this.Hide();
                        tela.Show();
                        MessageBox.Show("Bem vindo " + login.Email);
                    }
                    else
                    {
                        telaLogin tela = new telaLogin {
                            tela = this
                        };
                        this.Hide();
                        tela.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Email ou senha inválidos!");
                    //LIMPAR OS CAMPOS
                    txtEmail.Clear();
                    txtSenha.Clear();
                    //FOCAR NO CAMPO EMAIL
                    txtEmail.Focus();
                }
            }

            else
            {
                //SE OS CAMPOS NÃO ESTIVEREM PREENCHIDOS
                MessageBox.Show("Preencha todos os campos!");
                //LIMPAR OS CAMPOS
                txtEmail.Clear();
                txtSenha.Clear();
                //FOCAR NO CAMPO EMAIL
                txtEmail.Focus();
            }
            //LIMPAR OS CAMPOS
            txtEmail.Clear();
            txtSenha.Clear();
            //FOCAR NO CAMPO EMAIL
            txtEmail.Focus();
        }