Exemplo n.º 1
0
        private void ReportsReader_ReportReporter(ReportServerItem item)
        {
            if (item == null)
            {
                this.mLogger.Warn("ReportsReader_ReportReporter - item contains a NULL value.");

                return;
            }

            ListViewItem oItem = new ListViewItem(item.Name);

            oItem.Checked = true;
            //oItem.Tag = item;
            oItem.Tag = item.Path;
            oItem.SubItems.Add(item.Path);

            // Assign to proper ListViewGroup
            oItem.Group = this.lstSrcReports.Groups["reportsGroup"];

            this.lstSrcReports.Invoke(new Action(() => this.lstSrcReports.Items.Add(oItem)));
            this.lstSrcReports.Invoke(new Action(() => oItem.EnsureVisible()));

            this.lblStatus.Text = string.Format("Refreshing item '{0}'...", item.Path);

            this.mLogger.Debug("Refreshing item '{0}'...", item.Path);

            this.mDebugForm.LogMessage(string.Format("Refreshing item '{0}'...", item.Path));
        }
Exemplo n.º 2
0
        public void GetParentPath_PathMissingFirstSlash()
        {
            ReportServerItem item = new ReportServerItem()
            {
                Name = "Sub Folder",
                Path = "SSRSMigrate/Reports/Sub Folder"
            };

            string expected = "/SSRSMigrate/Reports";

            string actual = SSRSUtil.GetParentPath(item);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void GetParentPath_PathIsSlash()
        {
            ReportServerItem item = new ReportServerItem()
            {
                Name = "Sub Folder",
                Path = "/"
            };

            string expected = "/";

            string actual = SSRSUtil.GetParentPath(item);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void GetParentPath_ParentContainsName()
        {
            ReportServerItem item = new ReportServerItem()
            {
                Name = "Reports",
                Path = "/SSRSMigrate/Reports/Reports"
            };

            string expected = "/SSRSMigrate/Reports";

            string actual = SSRSUtil.GetParentPath(item);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
        public static string GetParentPath(ReportServerItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (string.IsNullOrEmpty(item.Path))
            {
                throw new ArgumentException("item.Path");
            }

            if (string.IsNullOrEmpty(item.Name))
            {
                throw new ArgumentException("item.Name");
            }

            string path = item.Path;
            string name = item.Name;

            string parentPath = null;

            if (path == "/")
            {
                parentPath = path;
            }
            else
            {
                //parentPath = path.Replace(name, "");
                parentPath = path.Substring(0, path.LastIndexOf(name));

                if (parentPath.EndsWith("/"))
                {
                    parentPath = parentPath.Substring(0, parentPath.Length - 1);

                    if (parentPath.EndsWith("/"))
                    {
                        parentPath = parentPath.Substring(0, parentPath.Length - 1);
                    }
                }
            }

            if (!parentPath.StartsWith("/"))
            {
                parentPath = "/" + parentPath;
            }

            return(parentPath);
        }
Exemplo n.º 6
0
        private void bw_SourceRefreshReportsProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            ReportServerItem report = (ReportServerItem)e.UserState;

            ListViewItem oItem = new ListViewItem(report.Name);

            oItem.Checked = true;
            oItem.Tag     = report.Path;
            oItem.SubItems.Add(report.Path);

            lstSrcReports.Items.Add(oItem);

            progressBar.Value       = e.ProgressPercentage;
            progressBar.Maximum     = 100;
            progressBar.ToolTipText = report.Name;
        }
Exemplo n.º 7
0
        public void GetParentPath_EmptyPath()
        {
            ReportServerItem item = new ReportServerItem()
            {
                Name = "Sub Folder",
                Path = ""
            };

            ArgumentException ex = Assert.Throws <ArgumentException>(
                delegate
            {
                SSRSUtil.GetParentPath(item);
            });

            Assert.That(ex.Message, Is.EqualTo("item.Path"));
        }
Exemplo n.º 8
0
        public void GetParentPath_NullName()
        {
            ReportServerItem item = new ReportServerItem()
            {
                Name = null,
                Path = "/SSRSMigrate/Reports/Sub Folder"
            };

            ArgumentException ex = Assert.Throws <ArgumentException>(
                delegate
            {
                SSRSUtil.GetParentPath(item);
            });

            Assert.That(ex.Message, Is.EqualTo("item.Name"));
        }
Exemplo n.º 9
0
        private void bw_MigrationProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            if (e.UserState != null)
            {
                MigrationStatus status = (MigrationStatus)e.UserState;

                if (status.Item != null)
                {
                    ReportServerItem item = (ReportServerItem)status.Item;

                    ListViewItem oItem = new ListViewItem(item.Name);
                    oItem.Checked = true;
                    oItem.Tag     = item.Path;
                    oItem.SubItems.Add(item.Path);

                    if (!status.Success)
                    {
                        oItem.SubItems.Add(status.Error.Message);
                        oItem.ForeColor = Color.Red;

                        oItem.ToolTipText = status.Error.Message;

                        this.mSummaryForm.AddFailedItem(item.Path,
                                                        status.Error.Message);
                    }
                    else
                    {
                        this.mSummaryForm.IncrementSuccessfulItemsCount();
                    }

                    if (status.Warnings.Length > 0)
                    {
                        string warnings = string.Join("; ", status.Warnings);

                        oItem.SubItems.Add(warnings);
                        oItem.ForeColor = Color.OrangeRed;

                        oItem.ToolTipText = string.Join("\n\r", status.Warnings);
                    }

                    // Assign to proper ListViewGroup
                    if (item.GetType() == typeof(FolderItem))
                    {
                        oItem.Group = this.lstDestReports.Groups["foldersGroup"];
                    }
                    else if (item.GetType() == typeof(DataSourceItem))
                    {
                        oItem.Group = this.lstDestReports.Groups["dataSourcesGroup"];
                    }
                    else if (item.GetType() == typeof(ReportItem) || item.GetType() == typeof(ReportItemProxy))
                    {
                        oItem.Group = this.lstDestReports.Groups["reportsGroup"];
                    }

                    this.lstDestReports.Items.Add(oItem);
                    oItem.EnsureVisible();

                    progressBar.ToolTipText = item.Name;

                    string msg = string.Format("Migrated item from '{0}' to '{1}'...",
                                               status.FromPath,
                                               status.ToPath);

                    this.mDebugForm.LogMessage(msg);
                    this.mLogger.Info("MigrationProgressChanged - {0}", msg);
                    this.lblStatus.Text = string.Format("Migrated item '{0}'...", item.Path);

                    this.mSummaryForm.IncrementTotalItemsCount();
                }
                else
                {
                    this.mLogger.Warn("MigrationProgressChanged - MigrationStatus.Item is NULL for item migrated from '{0}' to '{1}'.", status.FromPath, status.ToPath);
                }
            }

            progressBar.Value   = e.ProgressPercentage;
            progressBar.Maximum = 100;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Adds an item to the ListView for a successfully 'imported' entry.
        /// </summary>
        /// <param name="e">The ItemReadEvent object for the entry imported.</param>
        /// <param name="status">The ImportStatus object for the entry imported.</param>
        /// <param name="item">The ReportServerItem object that was imported.</param>
        /// <returns></returns>
        private ListViewItem AddListViewItem_Success(ItemReadEvent e, ImportStatus status, ReportServerItem item)
        {
            ListViewItem oItem = new ListViewItem(item.Name);

            oItem.Tag = item;
            oItem.SubItems.Add(item.Path);
            oItem.SubItems.Add("");

            oItem.Checked = true;

            return(oItem);
        }
Exemplo n.º 11
0
 public string DeleteItem(ReportServerItem item)
 {
     throw new NotImplementedException();
 }