Example #1
0
        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);
        }
Example #2
0
 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);
 }
Example #3
0
        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);
        }
Example #4
0
        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;
        }
Example #5
0
        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);
        }
Example #6
0
        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);
        }
Example #7
0
        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);
            }
        }
Example #8
0
        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!");
            }
        }
Example #9
0
        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);
            }
        }
Example #10
0
 public void Remover(tb_timecard ticd)
 {
     db.Remover(ticd);
 }
Example #11
0
        public void Alterar(tb_timecard ticd, int id)
        {
            ticd.id_emp = id;

            db.Alterar(ticd);
        }
Example #12
0
        public void Insirir(tb_timecard ticd, int id)
        {
            ticd.id_emp = id;

            db.Inserir(ticd);
        }