112
|
1 using System.Collections.Concurrent;
|
|
2 using System.Linq;
|
|
3 using System.Security.Principal;
|
|
4 using System.Threading.Tasks;
|
|
5 using SSRS.Services.DTOs;
|
|
6 using SSRS.Services.ReportServiceReference;
|
|
7 using ServiceStack.ServiceInterface;
|
|
8
|
|
9 namespace SSRS.Services
|
|
10 {
|
|
11 public class ReportsService : RestServiceBase<ReportsRequest>
|
|
12 {
|
|
13 public override object OnPost(ReportsRequest request)
|
|
14 {
|
|
15 var result = new ConcurrentQueue<ReportInfo>();
|
|
16 var client = new ReportingService2010SoapClient();
|
|
17 CatalogItem[] catalogItems;
|
|
18
|
|
19 client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.None;
|
|
20 client.ListChildren(null, Settings.ReportPath, true, out catalogItems);
|
|
21
|
|
22 Parallel.ForEach(catalogItems.Where(r => r.TypeName == "Report"),
|
|
23 (r) =>
|
|
24 {
|
|
25 ItemParameter[] parameters = null;
|
|
26
|
|
27 if (request.IncludeParameters)
|
|
28 client.GetItemParameters(null, r.Path, null, false, null, null, out parameters);
|
|
29
|
|
30 result.Enqueue(ReportInfo.Create(r.Name, Converter.Convert(parameters), r.Path));
|
|
31 });
|
|
32
|
|
33 return new ReportsResponse { Result = result.ToList() };
|
|
34 }
|
|
35 }
|
|
36 }
|