예제 #1
0
        public void CreateDataSource(DataSource source)
        {
            RS.DataSourceDefinition definition = new RS.DataSourceDefinition
            {
                Extension                = source.Extension,
                ConnectString            = source.ConnectionString,
                CredentialRetrieval      = (RS.CredentialRetrievalEnum)source.CredentialRetrieval,
                Enabled                  = true,
                EnabledSpecified         = true,
                ImpersonateUser          = false,
                ImpersonateUserSpecified = true,
                Prompt             = null,
                WindowsCredentials = source.WindowsCredentials,
            };
            if (source.UserName != null)
            {
                definition.UserName = source.UserName;
                definition.Password = source.Password;
            }

            _proxy.CreateDataSource(
                source.Name,
                source.TargetFolder,
                source.Overwrite,
                definition,
                null);
        }
예제 #2
0
        public bool createDatasource(string localFilePath, string serverFolderPath, bool overWrite)
        {
            FileStream stream = File.OpenRead(localFilePath);

            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.Load(stream);

            var dataSourceName = Path.GetFileNameWithoutExtension(localFilePath);

            string connectionString = xmlDocument.SelectSingleNode("//ConnectString").InnerText;

            DataSourceDefinition definition = new DataSourceDefinition();
            definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated;
            definition.ConnectString = connectionString;
            definition.Enabled = true;
            definition.EnabledSpecified = true;
            definition.Extension = "SQL";
            definition.ImpersonateUserSpecified = false;

            definition.WindowsCredentials = true;

            try
            {
                ReportingService.CreateDataSource(dataSourceName, serverFolderPath, overWrite, definition, null);
            }
            catch (SoapException exception)
            {
                if (exception.Message.Contains("Microsoft.ReportingServices.Diagnostics.Utilities.ItemAlreadyExistsException"))
                {
                    Debug.Print(exception.Message);
                }
                else
                {
                    throw exception;
                }
            }

            return true;
        }
 /// <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});
 }
 /// <remarks/>
 public System.IAsyncResult BeginSetDataSourceContents(string DataSource, DataSourceDefinition Definition, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("SetDataSourceContents", new object[] {
                 DataSource,
                 Definition}, callback, asyncState);
 }
 /// <remarks/>
 public System.IAsyncResult BeginCreateDataSource(string DataSource, string Parent, bool Overwrite, DataSourceDefinition Definition, Property[] Properties, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("CreateDataSource", new object[] {
                 DataSource,
                 Parent,
                 Overwrite,
                 Definition,
                 Properties}, callback, asyncState);
 }
 /// <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);
 }
 /// <remarks/>
 public void SetDataSourceContentsAsync(string DataSource, DataSourceDefinition Definition)
 {
     this.SetDataSourceContentsAsync(DataSource, Definition, null);
 }
 public void SetDataSourceContents(string DataSource, DataSourceDefinition Definition)
 {
     this.Invoke("SetDataSourceContents", new object[] {
                 DataSource,
                 Definition});
 }