1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Security.Permissions;
|
---|
24 | using System.Collections;
|
---|
25 | using AM = HeuristicLab.Services.Authentication.AdminMethods;
|
---|
26 | using System.Collections.Generic;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Services.DemoService {
|
---|
29 | // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
|
---|
30 | public class Service : IService {
|
---|
31 | [PrincipalPermission(SecurityAction.Demand, Role = "Everyone")]
|
---|
32 | public string GetData(int value) {
|
---|
33 | return string.Format("You entered: {0}", value);
|
---|
34 | }
|
---|
35 |
|
---|
36 | public CompositeType GetDataUsingDataContract(CompositeType composite) {
|
---|
37 | if (composite == null) {
|
---|
38 | throw new ArgumentNullException("composite");
|
---|
39 | }
|
---|
40 | if (composite.BoolValue) {
|
---|
41 | composite.StringValue += "Suffix";
|
---|
42 | }
|
---|
43 | return composite;
|
---|
44 | }
|
---|
45 |
|
---|
46 | public bool CreateClient(string name, string descr, string groupID, string resGroup){
|
---|
47 | Hashtable sht = new Hashtable();
|
---|
48 | sht[AM.eResource.ResourceID] = ""; //notwendig ""
|
---|
49 | sht[AM.eResource.Name]= name;
|
---|
50 | sht[AM.eResource.Description] = descr;
|
---|
51 | sht[AM.eResource.ResourceType] = resGroup;
|
---|
52 | sht[AM.eResource.ResourceIDGroup] = groupID;
|
---|
53 | return new AM.ClientAdmin().Create(sht);
|
---|
54 | }
|
---|
55 |
|
---|
56 | public bool CreateGroup(string name, string descr) {
|
---|
57 | Hashtable sht = new Hashtable();
|
---|
58 | sht[AM.eResource.Name] = name;
|
---|
59 | sht[AM.eResource.Description] = descr;
|
---|
60 | return new AM.GroupAdmin().Create(sht);
|
---|
61 | }
|
---|
62 |
|
---|
63 | public string GetGroupID(string name) {
|
---|
64 | string gIDStr = "";
|
---|
65 | HashSet<Hashtable> rht = new HashSet<Hashtable>();
|
---|
66 | Hashtable sht = new Hashtable();
|
---|
67 | sht[AM.eResource.Name] = "g1";
|
---|
68 | rht = new AM.GroupAdmin().Get(sht);
|
---|
69 | foreach (Hashtable ht in rht) {
|
---|
70 | gIDStr = ht[AM.eResource.ResourceID].ToString();
|
---|
71 | }
|
---|
72 | return gIDStr;
|
---|
73 | }
|
---|
74 | }
|
---|
75 | }
|
---|