#region License Information /* HeuristicLab * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System.Data.Linq; using DA = HeuristicLab.Services.Authentication.DataAccess; using DT = HeuristicLab.Services.Authentication.DataTransfer; namespace HeuristicLab.Services.Authentication { public static class Convert { #region Client public static DT.Client ToDto(DA.Client source) { if (source == null) return null; return new DT.Client { ResourceID = source.Id, Name = source.Name, Description = source.Description, ResourceType = source.ResourceType, ProcessorType = source.ProcessorType, NumberOfProcessors = source.NumberOfProcessors, NumberOfThreads = source.NumberOfThreads, IPAdress = source.IPAdress, MemorySize = source.MemorySize, OperatingSystem = source.OperatingSystem }; } public static DA.Client ToEntity(DT.Client source) { if (source == null) return null; return new DA.Client { Id = source.ResourceID, Name = source.Name, Description = source.Description, ResourceType = source.ResourceType, ProcessorType = source.ProcessorType, NumberOfProcessors = source.NumberOfProcessors, NumberOfThreads = source.NumberOfThreads, IPAdress = source.IPAdress, MemorySize = source.MemorySize, OperatingSystem = source.OperatingSystem }; } public static void ToEntity(DT.Client source, DA.Client target) { if ((source != null) && (target != null)) { target.Id = source.ResourceID; target.Name = source.Name; target.Description = source.Description; target.ResourceType = source.ResourceType; target.ProcessorType = source.ProcessorType; target.NumberOfProcessors = source.NumberOfProcessors; target.NumberOfThreads = source.NumberOfThreads; target.IPAdress = source.IPAdress; target.MemorySize = source.MemorySize; target.OperatingSystem = source.OperatingSystem; } } #endregion // Client #region ResourceGroup public static DT.ResourceGroup ToDto(DA.ResourceGroup source) { if (source == null) return null; return new DT.ResourceGroup { ResourceID = source.Id, Name = source.Name, Description = source.Description, ResourceType = source.ResourceType, }; } public static DA.ResourceGroup ToEntity(DT.ResourceGroup source) { if (source == null) return null; return new DA.ResourceGroup { Id = source.ResourceID, Name = source.Name, Description = source.Description, ResourceType = source.ResourceType, }; } public static void ToEntity(DT.ResourceGroup source, DA.ResourceGroup target) { if ((source != null) && (target != null)) { target.Id = source.ResourceID; target.Name = source.Name; target.Description = source.Description; target.ResourceType = source.ResourceType; } } #endregion // ResourceGroup } }