Esempio n. 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);
                    }
                }
            }
        }
Esempio n. 2
0
 public CatalogItem CreateCatalogItem(string ItemType, string Name, string Parent, bool Overwrite, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] Definition, Property[] Properties, out Warning[] Warnings) {
     object[] results = this.Invoke("CreateCatalogItem", new object[] {
                 ItemType,
                 Name,
                 Parent,
                 Overwrite,
                 Definition,
                 Properties});
     Warnings = ((Warning[])(results[1]));
     return ((CatalogItem)(results[0]));
 }
Esempio n. 3
0
 public string CreateReportEditSession(string Report, string Parent, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] Definition, out Warning[] Warnings) {
     object[] results = this.Invoke("CreateReportEditSession", new object[] {
                 Report,
                 Parent,
                 Definition});
     Warnings = ((Warning[])(results[1]));
     return ((string)(results[0]));
 }
Esempio n. 4
0
 public string CreateItemHistorySnapshot(string ItemPath, out Warning[] Warnings) {
     object[] results = this.Invoke("CreateItemHistorySnapshot", new object[] {
                 ItemPath});
     Warnings = ((Warning[])(results[1]));
     return ((string)(results[0]));
 }
Esempio n. 5
0
 public CatalogItem GenerateModel(string DataSource, string Model, string Parent, Property[] Properties, out Warning[] Warnings) {
     object[] results = this.Invoke("GenerateModel", new object[] {
                 DataSource,
                 Model,
                 Parent,
                 Properties});
     Warnings = ((Warning[])(results[1]));
     return ((CatalogItem)(results[0]));
 }