示例#1
0
        private void AddNodeToCategory(ColumnNode node, Categoria parent, ref int nextIndex)
        {
            if (node.hasValue && node.nodes.Count == 0)
            {
                parent.metricas.Add(node.title);
                parent.columnMetrics.Add(new CatMetrics {
                    ColumnName = node.title, ColumnIndex = node.id
                });
                return;
            }

            Categoria categoria = new Categoria {
                ParentId = parent.CatId, CatId = nextIndex++, nome = node.title, categoriasfilhas = new List <Categoria>(), metricas = new List <string>(), columnMetrics = new List <CatMetrics>()
            };

            parent.categoriasfilhas.Add(categoria);
            if (node.hasValue)
            {
                categoria.CatValue   = node.title;
                categoria.CatValueId = node.id;
            }
            foreach (ColumnNode childNode in node.nodes)
            {
                AddNodeToCategory(childNode, categoria, ref nextIndex);
            }
        }
示例#2
0
 public ColumnNode(ColumnNode n)
 {
     this.id         = n.id;
     this.title      = n.title;
     this.hasValue   = n.hasValue;
     this.FirstValue = n.FirstValue;
     this.nodes      = new List <ColumnNode>();
 }
示例#3
0
        public void AddNodeToTreeColumn2(Node node, List <ColumnNode> place)
        {
            ColumnNode newNode = new ColumnNode(node);

            place.Add(newNode);
            foreach (Node child in node.Children)
            {
                AddNodeToTreeColumn2(child, newNode.nodes);
            }
        }
示例#4
0
        private void AddNodeToParent(ColumnNode node, List <ColumnNode> nodes, ColumnNode oldparent)
        {
            if (oldparent == null)
            {
                ColumnNode newNode = new ColumnNode(node);
                nodes.Add(newNode);
                foreach (ColumnNode childNode in node.nodes)
                {
                    AddNodeToParent(childNode, newNode.nodes, node);
                }
                return;
            }

            if (oldparent.nodes.Count == 1 && !node.hasValue)
            {
                foreach (ColumnNode childNode in node.nodes)
                {
                    AddNodeToParent(childNode, nodes, node);
                }
                return;
            }

            List <ColumnNode> childrenVal = node.nodes.FindAll(x => x.hasValue);

            if (childrenVal.Count == 1 && !childrenVal[0].title.Equals(node.title) && childrenVal[0].nodes.Count > 0)
            {
                foreach (ColumnNode childNode in node.nodes)
                {
                    AddNodeToParent(childNode, nodes, oldparent);
                }
                return;
            }

            ColumnNode newChildNode = new ColumnNode(node);

            nodes.Add(newChildNode);
            foreach (ColumnNode childNode in node.nodes)
            {
                AddNodeToParent(childNode, newChildNode.nodes, node);
            }
            return;
        }
示例#5
0
 public void AddNodeToTreeColumn(Node node, List <ColumnNode> place)
 {
     if (node.HasValue || node.Children.Count > 1)
     {
         ColumnNode newNode = new ColumnNode(node);
         //newNode.ParentNode = parentNode;
         place.Add(newNode);
         foreach (Node child in node.Children)
         {
             AddNodeToTreeColumn(child, newNode.nodes);
         }
     }
     else
     {
         foreach (Node child in node.Children)
         {
             AddNodeToTreeColumn(child, place);
         }
     }
 }