public bool ApproveVacation(VacationRequest vacationRequest) { if (vacationRequest.GetNumberOfDaysOff() <= GetMaxVacationDaysCanApprove()) { Console.WriteLine("The request was approved by " + this.GetType()); return(true); } else { if (Supervisor != null) { return(Supervisor.ApproveVacation(vacationRequest)); } else { Console.WriteLine("The request wasn't approved"); } } return(false); }
static void Main(string[] args) { Employee teamLeader = new TeamLeader(); Employee projectLeader = new ProjectLeader(); Employee departmentDirector = new DepartmentDirector(); Employee developer = new Developer(); VacationRequest vacationRequest = new VacationRequest(DateTime.Now, new DateTime(2017, 04, 18)); developer.Supervisor = teamLeader; teamLeader.Supervisor = projectLeader; projectLeader.Supervisor = departmentDirector; Console.WriteLine(vacationRequest.GetNumberOfDaysOff()); developer.ApplyVacation(vacationRequest); Console.Read(); }
public void ApplyVacation(VacationRequest vacationRequest) { ApproveVacation(vacationRequest); }