public void Execute() { Employee e = PayrollDatabase.instance.GetUnionMember(memberId); if (e != null) { UnionAffiliation ua = null; if (e.Affiliation is UnionAffiliation) { ua = e.Affiliation as UnionAffiliation; } if (ua != null) { ua.AddServiceCharge(new ServiceCharge(time, charge)); } else { throw new InvalidOperationException("Попытка добавить плату за услуги для члена" + " профсоюза с незарегистрированным членством"); } } else { throw new InvalidOperationException("Член профсоюза не найден"); } }
protected override void RecordMembership(Employee e) { Affiliation affiliation = e.Affiliation; if (affiliation is UnionAffiliation) { UnionAffiliation unionAffiliation = affiliation as UnionAffiliation; int memberId = unionAffiliation.MemberId; PayrollDatabase.instance.RemoveUnionMember(memberId); } }