annotate SSRS/SSRS.Services/Converter.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.Generic;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
2 using System.Linq;
114
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
3 using SSRS.Services.DTO;
112
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 }