Example #1
0
        private void telaDeVendaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            fn_vendas tela_venda = new fn_vendas();

            tela_venda.Show();
            this.Hide();
            this.Cursor = Cursors.Default;
        }
        private void Entrar()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                tblogin     = new DataTable();
                tblogin.Clear();
                tblogin = l.tbLogin(txtUser.Text, txtPass.Text);
                csForm.user_id.Clear();
                csForm.user_login.Clear();

                if (tblogin.Rows.Count <= 0)
                {
                    csForm.Mensagem("Não conseguimos encontrar este usuário.\n Verifica o nome de usuário ou a senha inserida", "Login", MessageBoxIcon.Warning);
                    this.Cursor = Cursors.Default;
                    return;
                }

                if (txtUser.Text != string.Empty)
                {
                    #region (Verificação)

                    if (tblogin.Rows[0][1].ToString() == txtUser.Text && tblogin.Rows[0][2].ToString() == txtPass.Text)
                    {
                        if (csForm.Login(tblogin.Rows[0][0].ToString(), tblogin.Rows[0][3].ToString()) == "admin" || csForm.Login(tblogin.Rows[0][0].ToString(), tblogin.Rows[0][3].ToString()) == "gerente")
                        {
                            form_menu.Show();
                        }
                        else if (csForm.Login(tblogin.Rows[0][0].ToString(), tblogin.Rows[0][3].ToString()) == "normal")
                        {
                            form_vendas.Show();
                        }

                        this.Hide();
                    }
                    else
                    {
                        csForm.Mensagem("Não conseguimos encontrar este usuário.\n Verifica o nome de usuário ou a senha inserida", "Login", MessageBoxIcon.Warning);
                    }

                    #endregion
                }
                this.Cursor = Cursors.Default;
            }
            catch (Exception ms)
            {
                MessageBox.Show(ms.Message);
            }
        }