annotate SSRS/SSRS.Services/ReportsService.cs @ 121:8f94475d3146 tip

final code
author stevenh7776
date Thu, 31 May 2012 15:35:26 +0100
parents e51a6af1c98d
children
rev   line source
112
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
1 using System.Collections.Concurrent;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
2 using System.Linq;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
3 using System.Security.Principal;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
4 using System.Threading.Tasks;
114
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
5 using SSRS.Services.DTO;
112
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
6 using SSRS.Services.ReportServiceReference;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
7 using ServiceStack.ServiceInterface;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
8
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
9 namespace SSRS.Services
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
10 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
11 public class ReportsService : RestServiceBase<ReportsRequest>
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
12 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
13 public override object OnPost(ReportsRequest request)
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
14 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
15 var result = new ConcurrentQueue<ReportInfo>();
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
16 var client = new ReportingService2010SoapClient();
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
17 CatalogItem[] catalogItems;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
18
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
19 client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.None;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
20 client.ListChildren(null, Settings.ReportPath, true, out catalogItems);
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
21
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
22 Parallel.ForEach(catalogItems.Where(r => r.TypeName == "Report"),
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
23 (r) =>
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
24 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
25 ItemParameter[] parameters = null;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
26
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
27 if (request.IncludeParameters)
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
28 client.GetItemParameters(null, r.Path, null, false, null, null, out parameters);
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
29
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
30 result.Enqueue(ReportInfo.Create(r.Name, Converter.Convert(parameters), r.Path));
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
31 });
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
32
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
33 return new ReportsResponse { Result = result.ToList() };
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
34 }
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
35 }
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
36 }