Exemple #1
0
 // 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");
         }
     }
 }
Exemple #2
0
 // If we can process lets show the output
 public override void ApproveLeave(Leave leave)
 {
     Console.WriteLine("LeaveID: {0} Days: {1} Approver: {2}",
                       leave.LeaveID, leave.NumberOfDays, "Project Leader");
 }
Exemple #3
0
 // This is the function which concrete handlers will use to take action, if they are able to take actions.
 public abstract void ApproveLeave(Leave leave);
Exemple #4
0
 // Using this we can apply for leave
 public void ApplyLeave(Leave l)
 {
     LeaveApplied(this, l);
 }