コード例 #1
0
        public IEnumerable <ServiceFolder> GetServiceFolders()
        {
            using (var rs = new ReportingServer())
            {
                var folders = rs.GetFolders("/libservices");
                Dictionary <string, Folder> map = new Dictionary <string, Folder>(StringComparer.InvariantCultureIgnoreCase);
                foreach (var folder in folders)
                {
                    map.Add(folder.Name, folder);
                }
                foreach (var module in _modules)
                {
                    var serviceFolder = new ServiceFolder()
                    {
                        Exists = map.ContainsKey(module.Name),
                        Name   = module.Name
                    };
                    if (serviceFolder.Exists)
                    {
                        serviceFolder.Reports = rs.GetReports(map[module.Name].Path).Select(r => new Core.Services.Report()
                        {
                            Name        = r.Name,
                            Description = r.Description
                        });
                    }

                    yield return(serviceFolder);
                }
            }
        }
コード例 #2
0
 public IEnumerable <string> GetReports(string service)
 {
     using (var rs = new ReportingServer())
     {
         return(rs.GetReports(String.Format("/libservices/{0}", service)).Select(r => r.Name));
     }
 }
コード例 #3
0
ファイル: Reporting.cs プロジェクト: kvuchkov/nbulib
        public void Test_Reporting_GetReports()
        {
            using (var rs = new ReportingServer())
            {
                var folders = rs.GetFolders().ToList();
                Assert.AreEqual(1, folders.Count());

                var serviceFolders = rs.GetFolders(folders.Single().Path);
                Assert.AreEqual(2, serviceFolders.Count());

                var askTheLibFolder = serviceFolders.Where(x => x.Name.ToLower().Contains("askthelib")).SingleOrDefault();
                Assert.IsNotNull(askTheLibFolder);
                var reports = rs.GetReports(askTheLibFolder.Path);
                Assert.AreEqual(1, reports.Count());
            }
        }
コード例 #4
0
        public string GetReportPath(string service, string report)
        {
            if (!CanAccess(service))
            {
                return(null);
            }
            else
            {
                var rs         = new ReportingServer();
                var reportItem = rs.GetReports(String.Format("/libservices/{0}", service)).Where(r => r.Name.Equals(report, StringComparison.InvariantCultureIgnoreCase)).SingleOrDefault();
                if (reportItem == null)
                {
                    return(null);
                }

                return(reportItem.Path);
            }
        }
コード例 #5
0
ファイル: Reporting.cs プロジェクト: kvuchkov/nbulib
        public void Test_Reporting_CreateReport()
        {
            using (var rs = new ReportingServer())
            {
                var folders = rs.GetFolders().ToList();
                Assert.AreEqual(1, folders.Count());

                var exFolders = rs.GetFolders(folders.Single().Path).ToList();

                string toCreate = "test";
                bool ok = rs.CreateFolder(toCreate, folders[0].Path);
                Assert.IsTrue(ok);
                var newFolders = rs.GetFolders(folders.Single().Path).ToList();
                var newFolder = newFolders.SingleOrDefault(x => x.Name == toCreate);

                string rdlPath = @"D:\Users\kiko\Documents\Visual Studio 2008\Projects\NbuLibReport1\NbuLibReport1\Report3.rdl";
                ok = rs.CreateReport("testreport1", File.ReadAllBytes(rdlPath), newFolder.Path);
                Assert.IsTrue(ok);
                var reports = rs.GetReports(newFolder.Path).ToList();
                Assert.AreEqual(1, reports.Count);
                Assert.AreEqual("testreport1", reports[0].Name);
            }
        }
コード例 #6
0
        public string GetReportPath(string service, string report)
        {
            if (!CanAccess(service))
                return null;
            else
            {
                var rs = new ReportingServer();
                var reportItem = rs.GetReports(String.Format("/libservices/{0}", service)).Where(r => r.Name.Equals(report, StringComparison.InvariantCultureIgnoreCase)).SingleOrDefault();
                if (reportItem == null)
                    return null;

                return reportItem.Path;
            }
        }
コード例 #7
0
        public IEnumerable<ServiceFolder> GetServiceFolders()
        {
            using (var rs = new ReportingServer())
            {
                var folders = rs.GetFolders("/libservices");
                Dictionary<string, Folder> map = new Dictionary<string, Folder>(StringComparer.InvariantCultureIgnoreCase);
                foreach (var folder in folders)
                    map.Add(folder.Name, folder);
                foreach (var module in _modules)
                {
                    var serviceFolder = new ServiceFolder()
                    {
                        Exists = map.ContainsKey(module.Name),
                        Name = module.Name
                    };
                    if (serviceFolder.Exists)
                    {
                        serviceFolder.Reports = rs.GetReports(map[module.Name].Path).Select(r => new Core.Services.Report()
                        {
                            Name = r.Name,
                            Description = r.Description
                        });
                    }

                    yield return serviceFolder;
                }
            }
        }
コード例 #8
0
 public IEnumerable<string> GetReports(string service)
 {
     using (var rs = new ReportingServer())
     {
         return rs.GetReports(String.Format("/libservices/{0}", service)).Select(r => r.Name);
     }
 }