[845] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2008 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.Collections.Generic;
|
---|
| 24 | using System.Linq;
|
---|
| 25 | using System.Text;
|
---|
| 26 |
|
---|
| 27 | using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess;
|
---|
| 28 | using HeuristicLab.Hive.Contracts.BusinessObjects;
|
---|
| 29 |
|
---|
| 30 | namespace HeuristicLab.Hive.Server.ADODataAccess {
|
---|
| 31 | class PermissionOwnerAdapter: IPermissionOwner {
|
---|
| 32 | #region IPermissionOwner Members
|
---|
| 33 | private dsHiveServerTableAdapters.PermissionOwnerTableAdapter adapter =
|
---|
| 34 | new dsHiveServerTableAdapters.PermissionOwnerTableAdapter();
|
---|
| 35 |
|
---|
| 36 | public void UpdatePermissionOwner(PermissionOwner permOwner) {
|
---|
| 37 | if (permOwner != null) {
|
---|
| 38 | dsHiveServer.PermissionOwnerDataTable data =
|
---|
| 39 | adapter.GetDataById(permOwner.PermissionOwnerId);
|
---|
| 40 |
|
---|
| 41 | dsHiveServer.PermissionOwnerRow row;
|
---|
| 42 | if (data.Count == 0) {
|
---|
| 43 | row = data.NewPermissionOwnerRow();
|
---|
| 44 | data.AddPermissionOwnerRow(row);
|
---|
| 45 | } else {
|
---|
| 46 | row = data[0];
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | row.Name = permOwner.Name;
|
---|
| 50 |
|
---|
| 51 | adapter.Update(data);
|
---|
| 52 |
|
---|
| 53 | permOwner.PermissionOwnerId = row.PermissionOwnerId;
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | public PermissionOwner GetPermissionOwnerById(long resourceId) {
|
---|
| 58 | throw new NotImplementedException();
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | public ICollection<PermissionOwner> GetAllPermissionOwners() {
|
---|
| 62 | throw new NotImplementedException();
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | public bool DeletePermissionOwner(PermissionOwner permOwner) {
|
---|
| 66 | if (permOwner != null) {
|
---|
| 67 | dsHiveServer.PermissionOwnerDataTable data =
|
---|
| 68 | adapter.GetDataById(permOwner.PermissionOwnerId);
|
---|
| 69 |
|
---|
| 70 | if (data.Count == 1) {
|
---|
| 71 | dsHiveServer.PermissionOwnerRow row = data[0];
|
---|
| 72 |
|
---|
| 73 | row.Delete();
|
---|
| 74 | return adapter.Update(data) > 0;
|
---|
| 75 | }
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | return false;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | #endregion
|
---|
| 82 | }
|
---|
| 83 | }
|
---|