Example #1
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);
 }
Example #2
0
        /// <summary>
        /// Deploys the report to the reporting server.
        /// </summary>
        private void Deploy()
        {
            foreach (object report in this.ConnectionStrings)
            {
                // Get the connection string for the report to deploy.
                //this.connectString = this.GetValueFromConfig( "ReportDetails",
                //	"Report1");
                this.ConnectString = report.ToString();

                // Continue deploying report if report details provided.
                if (this.ConnectString.Length > 0)
                {
                    // Set report details.
                    this.SetReportInfo();

                    // Open the report (rdl) file and read the data into the stream.
                    byte[] reportDefinition;
                    Warning[] Warnings;
                    FileStream Stream = File.OpenRead(this.ReportPath);
                    reportDefinition = new Byte[Stream.Length];
                    Stream.Read(reportDefinition, 0, (int)Stream.Length);
                    Stream.Close();

                    // Create the report into the server.
                    string reportName = this.ReportPath.Substring(
                        this.ReportPath.LastIndexOf("\\") + 1);
                    Warnings = (Warning[]) ReportingService.CreateReport(reportName.Remove
                        (reportName.Length - 4, 4), this.Parent + this.Folder, true,
                        reportDefinition, null);

                    // Create datasource for the report.
                    DataSource dSource = new DataSource();
                    DataSourceDefinition dDefinition = new DataSourceDefinition();
                    dSource.Item = dDefinition;
                    dDefinition.Extension = this.Extension;
                    dDefinition.ConnectString = @"Data Source=" + this.ServerName
                        + @";Initial Catalog=" + this.DatabaseName;
                    //dDefinition.ImpersonateUserSpecified = true;
                    //dDefinition.Prompt = null;
                    dDefinition.WindowsCredentials = false;
                    dDefinition.CredentialRetrieval = CredentialRetrievalEnum.Integrated;
                    dSource.Name = this.DataSource;

                    try
                    {
                        if (this.CheckExist(ItemTypeEnum.DataSource, this.Parent,
                            this.DatasourceLocation + "/" + this.DataSource) == false)
                        {
                            ReportingService.CreateDataSource(this.DataSource, @"/" +
                                this.DatasourceLocation, false, dDefinition, null);
                        }
                    }
                    catch (SoapException ex)
                    {
                        throw ex;
                    }

                    // Report and Datasource created, now fix up datasource reference to
                    // make sure report points at correct dataset.
                    try
                    {
                        DataSourceReference reference = new DataSourceReference();
                        DataSource ds = new DataSource();
                        reference.Reference = @"/" + this.DatasourceLocation + @"/"
                            + this.DataSource;
                        DataSource[] dsarray = ReportingService.GetItemDataSources(this.Parent +
                            this.Folder + "/" + reportName.Remove
                            (reportName.Length - 4, 4));
                        ds = dsarray[0];
                        ds.Item = (DataSourceReference)reference;
                        ReportingService.SetItemDataSources(this.Parent +
                            this.Folder + "/" + reportName.Remove
                            (reportName.Length - 4, 4), dsarray);
                    }
                    catch (Exception e)
                    {
                        throw (e);
                    }
                }
            }
        }
Example #3
0
 /// <remarks/>
 public void SetDataSourceContentsAsync(string DataSource, DataSourceDefinition Definition) {
     this.SetDataSourceContentsAsync(DataSource, Definition, null);
 }
Example #4
0
 public void SetDataSourceContents(string DataSource, DataSourceDefinition Definition) {
     this.Invoke("SetDataSourceContents", new object[] {
                 DataSource,
                 Definition});
 }
Example #5
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);
 }
Example #6
0
 /// <remarks/>
 public void CreateDataSourceAsync(string DataSource, string Parent, bool Overwrite, DataSourceDefinition Definition, Property[] Properties) {
     this.CreateDataSourceAsync(DataSource, Parent, Overwrite, Definition, Properties, null);
 }
Example #7
0
 public void CreateDataSource(string DataSource, string Parent, bool Overwrite, DataSourceDefinition Definition, Property[] Properties) {
     this.Invoke("CreateDataSource", new object[] {
                 DataSource,
                 Parent,
                 Overwrite,
                 Definition,
                 Properties});
 }