/// <summary> /// Updates subject ScholarlyworkItem to selected CategoryNodes association. /// </summary> /// <returns>true, if successful; else false.</returns> public bool SaveAssociation() { bool result = false; if (TreeView.Nodes.Count != 0) { for (int Index = 0; Index < TreeView.CheckedNodes.Count; Index++) { SelectedIdList.Add(new Guid(TreeView.CheckedNodes[Index].Value)); } using (ResourceDataAccess dataAccess = new ResourceDataAccess(base.CreateContext())) { List <CategoryNode> categoryNodeList = new List <CategoryNode>(); categoryNodeList = dataAccess.GetCategoryNodeList(SelectedIdList); foreach (CategoryNode node in categoryNodeList) { SelectedList.Add(node); } AuthorizeResourcesBeforeSave(dataAccess); result = dataAccess.SaveScholarlyItemCategoryAssociation(ResourceItemId, SelectedList as IList <Zentity.ScholarlyWorks.CategoryNode>, AuthenticatedToken, Constants.PermissionRequiredForAssociation); } if (result) { HeaderMessageLabel.Visible = true; ShowMessage(GlobalResource.MsgCategoryNodeAssociationSuccessfull, false); } } else { HeaderMessageLabel.Visible = true; ShowMessage(GlobalResource.MsgCategoryNodeNotFound, false); result = false; } return(result); }