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

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