Пример #1
0
        public void ReportFailEventHandler(SSRSExport sender, ReportFailEvent e)
        {
            lblStatus.Text = string.Format("Failed to load report: {0}", e.GetErrorMessage());

            if (mDebug)
            {
                string sMsg = string.Format("Failed to load report: {1}", e.GetErrorMessage());
                oDebugForm.LogMessage(sMsg, e.GetException());
            }
        }
Пример #2
0
        public int GetReportsList(string[] reports)
        {
            string sSSRSPath = this.mSSRSPath;
            int reportCount = 0;

            if (string.IsNullOrEmpty(SSRSPath))
                throw new ArgumentNullException("Please provide a valid SSRS path for the parent folder.");

            try
            {
                if (this.mDefaultCredentials == true)
                    mReportingService.Credentials = CredentialCache.DefaultCredentials;
                else
                    mReportingService.Credentials = new NetworkCredential(this.mUsername, this.mPassword, this.mDomain);

                CatalogItem[] oItems = mReportingService.ListChildren(SSRSPath, true);

                foreach (CatalogItem oItem in oItems)
                {
                    string sItemType = oItem.TypeName;
                    Report oReport = this.GetReport(oItem);

                    try
                    {
                        if (sItemType == "Report")
                        {
                            if (reports.FirstOrDefault(r => r.Equals(oReport.Path)) == null)
                                continue;

                            // Call ReportFoundEventHandler
                            ReportFoundEvent oReportFoundEvent = new ReportFoundEvent();
                            oReportFoundEvent.SetReport(oReport);
                            ReportFound(this, oReportFoundEvent);

                            reportCount++;
                        }
                    }
                    catch (Exception er)
                    {
                        ReportFailEvent oReportFailEvent = new ReportFailEvent();
                        oReportFailEvent.SetException(er);
                        oReportFailEvent.SetErrorMessage(er.Message);

                        ReportFail(this, oReportFailEvent);
                    }
                }

                return reportCount;
            }
            catch (Exception er)
            {
                throw new Exception(string.Format("Failed to get reports: {0}", er.Message));
            }
        }