コード例 #1
0
        /// <summary>
        /// Checks if an item of the specified type exists at path.
        /// </summary>
        /// <param name="reportingService">The reporting service.</param>
        /// <param name="path">The path.</param>
        /// <param name="itemType">Type of the item.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">reportingService</exception>
        private static bool ItemExists(ReportingService2005 reportingService, string path, ItemTypeEnum itemType)
        {
            if (reportingService == null)
                throw new ArgumentNullException("reportingService");

            ItemTypeEnum actualItemType = reportingService.GetItemType(path);

            if (itemType == actualItemType)
                return true;
            else
                return false;
        }
コード例 #2
0
ファイル: SSRSUtil.cs プロジェクト: jpann/SSRSMigrate
        public static SSRSVersion GetSqlServerVersion(ReportingService2005 reportServerConnection)
        {
            if (reportServerConnection == null)
                throw new ArgumentNullException("reportServerConnection");

            reportServerConnection.ListSecureMethods();

            return GetSqlServerVersion(reportServerConnection.ServerInfoHeaderValue.ReportServerVersion);
        }
コード例 #3
0
        private static void CreateReports(ReportingService2005 reportingService, string path)
        {
            if (reportingService == null)
                throw new ArgumentNullException("reportingService");

            if (string.IsNullOrEmpty(path))
                throw new ArgumentException("path");

            foreach (ReportItem report in SetupReportItems)
            {
                string fullPath = string.Format(report.Path, path);
                string parent = TesterUtility.GetParentPath(fullPath);

                reportingService.CreateReport(report.Name, parent, true, report.Definition, null);
            }
        }
コード例 #4
0
        /// <summary>
        /// Gets the reporting service object.
        /// </summary>
        /// <param name="url">The URL.</param>
        /// <param name="credentials">The credentials.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">url</exception>
        private static ReportingService2005 GetReportingService(string url, ICredentials credentials)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentException("url");

            if (credentials == null)
                credentials = CredentialCache.DefaultNetworkCredentials;

            if (!url.EndsWith("reportservice2005.asmx"))
            {
                if (url.EndsWith("/"))
                    url = url.Substring(0, url.Length - 1);

                url = string.Format("{0}/reportservice2005.asmx", url);
            }

            ReportingService2005 service = new ReportingService2005();
            service.Url = url;

            service.Credentials = credentials;
            service.PreAuthenticate = true;
            service.UseDefaultCredentials = true;

            return service;
        }
コード例 #5
0
        private static void CreateReport(ReportingService2005 reportingService, ReportItem report)
        {
            if (reportingService == null)
                throw new ArgumentNullException("reportingService");

            if (report == null)
                throw new ArgumentNullException("report");

            string parent = TesterUtility.GetParentPath(report.Path);

            ReportingService2005TestEnvironment.CreateFolderFromPath(reportingService, parent);

            reportingService.CreateReport(report.Name, parent, true, report.Definition, null);
        }
コード例 #6
0
        private static void CreateFolders(ReportingService2005 reportingService, string path)
        {
            foreach (FolderItem folder in SetupFolderItems)
            {
                string fullPath = string.Format(folder.Path, path);

                ReportingService2005TestEnvironment.CreateFolderFromPath(reportingService, fullPath);
            }
        }
コード例 #7
0
        /// <summary>
        /// Creates the folder structure of a given path. This will go through each folder in the path and create it.
        /// </summary>
        /// <param name="reportingService">The reporting service.</param>
        /// <param name="path">The path.</param>
        /// <exception cref="System.ArgumentNullException">reportingService</exception>
        private static void CreateFolderFromPath(ReportingService2005 reportingService, string path)
        {
            if (reportingService == null)
                throw new ArgumentNullException("reportingService");

            string [] folders = path.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);

            string parentPath = "/";

            foreach (string folder in folders)
            {
                string folderPath;

                if (parentPath != "/" && parentPath.EndsWith("/"))
                    parentPath = parentPath.Substring(0, parentPath.LastIndexOf("/"));

                if (parentPath == "/")
                    folderPath = parentPath + folder;
                else
                    folderPath = parentPath + "/" + folder;

                if (!ReportingService2005TestEnvironment.ItemExists(reportingService, folderPath, ItemTypeEnum.Folder))
                {
                    reportingService.CreateFolder(folder, parentPath, null);
                }

                if (parentPath != "/")
                    parentPath += "/" + folder;
                else
                    parentPath += folder;
            }
        }
コード例 #8
0
        private static void CreateDataSources(ReportingService2005 reportingService, string path)
        {
            if (reportingService == null)
                throw new ArgumentNullException("reportingService");

            if (string.IsNullOrEmpty(path))
                throw new ArgumentException("path");

            foreach (DataSourceItem dataSource in SetupDataSourceItems)
            {
                DataSourceDefinition def = new DataSourceDefinition();
                def.ConnectString = dataSource.ConnectString;

                switch (dataSource.CredentialsRetrieval)
                {
                    case "Integrated":
                        def.CredentialRetrieval = CredentialRetrievalEnum.Integrated; break;
                    case "None":
                        def.CredentialRetrieval = CredentialRetrievalEnum.None; break;
                    case "Prompt":
                        def.CredentialRetrieval = CredentialRetrievalEnum.Prompt; break;
                    case "Store":
                        def.CredentialRetrieval = CredentialRetrievalEnum.Store; break;
                }

                def.Enabled = dataSource.Enabled;
                def.EnabledSpecified = dataSource.EnabledSpecified;
                def.Extension = dataSource.Extension;
                def.ImpersonateUser = dataSource.ImpersonateUser;
                def.ImpersonateUserSpecified = dataSource.ImpersonateUserSpecified;
                def.OriginalConnectStringExpressionBased = dataSource.OriginalConnectStringExpressionBased;
                def.Password = dataSource.Password;
                def.Prompt = dataSource.Prompt;
                def.UseOriginalConnectString = dataSource.UseOriginalConnectString;
                def.UserName = dataSource.UserName;
                def.WindowsCredentials = dataSource.WindowsCredentials;

                string fullPath = string.Format(dataSource.Path, path);
                string parent = TesterUtility.GetParentPath(fullPath);

                reportingService.CreateDataSource(dataSource.Name, parent, true, def, null);
            }
        }
コード例 #9
0
        private static void CreateDataSource(ReportingService2005 reportingService, DataSourceItem dataSource)
        {
            if (reportingService == null)
                throw new ArgumentNullException("reportingService");

            if (dataSource == null)
                throw new ArgumentNullException("dataSource");

            DataSourceDefinition def = new DataSourceDefinition();
            def.ConnectString = dataSource.ConnectString;

            switch (dataSource.CredentialsRetrieval)
            {
                case "Integrated":
                    def.CredentialRetrieval = CredentialRetrievalEnum.Integrated; break;
                case "None":
                    def.CredentialRetrieval = CredentialRetrievalEnum.None; break;
                case "Prompt":
                    def.CredentialRetrieval = CredentialRetrievalEnum.Prompt; break;
                case "Store":
                    def.CredentialRetrieval = CredentialRetrievalEnum.Store; break;
            }

            def.Enabled = dataSource.Enabled;
            def.EnabledSpecified = dataSource.EnabledSpecified;
            def.Extension = dataSource.Extension;
            def.ImpersonateUser = dataSource.ImpersonateUser;
            def.ImpersonateUserSpecified = dataSource.ImpersonateUserSpecified;
            def.OriginalConnectStringExpressionBased = dataSource.OriginalConnectStringExpressionBased;
            def.Password = dataSource.Password;
            def.Prompt = dataSource.Prompt;
            def.UseOriginalConnectString = dataSource.UseOriginalConnectString;
            def.UserName = dataSource.UserName;
            def.WindowsCredentials = dataSource.WindowsCredentials;

            string parent = TesterUtility.GetParentPath(dataSource.Path);

            ReportingService2005TestEnvironment.CreateFolderFromPath(reportingService, parent);

            reportingService.CreateDataSource(dataSource.Name, parent, true, def, null);
        }