public void RenameItem(int itemId, string newName, TestingServerItemType itemType) { Debug.Assert(itemId > 0); Debug.Assert(!String.IsNullOrEmpty(newName)); Provider.TestRoles(TestorUserRole.Administrator, TestorUserRole.Teacher, TestorUserRole.Laboratorian); using (DataClassesTestorCoreDataContext dataContext = new DataClassesTestorCoreDataContext(TestorSecurityProvider.ConnectionString)) { switch (itemType) { case TestingServerItemType.TestTree: { Provider.TestTreeAccess(itemId); dataContext.RenameTestTreeItem(itemId, newName); } break; case TestingServerItemType.GroupTree: { Provider.TestRoles(TestorUserRole.Administrator); dataContext.RenameGroupTreeItem(itemId, newName); } break; default: break; } } }