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);
            }
        }
Exemplo n.º 2
0
        public void FillNode(int branchID, int nodeID)
        {
            Proxy.DataSourceServiceReference.NodeDS inputTreeDS = new Proxy.DataSourceServiceReference.NodeDS();

            Proxy.DataSourceServiceReference.NodeDS.RootNodeDataRow inputRootRow = inputTreeDS.RootNodeData.NewRootNodeDataRow();


            inputRootRow.Item_Id       = nodeID;
            inputRootRow.ItemBranch_Id = branchID;

            inputTreeDS.RootNodeData.AddRootNodeDataRow(inputRootRow);
            // доставка данных
            Proxy.DataSourceServiceReference.NodeDS nodeDS = dataSource.Node(inputTreeDS);

            this.Model.TreeItem.Clear();

            FillNodeRecursive(null, null, nodeDS);

            ModelDS.TreeItemRow rootNodeRow = this.modelDS.TreeItem.Where(r => r.IsParent_IdNull()).FirstOrDefault();
            rootNodeRow.UseFilterPanel    = false;
            rootNodeRow.UseSelectionPanel = false;
            rootNodeRow.Expanded          = true;

            this.modelDS.TreeItem.AcceptChanges();
        }