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; }
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; }
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;"); }
public TelaBancoDados(TelaPrincipal telaPrincipal) { InitializeComponent(); Conexao.BuscarRegistrosAtivos("Pessoas", dataGridView1); }
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(); } }