예제 #1
0
파일: Employee.cs 프로젝트: xinyi88/Notes
        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);
        }
예제 #2
0
        public override double CalculatePay(Paycheck paycheck)
        {
            double totalPay = 0.0;

            foreach (TimeCard timeCard in timeCards.Values)
            {
                if (DateUtil.IsInPayPeriod(timeCard.Date,
                                           paycheck.PayPeriodStartDate,
                                           paycheck.PayPeriodEndDate))
                {
                    totalPay += CalculatePayForTimeCard(timeCard);
                }
            }
            return(totalPay);
        }
예제 #3
0
        public override void Execute()
        {
            var empIds = database.GetAllEmployeeIds();

            foreach (int empId in empIds)
            {
                Employee employee = database.GetEmployee(empId);
                if (employee.IsPayDate(payDate))
                {
                    DateTime startDate =
                        employee.GetPayPeriodStartDate(payDate);
                    Paycheck pc = new Paycheck(startDate, payDate);
                    paychecks[empId] = pc;
                    employee.Payday(pc);
                }
            }
        }
예제 #4
0
        public double CalculateDeductions(Paycheck paycheck)
        {
            double totalDues = 0;

            int fridays = NumberOfFridaysInPayPeriod(
                paycheck.PayPeriodStartDate, paycheck.PayPeriodEndDate);

            totalDues = dues * fridays;

            foreach (ServiceCharge charge in charges.Values)
            {
                if (DateUtil.IsInPayPeriod(charge.Time,
                                           paycheck.PayPeriodStartDate,
                                           paycheck.PayPeriodEndDate))
                {
                    totalDues += charge.Amount;
                }
            }

            return(totalDues);
        }
예제 #5
0
 public override double CalculatePay(Paycheck paycheck)
 {
     return(salary);
 }