annotate SSRS/SSRS.Services/Converter.cs @ 112:b9d5f934cb21

Initial upload
author adminsh@apollo
date Sat, 19 May 2012 16:09:07 +0100
parents
children e51a6af1c98d
rev   line source
112
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
1 using System.Collections.Generic;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
2 using System.Linq;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
3 using SSRS.Services.DTOs;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
4
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
5 namespace SSRS.Services
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
6 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
7 public class Converter
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
8 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
9 public static IList<Parameter> Convert(ReportServiceReference.ItemParameter[] itemParameters)
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
10 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
11 if (itemParameters == null) return new List<Parameter>(0);
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
12
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
13 var parameters = new List<Parameter>(itemParameters.Length);
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
14
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
15 parameters.AddRange(
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
16 itemParameters.Select(
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
17 parameter => new Parameter()
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
18 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
19 DefaultValues = parameter.DefaultValues,
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
20 Name = parameter.Name,
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
21 Nullable = parameter.Nullable,
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
22 ParameterType = parameter.ParameterTypeName
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
23 }));
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
24
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
25 return parameters;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
26 }
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
27
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
28 public static ReportExecutionServiceReference.ParameterValue[] Convert(IList<Parameter> parameters)
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
29 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
30 if (parameters == null) return new ReportExecutionServiceReference.ParameterValue[0];
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
31 var query = from p in parameters
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
32 select new ReportExecutionServiceReference.ParameterValue()
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
33 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
34 Name = p.Name, Value = p.Value
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
35 };
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
36
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
37 return query.ToArray();
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
38 }
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
39 }
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
40 }