Beispiel #1
0
        public void Execute()
        {
            Employee emp = PayRollDatabase.GetUnionMember(_memberId);

            if (emp != null)
            {
                UnionAffiliation ua = null;
                if (emp.Affiliation is UnionAffiliation)
                {
                    ua = emp.Affiliation as UnionAffiliation;
                }
                if (ua != null)
                {
                    ua.AddServiceCharge(new ServiceCharge(_time, _charge));
                }
                else
                {
                    throw new InvalidOperationException("Попытка добавить плату за услуги для члена" +
                                                        "профсоюза с незарегистрированным членством");
                }
            }
            else
            {
                throw new InvalidOperationException("Член профсоюза не найден.");
            }
        }
        public void Execute()
        {
            PaymentClassification pc = MakeClassification();
            PaymentScheduel       ps = MakeSchedule();
            PaymentMethod         pm = new HoldMethod();

            Employee emp = new Employee(_empid, _name, _address);

            emp.Classification = pc;
            emp.Schedule       = ps;
            emp.Method         = pm;
            PayRollDatabase.AddEmployee(empid, emp);
        }
Beispiel #3
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("Работник не найден");
     }
 }
        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);
        }
 public void Execute()
 {
     PayRollDatabase.DeleteEmployee(id);
 }