public double CalculateDeductions(Paycheck paycheck)
        {
            double totalDues = 0;
            int fridays = NumberOfFridaysInPayPeriod(paycheck.PayPeriodStartDate, paycheck.PayPeriodEndDate);

            totalDues = Dues*fridays;
            return totalDues;
        }
Esempio n. 2
0
 public void Payday(Paycheck paycheck)
 {
     double grossPay = Classification.CalculatePay(paycheck);
     double deductions = Affiliation.CalculateDeductions(paycheck);
     double netPay = grossPay - deductions;
     paycheck.GrossPay = grossPay;
     paycheck.Deductions = deductions;
     paycheck.NetPay = netPay;
     Method.Pay(paycheck);
 }
        public int Execute()
        {
            IEnumerable<int> ids= PayrollDatabase.GetAllEmployeeIds();
            foreach (var empId in ids)
            {
                Employee employee = PayrollDatabase.GetEmployee(empId);
                if (employee.IsPayDate(_payDate))
                {
                    DateTime startDate = employee.GetPayPeriodStartDate(_payDate);

                    Paycheck pc = new Paycheck(startDate, _payDate);
                    paychecks[empId] = pc;
                    employee.Payday(pc);
                }
            }
            return 0;
        }
 private bool IsInPayPeriod(TimeCard timecard, Paycheck paycheck)
 {
     DateTime payPeriodEndDate = paycheck.PayPeriodEndDate;
     DateTime payPeriodStartDate = paycheck.PayPeriodStartDate;
     return timecard.Date >= payPeriodStartDate && timecard.Date <= payPeriodEndDate;
 }
 public double CalculatePay(Paycheck paycheck)
 {
     return TimeCards
         .Where(timecard => IsInPayPeriod(timecard, paycheck))
         .Sum(timecard => CalculatePayForTimeCard(timecard));
 }