/// <summary> /// Возвращает путь для вставки в конец /// </summary> /// <param name="parentPath"></param> /// <returns></returns> public HierarchyId GetAppendPath(HierarchyId parentPath) { var index = context.Blocks.Count(x => x.Path.GetLevel() == parentPath.GetLevel() + 1 && x.Path.IsDescendantOf(parentPath)) + 1; HierarchyId newItemPath = HierarchyId.Parse(parentPath + index.ToString() + "/"); return newItemPath; }
public void Remove(HierarchyId path) { var attrsToRemove = context.AttributeMetadatas.Where(x => x.Block.Path.IsDescendantOf(path)); foreach (var attributeMetadata in attrsToRemove) { Console.WriteLine(attributeMetadata.AttributeName); } Console.WriteLine("-------------"); var l = context.Blocks.Where(x => x.Path.IsDescendantOf(path)).ToList(); foreach (var block in l) { Console.WriteLine(block.BlockName); } }
private void Dive(TreeItem currentNode, HierarchyId currentPath) { var newBlock = new Block { Id = Guid.NewGuid(), Path = currentPath, BlockName = currentNode.Name, IsChoice = currentNode.IsChoice, Order = currentNode.Order, AttributeList = new Collection<AttributeMetadata>() }; var subBlocks = currentNode.SubItems.Where(x => x.SubItems != null).ToArray(); //блок for (int i = 1; i <= subBlocks.Length; i++) { var subItem = currentNode.SubItems[i - 1]; Dive(subItem, HierarchyId.Parse(currentPath + i.ToString() + "/")); } /*var subAttributes = currentNode.SubItems.Where(x => x.SubItems == null).Select(x => new AttributeMetadata { Id = Guid.NewGuid(), AttributeName = x.Name, BlockId = newBlock.Id, Placeholder = x.Placeholder, });*/ foreach (var node in currentNode.SubItems.Where(x => x.SubItems == null)) { newBlock.AttributeList.Add(new AttributeMetadata { Id = Guid.NewGuid(), AttributeName = node.Name, Placeholder = node.Placeholder, Order = node.Order }); } context.Blocks.Add(newBlock); }
public int HumanResources_UspUpdateEmployeeLogin(int?businessEntityId, System.Data.Entity.Hierarchy.HierarchyId organizationNode, string loginId, string jobTitle, System.DateTime?hireDate, bool?currentFlag) { return(0); }