Example #1
0
 public void Execute()
 {
     Employee employee = PayRollDatabase.GetEmloyee(_empId);
     if (employee != null)
     {
         HourlyClassification hc = employee.Classification as HourlyClassification;
         if (hc != null)
         {
             hc.AddTimeCard(new TimeCard(_date, _hourse)));
         }
         else
         {
             throw new InvalidOperationException("Попытка добавить карточку табельного учёта" +
                 "для работника не на почасовой оплате");
         }
     }
     else
     {
         throw new InvalidOperationException("Работник не найден");
     }
 }
Example #2
0
        public void AddServiceCharge()
        {
            int empId = 2;
            AddHourlyEmployee hourlyEmployee = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            hourlyEmployee.Execute();

            Employee         employee = PayRollDatabase.GetEmloyee(empId);
            UnionAffiliation af       = new UnionAffiliation();

            employee.Affiliation = af;
            int memberId = 86;

            PayRollDatabase.AddUnionMember(memberId, employee);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, new DateTime(2005, 8, 8), 12.95);

            sct.Execute();
            ServiceCharge sc = af.GetServiceCharge(new DateTime(2005, 8, 8));

            Assert.IsNotNull(sc);
            Assert.AreEqual(12.95, sc.Amount, .001);
        }