Esempio n. 1
0
        public PayrollCalculator(IEmployee employee)
        {
            if (employee == null)
            {
                throw new ArgumentNullException("employee");
            }

            this.employee = employee;

            this.timeSheetPersistance = new TimeSheetPersistance();

            this.salaryPersistance = new SalaryPersistance();
        }
Esempio n. 2
0
        public decimal CalculatePayroll(Employee employee)
        {
            Decimal payroll = PAYROLL_EMPLOYEE_NOT_FONUND;
            var salaryPersistance = new SalaryPersistance();

            var salary = salaryPersistance.GetSalary(employee.Id);

                if (salary != null)
                {
                    int hoursOvertime = this.timeSheetPersistance.GetHoursOvertime(employee.Id);

                    Decimal payrollExtra = this.calculatePayrollExtraHours(hoursOvertime, employee.IsOutsourcing);

                    payroll = salary + payrollExtra;
                }

            return payroll;
        }