示例#1
0
        public string[] WriteReports(ReportItem[] reportItems)
        {
            if (reportItems == null)
                throw new ArgumentNullException("reportItems");

            List<string> warnings = new List<string>();

            for (int i = 0; i < reportItems.Count(); i++)
            {
                // Verify that the report's path is valid
                if (!this.mReportRepository.ValidateItemPath(reportItems[i].Path))
                    throw new InvalidPathException(reportItems[i].Path);

                // Get the report's name and path to its parent folder
                string name = reportItems[i].Name;
                string parentPath = SSRSUtil.GetParentPath(reportItems[i]);

                // Check if a report already exists at the specified path
                if (!this.mOverwrite)
                    if (this.mReportRepository.ItemExists(reportItems[i].Path, "Report"))
                        throw new ItemAlreadyExistsException(reportItems[i].Path);

                string[] reportWarnings = this.mReportRepository.WriteReport(parentPath, reportItems[i], this.mOverwrite);

                if (reportWarnings != null)
                    warnings.AddRange(reportWarnings);
            }

            return warnings.ToArray();
        }