private void AddPaycheck(int empId, DateTime payDate, Paycheck pc)
        {
            if (!paychecks.ContainsKey(empId) || paychecks[empId] == null)
            {
                paychecks[empId] = new List <Paycheck>();
            }

            paychecks[empId].Add(pc);
        }
Exemple #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);
        }
Exemple #3
0
        public override double CalculatePay(Paycheck paycheck)
        {
            double totalPay      = 0.0;
            var    salesReceipts = PayrollDatabase.GetSalesReceipts(empId);

            foreach (SalesReceipt salesReceipt in salesReceipts)
            {
                if (IsInPayPeriod(salesReceipt, paycheck.PayDate))
                {
                    totalPay += CalculatePayForSalesReceipt(salesReceipt);
                }
            }
            return(totalPay);
        }
        public override double CalculatePay(Paycheck paycheck)
        {
            double totalPay  = 0.0;
            var    timecards = PayrollDatabase.GetTimeCards(empId);

            foreach (TimeCard timeCard in timecards)
            {
                if (IsInPayPeriod(timeCard, paycheck.PayDate))
                {
                    totalPay += CalculatePayForTimeCard(timeCard);
                }
            }
            return(totalPay);
        }
        public void Execute()
        {
            var employees = PayrollDatabase.GetAllEmployee();

            foreach (var e in employees)
            {
                if (e.IsPayDate(payDate))
                {
                    Paycheck pc = new Paycheck(payDate);
                    AddPaycheck(e.Id, payDate, pc);
                    e.Payday(pc);
                }
            }
        }
Exemple #6
0
 public abstract double CalculatePay(Paycheck paycheck);
 public double CalculateDeductions(Paycheck paycheck)
 {
     return(0);
 }
Exemple #8
0
 public abstract void Pay(Paycheck paycheck);