Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/ClientService.cs @ 4802

Last change on this file since 4802 was 4802, checked in by fruehrli, 13 years ago

#1197
Update ClientService

File size: 2.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Collections;
4using System.Linq;
5using System.Data.Linq;
6using System.Data.Linq.Mapping;
7using System.Text;
8
9using HeuristicLab.Services.Authentication.DataAccess;
10using HeuristicLab.Services.Authentication.DataTransfer;
11using HeuristicLab.Services.Authentication;
12using DA = HeuristicLab.Services.Authentication.DataAccess;
13using DT = HeuristicLab.Services.Authentication.DataTransfer;
14using HLSA = HeuristicLab.Services.Authentication;
15
16
17namespace HeuristicLab.Services.Authentication {
18
19  public class ClientService : IClientService{
20
21
22    private void RemoveRRGEntry(ClientManagmentDataContext cmdc, Guid resID) {
23      foreach (var rrg in cmdc.ResourceResourceGroups.Where(x => x.ResourceId == resID))
24        cmdc.ResourceResourceGroups.DeleteOnSubmit(rrg);
25    }
26
27
28    public DataTransfer.Client GetClient(Guid id) {
29      throw new NotImplementedException();
30    }
31
32    public IEnumerable<DataTransfer.Client> GetClients() {
33      throw new NotImplementedException();
34    }
35
36    public Guid AddClient(DataTransfer.Client dto) {
37      throw new NotImplementedException();
38    }
39
40    public bool UpdateClient(DataTransfer.Client dto) {
41      throw new NotImplementedException();
42    }
43
44    public bool DeleteClient(DataTransfer.Client dto) {
45      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
46        RemoveRRGEntry(cmdc, dto.ResourceID);
47        DA.Resource entity = cmdc.Resources.FirstOrDefault(x => x.Id == dto.ResourceID);
48        if (entity != null) {
49          cmdc.Resources.DeleteOnSubmit(entity);
50          cmdc.SubmitChanges();
51          return true;
52        }
53        return false;
54      }
55    }
56
57    public DataTransfer.ResourceGroup GetResourceGroup(Guid id) {
58      throw new NotImplementedException();
59    }
60
61    public IEnumerable<DataTransfer.ResourceGroup> GetResourceGroups() {
62      throw new NotImplementedException();
63    }
64
65    public Guid AddResourceGroup(DataTransfer.ResourceGroup dto) {
66      throw new NotImplementedException();
67    }
68
69    public bool UpdateResourceGroup(DataTransfer.ResourceGroup dto) {
70      throw new NotImplementedException();
71    }
72
73    public bool DeleteResourceGroup(DataTransfer.ResourceGroup id) {
74      throw new NotImplementedException();
75    }
76
77    public IEnumerable<DataTransfer.Resource> GetMembers(Guid id) {
78      throw new NotImplementedException();
79    }
80
81    public IEnumerable<DataTransfer.Resource> GetRootResources() {
82      throw new NotImplementedException();
83    }
84  }
85}
Note: See TracBrowser for help on using the repository browser.