public string VericarParametros(tb_timecard ticd) { if (ticd.hr_fixedInput == string.Empty || ticd.hr_fixedOutput == string.Empty || ticd.hr_fixedIntInput == string.Empty || ticd.hr_fixedIntOutput == string.Empty) { return("Horários de entrada e saída Obrigatórios!"); } return(string.Empty); }
public void Remover(tb_employees emp, tb_deptfunction defu, tb_timecard ticd, tb_financial fin, tb_benefits ben, tb_bankaccount bank, tb_discounts dis) { defuB.Remover(defu); ticdB.Remover(ticd); finB.Remover(fin); benB.Remover(ben); bankB.Remover(bank); disB.Remover(dis); db.Remover(emp); }
private tb_timecard ReadTimeCard() { tb_timecard ticd = new tb_timecard(); ticd.hr_fixedInput = mtxtEntrada.Text; ticd.hr_fixedOutput = mtxtSaída.Text; ticd.hr_fixedIntInput = mtxtInícioInt.Text; ticd.hr_fixedIntOutput = mtxtFinalInt.Text; return(ticd); }
private void LoadControls() { int id = EmployeesModel.ID; EmployeesDatabase DBemp = new EmployeesDatabase(); DeptFunctionDatabase DBdefu = new DeptFunctionDatabase(); TimeCardDatabase DBticd = new TimeCardDatabase(); FinancialDatabase DBfin = new FinancialDatabase(); BenefitsDatabase DBben = new BenefitsDatabase(); BankAccountDatabase DBbank = new BankAccountDatabase(); DiscountsDatabase DBdis = new DiscountsDatabase(); tb_employees emp = DBemp.ConsultarPorID(id); tb_deptfunction defu = DBdefu.ConsultarPorID(id); tb_timecard ticd = DBticd.ConsultarPorID(id); tb_financial fin = DBfin.ConsultarPorID(id); tb_benefits ben = DBben.ConsultarPorID(id); tb_bankaccount bank = DBbank.ConsultarPorID(id); tb_discounts dis = DBdis.ConsultarPorID(id); if (emp == null) { return; } dtpContratação.Value = Convert.ToDateTime(emp.dt_hiring); dtpDemissão.Value = Convert.ToDateTime(emp.dt_resignation); cboDepartamento.Text = defu.nm_department; cboCargo.Text = defu.nm_function; nudSalárioBruto.Value = fin.vl_grossSalary; chkValeTransporte.Checked = ben.bt_transport; chkValeAlimentação.Checked = ben.bt_food; chkValeRefeição.Checked = ben.bt_meal; chkSeguroDeVida.Checked = ben.bt_lifeSafe; chkPlanoDeSáude.Checked = ben.bt_planHealth; chkPlanoDental.Checked = ben.bt_planDental; nudTarifa.Value = Convert.ToDecimal(ben.vl_transport); nudValeAlimentação.Value = Convert.ToDecimal(ben.vl_food); nudValeRefeição.Value = Convert.ToDecimal(ben.vl_meal); nudSeguroDeVida.Value = Convert.ToDecimal(ben.vl_lifeSafe); nudPlanoDeSáude.Value = Convert.ToDecimal(ben.vl_planHealth); nudPlanoDental.Value = Convert.ToDecimal(ben.vl_planDental); txtNomeDoBanco.Text = bank.nm_bank; mtxtAgência.Text = bank.nr_agency.ToString(); mtxtConta.Text = bank.nr_account; cboTipoDePessoa.Text = bank.ds_typePerson; nudPensãoAlimentícia.Value = Convert.ToDecimal(dis.vl_foodPension); cboTipoDeSalário.Text = fin.ds_typeSalary; mtxtEntrada.Text = ticd.hr_fixedInput; mtxtSaída.Text = ticd.hr_fixedOutput; mtxtInícioInt.Text = ticd.hr_fixedIntInput; mtxtFinalInt.Text = ticd.hr_fixedIntOutput; }
private void Insirir(tb_employees emp, tb_deptfunction defu, tb_timecard ticd, tb_financial fin, tb_benefits ben, tb_bankaccount bank, tb_discounts dis) { int id = db.Insirir(emp); defuB.Insirir(defu, id); ticdB.Insirir(ticd, id); finB.insirir(fin, id); benB.Insirir(ben, id); bankB.Insirir(bank, id); disB.insirir(dis, id); }
private void Alterar(tb_employees emp, tb_deptfunction defu, tb_timecard ticd, tb_financial fin, tb_benefits ben, tb_bankaccount bank, tb_discounts dis) { int id = EmployeesModel.ID; defuB.Alterar(defu, id); ticdB.Alterar(ticd, id); finB.Alterar(fin, id); benB.Alterar(ben, id); bankB.Alterar(bank, id); disB.Alterar(dis, id); db.Alterar(emp, id); }
public string UpdateEmployee(tb_employees emp, tb_deptfunction defu, tb_timecard ticd, tb_financial fin, tb_benefits ben, tb_bankaccount bank, tb_discounts dis) { string error = string.Empty; if (error == string.Empty) { error = this.VericarParametros(emp); } if (error == string.Empty) { error = defuB.VericarParametros(defu); } if (error == string.Empty) { error = ticdB.VericarParametros(ticd); } if (error == string.Empty) { error = finB.VericarParametros(fin); } if (error == string.Empty) { error = benB.VericarParametros(ben); } if (error == string.Empty) { error = bankB.VericarParametros(bank); } if (error == string.Empty) { error = disB.VericarParametros(dis); } if (error == string.Empty) { this.Alterar(emp, defu, ticd, fin, ben, bank, dis); return("Alterado com sucesso!"); } else { return(error); } }
public string DeleteEmployee(int id) { tb_employees emp = ConsultarPorID(id); tb_deptfunction defu = defuB.ConsultarPorID(id); tb_timecard ticd = ticdB.ConsultarPorID(id); tb_financial fin = finB.ConsultarPorID(id); tb_benefits ben = benB.ConsultarPorID(id); tb_bankaccount bank = bankB.ConsultarPorID(id); tb_discounts dis = disB.ConsultarPorID(id); if (emp != null && defu != null && ticd != null && fin != null && ben != null && bank != null && dis != null) { this.Remover(emp, defu, ticd, fin, ben, bank, dis); return("Funcionário Removido com Sucesso!"); } else { return("Funcionário Inexistente!"); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { tb_employees emp = this.ReadEmployees(); tb_deptfunction defu = this.ReadDeptFunction(); tb_timecard ticd = this.ReadTimeCard(); tb_financial fin = this.ReadFinancial(); tb_benefits ben = this.ReadBenefits(); tb_bankaccount bank = this.ReadBankAccount(); tb_discounts dis = this.ReadDiscounts(); EmployeesBusiness EB = new EmployeesBusiness(); string res = EB.UpdateEmployee(emp, defu, ticd, fin, ben, bank, dis); MessageBox.Show(res, "liriou's Burguer", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ocorreu um erro!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Remover(tb_timecard ticd) { db.Remover(ticd); }
public void Alterar(tb_timecard ticd, int id) { ticd.id_emp = id; db.Alterar(ticd); }
public void Insirir(tb_timecard ticd, int id) { ticd.id_emp = id; db.Inserir(ticd); }