/// <remarks/>
 public void SetDataSourceContentsAsync(string DataSource, DataSourceDefinition Definition, object userState)
 {
     if ((this.SetDataSourceContentsOperationCompleted == null)) {
         this.SetDataSourceContentsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetDataSourceContentsOperationCompleted);
     }
     this.InvokeAsync("SetDataSourceContents", new object[] {
                 DataSource,
                 Definition}, this.SetDataSourceContentsOperationCompleted, userState);
 }
 public void SetDataSourceContents(string DataSource, DataSourceDefinition Definition)
 {
     this.Invoke("SetDataSourceContents", new object[] {
                 DataSource,
                 Definition});
 }
 /// <remarks/>
 public void SetDataSourceContentsAsync(string DataSource, DataSourceDefinition Definition)
 {
     this.SetDataSourceContentsAsync(DataSource, Definition, null);
 }
 /// <remarks/>
 public void CreateDataSourceAsync(string DataSource, string Parent, bool Overwrite, DataSourceDefinition Definition, Property[] Properties, object userState)
 {
     if ((this.CreateDataSourceOperationCompleted == null)) {
         this.CreateDataSourceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateDataSourceOperationCompleted);
     }
     this.InvokeAsync("CreateDataSource", new object[] {
                 DataSource,
                 Parent,
                 Overwrite,
                 Definition,
                 Properties}, this.CreateDataSourceOperationCompleted, userState);
 }
 /// <remarks/>
 public void CreateDataSourceAsync(string DataSource, string Parent, bool Overwrite, DataSourceDefinition Definition, Property[] Properties)
 {
     this.CreateDataSourceAsync(DataSource, Parent, Overwrite, Definition, Properties, null);
 }
 public void CreateDataSource(string DataSource, string Parent, bool Overwrite, DataSourceDefinition Definition, Property[] Properties)
 {
     this.Invoke("CreateDataSource", new object[] {
                 DataSource,
                 Parent,
                 Overwrite,
                 Definition,
                 Properties});
 }
        public NDatasource CreateDataSource(string dataSourceName,
            string parentFolderPath,
            string provider,
            string server,
            string database,
            string userName,
            string password,
            string passwordConfirm,
            bool useHttpClient)
        {
            #region Validate Parameters

            if (string.IsNullOrEmpty(dataSourceName))
            {
                throw new ArgumentNullException("dataSourceName");
            }
            if (string.IsNullOrEmpty(parentFolderPath))
            {
                throw new ArgumentNullException("parentFolderPath");
            }
            if (!("SQL".Equals(provider)))
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Provider type {0} is not supported.", provider));
            }
            if (string.IsNullOrEmpty(server))
            {
                throw new ArgumentNullException("server");
            }
            if (string.IsNullOrEmpty(database))
            {
                throw new ArgumentNullException("database");
            }
            if (string.IsNullOrEmpty(userName))
            {
                throw new ArgumentNullException("userName");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }
            if (!password.Equals(passwordConfirm))
            {
                throw new ArgumentException("Passwords do not match.");
            }

            #endregion Validate Parameters

            string connectionString = string.Format(CultureInfo.InvariantCulture, @"data source={0};initial catalog={1}", server, database);

            // Create the SRS version of this data source
            Property[] properties = null;
            DataSourceDefinition definition = new DataSourceDefinition();
            definition.ConnectString = connectionString;
            definition.CredentialRetrieval = CredentialRetrievalEnum.Store;
            definition.Enabled = true;
            definition.EnabledSpecified = true;
            definition.Extension = provider;
            definition.ImpersonateUser = false;
            definition.ImpersonateUserSpecified = false;
            definition.UserName = userName;
            definition.Password = password;

            if (useHttpClient)
            {
                this.ReportingServiceClient.CreateDataSource(dataSourceName, parentFolderPath, true, definition, properties);
            }
            else
            {
                this.ReportingServiceNonHttpClient.CreateDataSource(dataSourceName, parentFolderPath, true, definition, properties);
            }

            // Create the application version of this data source
            bool isNewDataSource = false;
            string catalogPath = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", parentFolderPath, dataSourceName);

            BOConfiguredDataSource configuredDataSource = ConfiguredDataSourceCollection[catalogPath];
            if (configuredDataSource == null)
            {
                isNewDataSource = true;
                configuredDataSource = new BOConfiguredDataSource();
            }
            configuredDataSource.CatalogPath = catalogPath;
            configuredDataSource.Credentials = Utility.EncryptValue(string.Format(CultureInfo.InvariantCulture, "uid={0};pwd={1}", userName, password));
            configuredDataSource.ConnectionStringValue = connectionString;
            configuredDataSource.ConnectionStringType = provider;
            configuredDataSource.Save(_authenticatedUserManager.AuthenticatedUserSignature);

            if (isNewDataSource)
            {
                // Add it to the cache
                this.ConfiguredDataSourceCollection.Add(configuredDataSource);
            }

            string dataSourcePath = string.Format("{0}/{1}", parentFolderPath, dataSourceName);
            return new NDatasource(dataSourceName, dataSourcePath);
        }
 public void CopySRSDataSourceToTarget(NCatalogItem item, string parent, DataSourceDefinition definition)
 {
     this.ReportingTargetServiceNonHttpClient.CreateDataSource(item.Name, parent, false, definition, null);
 }