Ejemplo n.º 1
0
        public MudarSenha(TelaPrincipal telaPrincipal, string mail)
        {
            InitializeComponent();
#if DEBUG
            database = @"..\..\..\..\db sqlite\feiratecnica.db";
#endif
            conexao = new SQLiteConnection("Data Source=" + database + ";Version=3;");
            email   = mail;
            telaP   = telaPrincipal;
        }
Ejemplo n.º 2
0
        public ListarFuncionarios(TelaPrincipal telaPrincipal)
        {
            InitializeComponent();
#if DEBUG
            database = @"..\..\..\..\db sqlite\feiratecnica.db";
#endif
            telaP   = telaPrincipal;
            conexao = new SQLiteConnection("Data Source=" + database + ";Version=3;");
            comboBox1.SelectedIndex = 1;
        }
Ejemplo n.º 3
0
        public TelaRegistroFuncionario(TelaPrincipal telaPrincipal)
        {
            InitializeComponent();
#if DEBUG
            database = @"..\..\..\..\db sqlite\feiratecnica.db";
#endif
            cmbSetores.SelectedIndex = 0;
            principal = telaPrincipal;
            conexao   = new SQLiteConnection("Data Source=" + database + ";Version=3;");
        }
Ejemplo n.º 4
0
 public TelaBancoDados(TelaPrincipal telaPrincipal)
 {
     InitializeComponent();
     Conexao.BuscarRegistrosAtivos("Pessoas", dataGridView1);
 }
Ejemplo n.º 5
0
        private void Logar()
        {
            string           email  = "";
            SQLiteCommand    Login  = new SQLiteCommand("SELECT `email` FROM `usuario` WHERE `usuario` = '" + tbUsuario.Text + "' AND `senha` = '" + tbSenha.Text + "'", conexao);
            SQLiteCommand    checar = new SQLiteCommand("SELECT `tipo` FROM `usuario` WHERE `usuario` = '" + tbUsuario.Text + "'", conexao);
            SQLiteDataReader myReader;

            conexao.Open();
            myReader = Login.ExecuteReader();
            int count = 0;

            while (myReader.Read())
            {
                email  = myReader["email"].ToString();
                count += 1;
            }

            if (count == 1)
            {
                string nome = "";
                myReader = checar.ExecuteReader();
                while (myReader.Read())
                {
                    tipo   = myReader["tipo"].ToString();
                    count += 1;
                }
                if (tipo == "True")
                {
                    SQLiteCommand    cliente = new SQLiteCommand("SELECT `nome` FROM `clientes` WHERE `email` = '" + email + "'", conexao);
                    SQLiteDataReader myReader2;
                    myReader2 = cliente.ExecuteReader();

                    while (myReader2.Read())
                    {
                        nome = myReader2["nome"].ToString();
                    }
                }



                if (tipo == "False")
                {
                    SQLiteCommand    func = new SQLiteCommand("SELECT `nome` FROM `funcionarios` WHERE `email` = '" + email + "'", conexao);
                    SQLiteDataReader myReader3;
                    myReader3 = func.ExecuteReader();
                    while (myReader3.Read())
                    {
                        nome = myReader3["nome"].ToString();
                    }
                }



                TelaPrincipal tela = new TelaPrincipal(this, nome, email);

                tela.Show();
                tbUsuario.Focus();
                tbUsuario.Text = "";
                tbSenha.Text   = "";
                conexao.Close();
                this.Hide();
            }
            else if (count == 0)
            {
                MessageBox.Show("Usuário ou senha inválidos", "Erro");
                conexao.Close();
            }
        }