Beispiel #1
0
 public static bool CanPromote(Employee boss, Employee toPromote)
 {
     if(!CanFire(boss, toPromote)) return false;
       switch(boss.Position){
     case EmpRole.President:
       if(toPromote.Position != EmpRole.Supervisor){
     return false;
       }
       break;
     case EmpRole.VicePresident:
       if(toPromote.Position != EmpRole.Worker){
     return false;
       }
       break;
     default:
       return false;
       }
       //make sure boss has a vacancy in his direct org
       if(boss.HasOpening()){
     return true;
       }
       return false;
 }
Beispiel #2
0
        public virtual bool Transfer(Employee toTransfer, Employee targetManager)
        {
            Employee tempEmp;

              if(!Util.CanFire(this, toTransfer) || !Util.CanFire(this, targetManager)){
            return false;
              }
              if(!targetManager.HasOpening()){
            if(toTransfer.Position != targetManager.Position){
              return false;
            }
              }
              //only transfer if the target position is
              if(toTransfer.Position != Util.DirectSubordinate(targetManager.Position)){
            if(toTransfer.Position == targetManager.Position){
              Util.SwapEmployees(this, toTransfer, targetManager);
              return true;
            }
            return false;
              }
              tempEmp = Util.EmployeeFromRole(toTransfer.Position, toTransfer.Name);
              Fire(toTransfer);
              targetManager.Hire(tempEmp);
              return true;
        }