/// <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="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 connectionString, bool publish, bool overwrite, string targetFolder, string reportServer)
        {
            _Name               = name;
            _UserName           = userName;
            _Password           = password;
            _RSConnectionString = connectionString;
            _Publish            = publish;
            _Overwrite          = overwrite;
            if (targetFolder != null && targetFolder.Length > 0)
            {
                _TargetFolder = targetFolder.Trim();
            }
            if (reportServer != null)
            {
                if (Settings.ReportServers.ContainsKey(reportServer))
                {
                    _ReportServer = (ReportServerInfo)Settings.ReportServers[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;
        }
Exemple #2
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;
        }