Exemplo n.º 1
0
        private string GetFullPath(ProjectArea parentItem, string name)
        {
            string result = name;

            while (parentItem != null)
            {
                result = parentItem.Name + "\\" + result;
                parentItem = parentItem.ParentProjectArea;
            }

            if (result.ToLower().StartsWith("area\\"))
            {
                result = result.Remove(0, result.IndexOf('\\') + 1);
            }

            return this.FormatAreaName(result);
        }
Exemplo n.º 2
0
        private List<ProjectArea> LoadAreas(XmlNode parentNode, ProjectArea parentItem = null)
        {
            var result = new List<ProjectArea>();

            foreach (XmlNode item in parentNode.ChildNodes)
            {
                if (item.Name == "Children")
                {
                    result = this.LoadAreas(item, parentItem);
                }
                else
                {
                    string nodeId = this.GetNodeID(item.OuterXml);
                    NodeInfo nodeInfo = this.commonStructureService.GetNode(nodeId);

                    var pi = new ProjectArea
                    {
                        Name = nodeInfo.Name,
                        ParentUri = nodeInfo.ParentUri,
                        Path = nodeInfo.Path,
                        ProjectUri = nodeInfo.ProjectUri,
                        StructureType = nodeInfo.StructureType,
                        Uri = nodeInfo.Uri,
                        FullPath = this.GetFullPath(parentItem, nodeInfo.Name),
                        ParentProjectArea = parentItem
                    };
                    pi.Children = this.LoadAreas(item, pi);
                    result.Add(pi);
                }
            }

            return result;
        }
Exemplo n.º 3
0
 public void DeleteArea(ProjectArea projectArea, ProjectArea reAssignArea = null)
 {
     if (projectArea != null)
     {
         ProjectArea newProjectArea = reAssignArea ?? projectArea.ParentProjectArea;
         this.commonStructureService.DeleteBranches(new[] { projectArea.Uri }, newProjectArea.Uri);
     }
     else
     {
         throw new ArgumentNullException("projectArea", "A valid Project Area is required to perform a delete");
     }
 }