Пример #1
0
        public void Start()
        {
            // Create the client
            rs = new ReportingService2010();
            rs.Url = Configuration.Default.ReportingServicesUrl + "/ReportService2010.asmx";
            if (Configuration.Default.IntegratedSecurity)
            {
                rs.UseDefaultCredentials = true;
            }
            else
            {
                rs.Credentials = new System.Net.NetworkCredential(Configuration.Default.Username, Configuration.Default.Password, Configuration.Default.Domain);
            }
            // Fast test that we can connect
            rs.ListChildren("/", false);

            // Install Data Source
            if (!string.IsNullOrEmpty(Configuration.Default.DataSourceName))
            {
                if (!Exists("Folder", "/", Configuration.Default.DataSourceInstallFolder))
                {
                    rs.CreateFolder(Configuration.Default.DataSourceInstallFolder, "/", null);
                    Logger.WriteLine("Data Sources folder created: " + Configuration.Default.DataSourceInstallFolder);
                }

                if (!Exists("DataSource", "/", Configuration.Default.DataSourceInstallFolder + "/" + Configuration.Default.DataSourceName))
                {
                    var def = new DataSourceDefinition();
                    def.ConnectString = "Data Source=" + Configuration.Default.DataSourceDatabaseServer + ";Initial Catalog=" + Configuration.Default.DataSourceDatabaseName;
                    def.Enabled = true;
                    def.EnabledSpecified = true;
                    def.Extension = "SQL";
                    def.Prompt = null; // default
                    def.ImpersonateUser = false;
                    def.WindowsCredentials = false;
                    if (string.IsNullOrEmpty(Configuration.Default.DataSourceDatabaseUserId))
                    {
                        def.CredentialRetrieval = CredentialRetrievalEnum.Integrated;
                        def.ImpersonateUserSpecified = true;
                    }
                    else
                    {
                        def.CredentialRetrieval = CredentialRetrievalEnum.Store;
                        def.ImpersonateUserSpecified = false;
                        def.UserName = Configuration.Default.DataSourceDatabaseUserId;
                        def.Password = Configuration.Default.DataSourceDatabasePassword;
                    }
                    rs.CreateDataSource(Configuration.Default.DataSourceName, "/" + Configuration.Default.DataSourceInstallFolder, false, def, null);
                    Logger.WriteLine("Data Sources created: " + Configuration.Default.DataSourceName);
                }
            }

            // Install Reports
            if (!string.IsNullOrEmpty(Configuration.Default.ReportsPath))
            {
                if (!Exists("Folder", "/", Configuration.Default.ReportsInstallFolder))
                {
                    rs.CreateFolder(Configuration.Default.ReportsInstallFolder, "/", null);
                    Logger.WriteLine("Report folder created: " + Configuration.Default.ReportsInstallFolder);
                }

                var reports = FileLoader.LoadReports(Configuration.Default.ReportsPath);
                foreach (var item in reports)
                {
                    Warning[] warnings = new Warning[0]; ;
                    var result = rs.CreateCatalogItem("Report", item.Name, "/" + Configuration.Default.ReportsInstallFolder, true, item.Data, null, out warnings);
                    //if (warnings != null && warnings.Any())
                    //{
                    //    foreach (var warning in warnings)
                    //    {
                    //        Logger.WriteLine("WARNING: " + warning.Message);
                    //    }
                    //    throw new Exception("Warning during report creation.");
                    //}
                    Logger.WriteLine("Report deployed: " + item.Name);

                    // Bind Data Source if specified
                    if (!string.IsNullOrEmpty(Configuration.Default.DataSourceName))
                    {
                        rs.SetItemDataSources("/" + Configuration.Default.ReportsInstallFolder + "/" + item.Name, new[] { new DataSource { Name = Configuration.Default.ReportDataSourceName, Item = new DataSourceReference() { Reference = "/" + Configuration.Default.DataSourceInstallFolder + "/" + Configuration.Default.DataSourceName } } });
                        Logger.WriteLine("Report " + item.Name + " bound to data source " + Configuration.Default.DataSourceName);
                    }
                }
            }
        }
Пример #2
0
 /// <remarks/>
 public void TestConnectForDataSourceDefinitionAsync(DataSourceDefinition DataSourceDefinition, string UserName, string Password) {
     this.TestConnectForDataSourceDefinitionAsync(DataSourceDefinition, UserName, Password, null);
 }
Пример #3
0
 /// <remarks/>
 public void TestConnectForDataSourceDefinitionAsync(DataSourceDefinition DataSourceDefinition, string UserName, string Password, object userState) {
     if ((this.TestConnectForDataSourceDefinitionOperationCompleted == null)) {
         this.TestConnectForDataSourceDefinitionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnTestConnectForDataSourceDefinitionOperationCompleted);
     }
     this.InvokeAsync("TestConnectForDataSourceDefinition", new object[] {
                 DataSourceDefinition,
                 UserName,
                 Password}, this.TestConnectForDataSourceDefinitionOperationCompleted, userState);
 }
Пример #4
0
 /// <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);
 }
Пример #5
0
 public bool TestConnectForDataSourceDefinition(DataSourceDefinition DataSourceDefinition, string UserName, string Password, out string ConnectError) {
     object[] results = this.Invoke("TestConnectForDataSourceDefinition", new object[] {
                 DataSourceDefinition,
                 UserName,
                 Password});
     ConnectError = ((string)(results[1]));
     return ((bool)(results[0]));
 }
Пример #6
0
 /// <remarks/>
 public void SetDataSourceContentsAsync(string DataSource, DataSourceDefinition Definition) {
     this.SetDataSourceContentsAsync(DataSource, Definition, null);
 }
Пример #7
0
 public void SetDataSourceContents(string DataSource, DataSourceDefinition Definition) {
     this.Invoke("SetDataSourceContents", new object[] {
                 DataSource,
                 Definition});
 }
Пример #8
0
 /// <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);
 }
Пример #9
0
 /// <remarks/>
 public void CreateDataSourceAsync(string DataSource, string Parent, bool Overwrite, DataSourceDefinition Definition, Property[] Properties) {
     this.CreateDataSourceAsync(DataSource, Parent, Overwrite, Definition, Properties, null);
 }
Пример #10
0
 public CatalogItem CreateDataSource(string DataSource, string Parent, bool Overwrite, DataSourceDefinition Definition, Property[] Properties) {
     object[] results = this.Invoke("CreateDataSource", new object[] {
                 DataSource,
                 Parent,
                 Overwrite,
                 Definition,
                 Properties});
     return ((CatalogItem)(results[0]));
 }