I have a table with UserId and ManagerId. When Editing this table I need to make sure that
if Jim is Jills manager, and Ron is Marks manager, then I should not be able to set Mark as Jim manager, because it would create in infinate loop. I want to validate a form that can set a Manager field to a UserId.
I have a table with UserId and ManagerId. When Editing this table I need
Share
I dont see an infinite loop there… Ron is Marks manager, Jim is Jills Manager. If you set Mark as Jims manager, then you would have a linear tree of management. Ron->Mark->Jim->Jill. No need for recursion 🙂
I understand what your trying to accomplish, but more information would give better insight to help you. Are these Employees a class or an entity of a table?
I’m assuming each employee will only have one manager. Therefore, when setting an employee as another’s manager, progress up the linear tree to see if it would be valid, like so:
I didnt attempt this in visual studios, typed it in here, so if there are any typo’s, please excuse me