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; }
public bool Hire(Employee boss, Employee subordinate) { AddName(subordinate.Name); return boss.Hire(subordinate); }