Exemplo n.º 1
0
        private void FillNodeRecursive(Proxy.DataSourceServiceReference.NodeDS.TreeRow rootRow, ModelDS.TreeItemRow rootItemRow, Proxy.DataSourceServiceReference.NodeDS treeDS)
        {
            ModelDS.TreeItemRow tiRow = this.Model.TreeItem.NewTreeItemRow();

            rootRow = rootRow == null?treeDS.Tree.Where(r => r.IsParent_IdNull()).FirstOrDefault() : rootRow;

            if (rootItemRow == null)
            {
                tiRow.SetParent_IdNull();
            }
            else
            {
                tiRow.Parent_Id = rootItemRow.Id;
            }
            tiRow.Item_Id = rootRow.Item_Id;
            if (rootRow.IsItemParent_IdNull())
            {
                tiRow.SetItemParent_IdNull();
            }
            else
            {
                tiRow.ItemParent_Id = rootRow.ItemParent_Id;
            }
            tiRow.ItemBranch_Id = rootRow.ItemBranch_Id;
            tiRow.Name          = rootRow.Name;
            //tiRow.Selected = rootRow.IsSelectedNull() ? false : row.Selected;
            tiRow.Expandable = rootRow.HasChildNodes;
            this.Model.TreeItem.AddTreeItemRow(tiRow);

            foreach (Proxy.DataSourceServiceReference.NodeDS.TreeRow row in treeDS.Tree.Where(r => !r.IsParent_IdNull() && r.Parent_Id == rootRow.Id))
            {
                FillNodeRecursive(row, tiRow, treeDS);
            }
        }