// in this function we will check if this employee can // process or he need to pass on to next employee void ProjectLeader_onLeaveApplied(Employee e, Leave l) { // check if we can process this request if (l.NumberOfDays < MAX_LEAVES_CAN_APPROVE) { // process it on our level only ApproveLeave(l); } else { // if we cant process pass on to the supervisor // so that he can process if (Supervisor != null) { Supervisor.LeaveApplied(this, l); } } }
// in this function we will check if this employee can // process or some other action is needed void HR_onLeaveApplied(Employee e, Leave l) { // check if we can process this request if (l.NumberOfDays < MAX_LEAVES_CAN_APPROVE) { // process it on our level only ApproveLeave(l); } else { // if we cant process pass on to the supervisor // so that he can process if (Supervisor != null) { Supervisor.LeaveApplied(this, l); } else { // There is no one up in hierarchy so lets // tell the user what he needs to do now Console.WriteLine("Leave application suspended, Please contact HR"); } } }