Example #1
0
        public ActionResult UpdateEmployee(EmployeesDTO employeesDTO)
        {
            bool isUpdated = _EmployeesBusiness.UpdateEmployee(employeesDTO);

            //var employee = _EmployeesBusiness.GetEmployee(employeesDTO.Id);
            return(RedirectToAction("GetEmployees"));
        }
Example #2
0
        private void Update(int id, string name, int age, DateTime?hiringDate, decimal grossSalary)
        {
            try
            {
                using (var employees = new EmployeesBusiness())
                {
                    var entity = new EmployeesEntity();
                    entity.Id          = id;
                    entity.Name        = name;
                    entity.Age         = age;
                    entity.HiringDate  = hiringDate;
                    entity.GrossSalary = grossSalary;
                    var opSuccessful = employees.UpdateEmployee(entity);

                    var resultMessage = opSuccessful ? "Done Successfully" : "Error happened or no Employee found to update";

                    MessageBox.Show(resultMessage, "Success", MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
                //Log exception error
                _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);

                MessageBox.Show("UserInterface:EmployeesForm::Update::Error occured." +
                                Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK);
            }
        }
Example #3
0
 private void UpdateEmployee(int id, string name, int age, DateTime?hiringDate, decimal grossSalary)
 {
     try
     {
         using (var employees = new EmployeesBusiness())
         {
             var entity = new EmployeesEntity();
             entity.Id          = id;
             entity.Name        = name;
             entity.Age         = age;
             entity.HiringDate  = hiringDate;
             entity.GrossSalary = grossSalary;
             var opSuccessful = employees.UpdateEmployee(entity);
         }
     }
     catch (Exception ex)
     {
         //Log exception error
         _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);
     }
 }
Example #4
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 #5
0
        public IHttpActionResult UpdateEmployee(EmployeesDTO employeesDTO)
        {
            bool isUpdated = _EmployeesBusiness.UpdateEmployee(employeesDTO);

            return(Ok(isUpdated));
        }