private void btnEnrar_Click(object sender, EventArgs e) { try { FuncionariosBO funcBo = new FuncionariosBO(); Funcionarios func = new Funcionarios(); func.Cpf = Convert.ToInt64(mskCPF.Text); func.Senha = txtSenha.Text; funcBo.Login(func); if (funcBo.tem == true) { MessageBox.Show("Seja Bem Vindo!"); this.Hide(); frmMenu menuzin = new frmMenu(); menuzin.Closed += (s, args) => this.Close(); menuzin.Show(); } else { MessageBox.Show("Verifique os dados e tente novamente"); } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnAlterar_Click(object sender, EventArgs e) { for (int i = 0; i < dataGridView1.RowCount; i++) { dataGridView1.Rows[i].DataGridView.Columns.Clear(); } try { string valor = mskCPF.Text; if (ValidaCPF.IsCpf(valor)) { Funcionarios func = new Funcionarios(); FuncionariosBO funcBO = new FuncionariosBO(); func.Nome = txtNome.Text; func.Senha = txtSenha.Text; if ((func.Nome == "") || (func.Nome == null) || (func.Senha == "") || (func.Senha == null)) { MessageBox.Show("Preencha todos os campos"); } else { func.Nome = txtNome.Text.ToUpper(); func.Cpf = Convert.ToInt64(mskCPF.Text); func.Funcao = cbbFuncao.SelectedItem.ToString(); func.Telefone = mskTelefone.Text; func.Celular = mskCelular.Text; func.Senha = txtSenha.Text; funcBO.Editar(func); MessageBox.Show("Funcionário editado com sucesso"); txtNome.Clear(); mskCPF.Clear(); mskBuscaCPF.Clear(); cbbFuncao.SelectedIndex = -1; mskTelefone.Clear(); mskCelular.Clear(); txtBusca.Clear(); txtSenha.Clear(); panel1.Enabled = false; btnAlterar.Enabled = false; } } else { MessageBox.Show("CPF Inválido !"); mskCPF.Clear(); } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnCadastrar_Click(object sender, EventArgs e) { try { string valor = mskCPF.Text; if (ValidaCPF.IsCpf(valor)) { Funcionarios func = new Funcionarios(); FuncionariosBO funcBO = new FuncionariosBO(); func.Nome = txtNome.Text; func.Senha = txtSenha.Text; if ((func.Nome == "") || (func.Nome == null) || (func.Senha == "") || (func.Senha == null)) { MessageBox.Show("Preencha todos os campos"); } else { func.Nome = txtNome.Text.ToUpper(); func.Cpf = Convert.ToInt64(mskCPF.Text); func.Funcao = cbbFuncao.SelectedItem.ToString(); func.Telefone = mskTelefone.Text; func.Celular = mskCelular.Text; func.Senha = txtSenha.Text; funcBO.Gravar(func); MessageBox.Show("Funcionário cadastrado com sucesso"); txtNome.Clear(); mskCPF.Clear(); cbbFuncao.SelectedIndex = -1; mskTelefone.Clear(); mskCelular.Clear(); txtSenha.Clear(); } } else { MessageBox.Show("CPF Inválido!"); mskCPF.Clear(); } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnBuscar_Click(object sender, EventArgs e) { Funcionarios func = new Funcionarios(); FuncionariosBO funcBO = new FuncionariosBO(); FuncionariosDAO funcDAO = new FuncionariosDAO(); if (rbtNome.Checked) { try { func.Nome = txtBusca.Text; dataGridView1.DataSource = funcDAO.BuscaNome(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhum funcionário encontrado"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } if (rbtCPF.Checked) { try { func.Cpf = Convert.ToInt64(mskBuscaCPF.Text); dataGridView1.DataSource = funcDAO.BuscaCPF(func.Cpf); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhum funcionário encontrado"); mskBuscaCPF.Clear(); } } catch { MessageBox.Show("Nenhum funcionário encontrado"); } } }
private void btnBuscar_Click(object sender, EventArgs e) { Funcionarios func = new Funcionarios(); FuncionariosBO funcBO = new FuncionariosBO(); FuncionariosDAO funcDAO = new FuncionariosDAO(); this.dataGridView1.DefaultCellStyle.Font = new Font("Arial", 10); try { func.Nome = txtBusca.Text; dataGridView1.DataSource = funcDAO.BuscaNome(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhum funcionário encontrado"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } }