Ejemplo n.º 1
0
        private void LoadTreeNode(string path, TreeNodeCollection nodes, ReportingService2005 rs, bool source = false)
        {
            CatalogItem[] items;
            try
            {
                items = rs.ListChildren(path, false);
            }
            catch (Exception x)
            {
                return;

            }

            foreach (var item in items)
            {
                if(source)
                    lbSourceStatus.Text = String.Format("Source contains:{0} {1} reports{0} {2} folders{0} {3} datasources", Environment.NewLine,
                        _countReportsSource, _countFolderSource, _sourceServicesMgmt.DataSources.Count);
                else
                    lbDestStatus.Text = String.Format("Destination contains:{0} {1} reports{0} {2} folders{0} {3} datasources", Environment.NewLine,
                        _countReportsDest, _countFolderDest, _destServicesMgmt.DataSources.Count);

                Application.DoEvents();
                var t = new TreeNode { Text = item.Name, Name = item.Name };

                if (item.Type == ItemTypeEnum.DataSource)
                {
                    if (source)
                    {
                        if (!_sourceServicesMgmt.DataSources.ContainsKey(item.Name))
                            _sourceServicesMgmt.DataSources.Add(item.Name, item.Path);
                    }
                    else
                    {
                        if (!_destServicesMgmt.DataSources.ContainsKey(item.Name))
                            _destServicesMgmt.DataSources.Add(item.Name, item.Path);
                    }
                }

                if (item.Type != ItemTypeEnum.Model && item.Type != ItemTypeEnum.DataSource)
                {
                    nodes.Add(t);
                    if (source) _countReportsSource++;
                    else _countReportsDest++;
                }
                if (item.Type == ItemTypeEnum.Folder)
                {
                    LoadTreeNode(item.Path, t.Nodes, rs, source);
                    if (source) _countFolderSource++;
                    else _countFolderDest++;
                }
            }
        }
Ejemplo n.º 2
0
 private void loadTreeNode(string path, TreeNodeCollection nodes, ReportingService2005 rs, Dictionary<string, string> dataSources)
 {
     CatalogItem[] items = rs.ListChildren(path, false);
     foreach (var item in items)
     {
         TreeNode t = new TreeNode();
         t.Text = item.Name;
         t.Name = item.Name;
         if (item.Type == ItemTypeEnum.DataSource)
         {
             if(!dataSources.ContainsKey(item.Name))
                 dataSources.Add(item.Name, item.Path);
         }
         if (item.Type != ItemTypeEnum.Model && item.Type != ItemTypeEnum.DataSource)
         {    
             nodes.Add(t);
         }
         if (item.Type == ItemTypeEnum.Folder)
             loadTreeNode(item.Path, t.Nodes, rs, dataSources);
         else
         {
             
         }
     }
 }