Ejemplo n.º 1
0
        private void btn_Logar_Click(object sender, EventArgs e)
        {
            try
            {

                KeyGenDAO keygenDao = new KeyGenDAO();
                keygenDao.InsertData();

                if (keygenDao.selectQuantidadeData() >= 30)
                {
                    frmAtivacao fom = new frmAtivacao();
                    fom.Show();
                    this.Hide();
                }
                else
                {

                    Login login = new Login
                    {
                        Nome = txt_Nome.Text,
                        Senha = txt_Senha.Text
                    };

                    if (loginDao.SelectLogin(login))
                    {

                        string NomeComSubstring = txt_Nome.Text.ToUpper();
                        NomeLoginGlobal.Nome = NomeComSubstring;
                        NomeLoginGlobal.Permicao = loginDao.SelectPermissaoPorUsuario(NomeComSubstring).Rows[0]["Permicao"].ToString().ToUpper();
                        frmMenu chamaMenu = new frmMenu();
                        chamaMenu.Show();
                        this.Hide();
                    }
                    else
                    {
                        Message("Login Enexistente, Crie Um Login E Tente Novamente", "Aviso");
                        FocoNoLogin();
                        LimparTxt();
                    }
                }
            }
            catch (Exception Erro)
            {

                Message("Erro Ao Tentar Acessar O Menu: " + Erro.Message, "Erro");
                LimparTxt();
                FocoNoLogin();
            }
        }
Ejemplo n.º 2
0
        private void frmMenu_Load(object sender, EventArgs e)
        {
            try
            {

                KeyGenDAO keygenDao = new KeyGenDAO();

                if (keygenDao.selectQuantidadeData() > 30)
                {
                    MessageBox.Show("Seu perido de ativação acabou","Aviso");
                    frmAtivacao mostra = new frmAtivacao();
                    mostra.Show();
                    this.Close();
                }

                //----------------------------------------------------------------------
                //                      CÓDIGO NOVO
                int x = Screen.PrimaryScreen.Bounds.Size.Width;
                int y = Screen.PrimaryScreen.Bounds.Size.Height;
                this.Size = new System.Drawing.Size(x, y);
                this.Location = new System.Drawing.Point(0,0);
                //this.StartPosition = FormStartPosition.CenterParent;
                //----------------------------------------------------------------------
                //----------------------------------------------------------------------
                                CarregarRelogio();
                NomeUsuario.Text += NomeLoginGlobal.Nome + " - Permissão: " + NomeLoginGlobal.Permicao;

                if (NomeLoginGlobal.Permicao.Equals("INTERMEDIARIO"))
                {
                    btn_Cadastro.Visible = false;
                    //btn_Venda.Visible = false;
                    btn_Cadastro.Visible = false;
                    btn_CadastroCategoria.Visible = false;
                }

                else if (NomeLoginGlobal.Permicao.Equals("CAIXA"))
                {
                    btn_Estoque.Visible = false;
                    btn_Caixa.Visible = false;
                    btn_CadastroCategoria.Visible = false;
                    btn_PesquisarProdutos.Visible = false;
                }
                else if (NomeLoginGlobal.Permicao.Equals("RESTRITO"))
                {
                    btn_Estoque.Visible = false;
                    btn_CadastroCategoria.Visible = false;
                    btn_Estoque.Visible = false;
                    btn_Venda.Visible = false;
                    btn_PesquisarProdutos.Visible = false;
                    btn_Caixa.Visible = false;
                    btn_ChamaCadastroComanda.Visible = false;
                    btnCadastroCliente.Visible = false;
                }

            }
            catch (Exception Erro)
            {
                Message("Erro Ao Carregar As Informações Do Formulario: " + Erro.Message, "Erro");
            }
        }