private void btnEntrar_Click(object sender, EventArgs e) { try { Database.Entities.tb_employees emp = new Database.Entities.tb_employees(); emp.ds_email = Model.LoginModel.Email = txtEmail.Text.Trim(); emp.pw_password = Model.LoginModel.Senha = txtSenha.Text.Trim(); Business.EmployeesBusiness busemp = new Business.EmployeesBusiness(); bool verificacao = busemp.Login(emp); if (verificacao == true) { frmMenu tela = new frmMenu(); tela.Show(); Hide(); } else { MessageBox.Show("Usuário Inexistente!"); } } catch (Exception) { MessageBox.Show("Ocorreu um erro!", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnVerificar_Click(object sender, EventArgs e) { try { if (cboOpção.Text == "RG") { employees.nr_rg = mtxtRG.Text.Trim(); } if (cboOpção.Text == "CPF") { employees.nr_cpf = mtxtCPF.Text.Trim(); } if (cboOpção.Text == "Número do Celular") { employees.nr_cellphone = mtxtCelular.Text.Trim(); } Business.EmployeesBusiness busemp = new Business.EmployeesBusiness(); busemp.VerificarRecuperação(employees); Modificar(); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception) { MessageBox.Show("Ocorreu um erro!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnContinuar_Click(object sender, EventArgs e) { try { this.InserirModel(); Database.Entities.tb_employees employees = new Database.Entities.tb_employees { nm_firstName = txtNome.Text.Trim(), nm_lastName = txtSobrenome.Text.Trim(), nr_rg = mtxtRG.Text.Trim(), nr_cpf = mtxtCPF.Text.Trim(), nr_dependents = Convert.ToInt32(nudDependentes.Value), ds_sex = cboSexo.Text, dt_birth = dtpNascimento.Value.ToShortDateString(), ds_state = cboEstado.Text, nr_cep = mtxtCEP.Text.Trim(), ds_note = txtComplemento.Text.Trim(), ds_address = txtEndereço.Text.Trim(), nr_cellphone = mtxtCelular.Text.Trim(), nr_tellphone = mtxtTelefone.Text.Trim(), ds_email = txtEmail.Text.Trim(), pw_password = txtSenha.Text.Trim(), bt_manager = rdbGerente.Checked, bt_employee = rdbFuncionário.Checked, bt_rh = chkRH.Checked, bt_financial = chkFinanceiro.Checked, bt_stock = chkEstoque.Checked, bt_crm = chkCRM.Checked }; Business.EmployeesBusiness db = new Business.EmployeesBusiness(); db.Inserir(employees); frmMenu.Current.openContedor(new frmRegisterEmployee1()); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception) { MessageBox.Show("Ocorreu um erro!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAlterar_Click(object sender, EventArgs e) { try { employees.nr_cpf = mtxtCPF.Text; employees.nr_rg = mtxtRG.Text; employees.nr_cellphone = mtxtCelular.Text; employees.pw_password = txtSenha.Text; Business.EmployeesBusiness db = new Business.EmployeesBusiness(); db.AlterarRecuperação(employees); MessageBox.Show("Senha alterada com sucesso"); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception) { MessageBox.Show("Ocorreu um erro!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { Database.Entities.tb_employees tbemployees = new Database.Entities.tb_employees(); Business.EmployeesBusiness busemployee = new Business.EmployeesBusiness(); Database.Entities.tb_department tbdepartment = new Database.Entities.tb_department(); Business.DepartmentBusiness busdepartment = new Business.DepartmentBusiness(); Database.Entities.tb_function tbfunction = new Database.Entities.tb_function(); Business.FunctionBusiness busfunction = new Business.FunctionBusiness(); Database.Entities.tb_timecard tbtimecard = new Database.Entities.tb_timecard(); Business.TimeCardBusiness bustimecard = new Business.TimeCardBusiness(); Database.Entities.tb_financial tbfinancial = new Database.Entities.tb_financial(); Business.FinancialBusiness busfinancial = new Business.FinancialBusiness(); Database.Entities.tb_benefits tbbenefits = new Database.Entities.tb_benefits(); Business.BenefitsBusiness busbenefits = new Business.BenefitsBusiness(); Database.Entities.tb_bankaccount tbbank = new Database.Entities.tb_bankaccount(); Business.BankAccountBusiness busbank = new Business.BankAccountBusiness(); tbemployees.dt_hiring = dtpContratação.Value.ToShortDateString(); tbemployees.dt_resignation = dtpDemissão.Value.ToShortDateString(); tbdepartment.nm_department = cboDepartamento.Text; tbfunction.nm_function = cboCargo.Text; tbtimecard.hr_fixedInput = mtxtInício.Text; tbtimecard.hr_fixedIntInput = mtxtInícioIntervalo.Text; tbtimecard.hr_fixedIntOutput = mtxtTérminoIntervalo.Text; tbtimecard.hr_fixedOutput = mtxtTérminoIntervalo.Text; tbfinancial.vl_grossSalary = nudSalárioBruto.Value; tbbenefits.bt_food = Convert.ToBoolean(chkValeAlimentação.Checked); tbbenefits.bt_meal = Convert.ToBoolean(chkValeRefeição.Checked); tbbenefits.bt_lifeSafe = Convert.ToBoolean(chkSeguroDeVida.Checked); tbbenefits.bt_transport = Convert.ToBoolean(chkValeTransporte.Checked); tbbenefits.bt_planHealth = Convert.ToBoolean(chkPlanoDeSáude.Checked); tbbenefits.bt_planDental = Convert.ToBoolean(chkPlanoDental.Checked); tbbank.nm_bank = txtNomeDoBanco.Text; tbbank.nr_account = mtxtCódigoDoBanco.Text; tbbank.nr_agency = Convert.ToInt32(mtxtAgênciaDoBanco.Text); tbbank.ds_typePerson = cboTipoDePessoa.Text; busemployee.Inserir1(tbemployees); busdepartment.Inserir(tbdepartment); busfunction.Inserir(tbfunction); bustimecard.Inserir(tbtimecard); busfinancial.Inserir(tbfinancial); busbenefits.Inserir(tbbenefits); busbank.Inserir(tbbank); MessageBox.Show("Funcionário cadastrado com sucesso"); Model.EmployeesModel.firstName = string.Empty; Model.EmployeesModel.lastName = string.Empty; Model.EmployeesModel.RG = string.Empty; Model.EmployeesModel.CPF = string.Empty; Model.EmployeesModel.dependents = 0; Model.EmployeesModel.birth = Convert.ToString(DateTime.Now); Model.EmployeesModel.CEP = string.Empty; Model.EmployeesModel.note = string.Empty; Model.EmployeesModel.address = string.Empty; Model.EmployeesModel.email = string.Empty; Model.EmployeesModel.cellphone = string.Empty; Model.EmployeesModel.tellphone = string.Empty; Model.EmployeesModel.password = string.Empty; Model.EmployeesModel.manager = Convert.ToBoolean(string.Empty); Model.EmployeesModel.employeer = Convert.ToBoolean(string.Empty); Model.EmployeesModel.RH = Convert.ToBoolean(string.Empty); Model.EmployeesModel.financial = Convert.ToBoolean(string.Empty); Model.EmployeesModel.stock = Convert.ToBoolean(string.Empty); Model.EmployeesModel.CRM = Convert.ToBoolean(string.Empty); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception) { MessageBox.Show("Ocorreu um erro!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }