Пример #1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (txtUser.Text.Equals("1") && txtPass.Text.Equals("1"))
     {
         this.Hide();
         FrmPrincipal frmPrincipal = new FrmPrincipal();
         frmPrincipal.Show();
         //this.Close();
     }
     else
     {
         MessageBox.Show("Usuario ou senha inválidos");
     }
 }
Пример #2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (pbCarregar.Value < 100)
     {
         timer1.Enabled   = true;
         pbCarregar.Value = pbCarregar.Value + 2;
     }
     else
     {
         timer1.Enabled = false;
         FrmPrincipal form = new FrmPrincipal();
         form.Show();
         this.Visible = false;
     }
 }
Пример #3
0
        //botao login
        private void btnLogin_Click(object sender, EventArgs e)
        {
            ////validacao de usuario e senha
            //if (txtUser.Text.Equals("1") && txtPass.Text.Equals("1"))
            //{
            //    this.Hide();
            //FrmPrincipal frmPrincipal = new FrmPrincipal();
            //frmPrincipal.Show();
            //}
            //else
            //{
            //    MessageBox.Show("Usuário ou senha incorretos");
            //}
            string email = txtUser.Text;
            string senha = txtPass.Text;

            conexao = new ClasseConexao();
            ds      = new DataSet();
            Compartilha comp = new Compartilha();             //get & set nivel/id

            string sql = String.Format("SELECT * FROM FUNCIONARIO WHERE EMAIL = '{0}' AND SENHA = '{1}'", email, senha);

            ds = conexao.executarSQL(sql);

            int conta = ds.Tables[0].Rows.Count;

            if (conta > 0)
            {
                comp.Nivel = ds.Tables[0].Rows[0]["CARGO"].ToString();
                comp.Id    = ds.Tables[0].Rows[0]["ID_FUNCIONARIO"].ToString();
                comp.Nome  = ds.Tables[0].Rows[0]["NOME"].ToString();
                this.Hide();
                FrmPrincipal frmPrincipal = new FrmPrincipal();
                frmPrincipal.Show();
            }
            else
            {
                conexao = new ClasseConexao();
                ds      = new DataSet();
                conta   = 0;

                sql = String.Format("SELECT * FROM PROFESSOR WHERE EMAIL = '{0}' AND SENHA = '{1}'", email, senha);

                ds = conexao.executarSQL(sql);

                conta = ds.Tables[0].Rows.Count;

                if (conta > 0)
                {
                    comp.Nivel = "professor";
                    comp.Id    = ds.Tables[0].Rows[0]["ID_PROFESSOR"].ToString();
                    comp.Nome  = ds.Tables[0].Rows[0]["NOME"].ToString();
                    this.Hide();
                    FrmPrincipal frmPrincipal = new FrmPrincipal();
                    frmPrincipal.Show();
                }
                else
                {
                    MessageBox.Show("Usuário ou senha incorretos.");
                }
            }
        }