112
|
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 }
|