1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Web;
|
---|
5 | using System.ServiceModel.Security;
|
---|
6 | using System.Web.Security;
|
---|
7 | using HLWebOKBQueryPlugin.OKBQueryService;
|
---|
8 | using HLWebOKBQueryPlugin.Helpers;
|
---|
9 |
|
---|
10 | namespace HLWebPluginHost.Models {
|
---|
11 | public class QueryModel {
|
---|
12 |
|
---|
13 | public String SelectedSubMenu { get; set; }
|
---|
14 |
|
---|
15 | public IList<Filter> QueryFilterGetAll() {
|
---|
16 | QueryServiceClient client = Query.GetClientFactory();
|
---|
17 |
|
---|
18 | IList<Filter> filterList = new List<Filter>();
|
---|
19 |
|
---|
20 | if (client != null) {
|
---|
21 | Filter[] filters = client.GetFilters();
|
---|
22 | foreach (Filter f in filters) {
|
---|
23 | filterList.Add(f);
|
---|
24 |
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | return filterList;
|
---|
29 | }
|
---|
30 |
|
---|
31 | public RunCollectionData getRun(long id) {
|
---|
32 | QueryServiceClient client = Query.GetClientFactory();
|
---|
33 |
|
---|
34 | if (client != null) {
|
---|
35 | Run run = client.GetRuns(new long[1] { id }, false).ToList<Run>().First();
|
---|
36 | RunCollectionData rcd = new RunCollectionData(run);
|
---|
37 |
|
---|
38 | return rcd;
|
---|
39 | }
|
---|
40 | return null;
|
---|
41 | }
|
---|
42 |
|
---|
43 | // just 4 testing
|
---|
44 | public IList<RunCollectionData> getTestRuns() {
|
---|
45 |
|
---|
46 | QueryServiceClient client = Query.GetClientFactory();
|
---|
47 |
|
---|
48 | if (client != null) {
|
---|
49 | IList<RunCollectionData> runs = new List<RunCollectionData>();
|
---|
50 |
|
---|
51 | //long[] runIds = client.GetRunIds(new Filter());
|
---|
52 | //if (runIds.Length < cnt) cnt = runIds.Length;
|
---|
53 |
|
---|
54 | long[] getRuns = new long[2] { 1, 2 };
|
---|
55 |
|
---|
56 | IList<Run> runList = client.GetRuns(getRuns, false).ToList<Run>();
|
---|
57 |
|
---|
58 | foreach (Run r in runList)
|
---|
59 | runs.Add(new RunCollectionData(r));
|
---|
60 |
|
---|
61 | return runs;
|
---|
62 | }
|
---|
63 | return new List<RunCollectionData>();
|
---|
64 | }
|
---|
65 |
|
---|
66 | }
|
---|
67 | } |
---|