Exemple #1
0
 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);
 }
Exemple #2
0
        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();
        }
Exemple #3
0
 public void ApplyVacation(VacationRequest vacationRequest)
 {
     ApproveVacation(vacationRequest);
 }