Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataSource"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="userName">The user name.</param>
        /// <param name="password">The password.</param>
        /// <param name="credentialRetrieval">The credential retrieval enum.</param>
        /// <param name="extension">The data source type.</param>
        /// <param name="windowsCredentials">if set to <c>true</c> [windows credentials].</param>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="publish">if set to <c>true</c>, publish.</param>
        /// <param name="overwrite">if set to <c>true</c>, overwrite.</param>
        /// <param name="targetFolder">The target folder.</param>
        /// <param name="reportServer">The report server.</param>
        public DataSource(string name, string userName, string password, string credentialRetrieval, bool windowsCredentials, string extension, string connectionString, bool publish, bool overwrite, string targetFolder, ReportServerInfo reportServer)
        {
            _name     = name;
            _userName = string.IsNullOrEmpty(userName)
                ? null
                : userName.Trim();
            _password  = password;
            _extension = string.IsNullOrEmpty(extension)
                ? DefaultExtension
                : extension;
            _connectionString = connectionString;
            _publish          = publish;
            _overwrite        = overwrite;

            _targetFolder = string.IsNullOrEmpty(targetFolder)
                ? targetFolder
                : targetFolder.Trim();

            _reportServer = reportServer;

            _credentialRetrieval = ReportCredential.Integrated;
            if (credentialRetrieval != null)
            {
                try
                {
                    _credentialRetrieval = (ReportCredential)Enum.Parse(typeof(ReportCredential), credentialRetrieval, true);
                }
                catch (ArgumentException e)
                {
                    Logger.LogException("DataSource", e.Message);
                }
            }

            _windowsCredentials = windowsCredentials;
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReportGroup"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="targetFolder">The target folder.</param>
        /// <param name="dataSource">The data source.</param>
        /// <param name="reportServer">The report server.</param>
        /// <param name="reports">The reports.</param>
        public ReportGroup(string name, string targetFolder, DataSource dataSource, ReportServerInfo reportServer, IEnumerable <Report> reports)
        {
            _name         = name;
            _targetFolder = targetFolder;
            _dataSource   = dataSource;
            _reportServer = reportServer;

            if (!string.IsNullOrEmpty(targetFolder))
            {
                _targetFolder = targetFolder.Trim();
            }

            _reports = new List <Report>(reports).AsReadOnly();
            if (dataSource.Publish)
            {
                foreach (Report report in _reports)
                {
                    if (report.DataSources.Count > 0)
                    {
                        report.DataSources[0].SetDataSourceReference(dataSource);
                    }
                }
            }
        }