public void SetItemParent(int itemId, int newParent, TestingServerItemType itemType) { Debug.Assert(itemId > 0); Debug.Assert(newParent >= 0); Provider.TestRoles(TestorUserRole.Administrator, TestorUserRole.Teacher, TestorUserRole.Laboratorian); using (DataClassesTestorCoreDataContext dataContext = new DataClassesTestorCoreDataContext(TestorSecurityProvider.ConnectionString)) { switch (itemType) { case TestingServerItemType.None: break; case TestingServerItemType.TestTree: { Provider.TestTreeAccess(itemId); dataContext.ReparentTestTreeItem(itemId, newParent); } break; case TestingServerItemType.GroupTree: { Provider.TestRoles(TestorUserRole.Administrator); dataContext.ReparentGroupTreeItem(itemId, newParent); } break; default: break; } } }