Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/08/11 10:38:36 (13 years ago)
Author:
ascheibe
Message:

#1233

  • moved DTO's to Services.Hive project
  • removed Services.Hive.Common project
  • some cleanups
  • added DTO's for enums
File:
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Convert.cs

    r6703 r6717  
    2424using System.Data.Linq;
    2525using System.Linq;
    26 using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
    27 
    28 namespace HeuristicLab.Services.Hive.DataAccess {
     26using DB = HeuristicLab.Services.Hive.DataAccess;
     27using DT = HeuristicLab.Services.Hive.DataTransfer;
     28
     29
     30namespace HeuristicLab.Services.Hive.DataTransfer {
    2931  public static class Convert {
    3032    #region Job
    31     public static DT.Job ToDto(Job source) {
     33    public static DT.Job ToDto(DB.Job source) {
    3234      if (source == null) return null;
    3335      return new DT.Job {
     
    4042        PluginsNeededIds = (source.RequiredPlugins == null ? new List<Guid>() : source.RequiredPlugins.Select(x => x.PluginId).ToList()),
    4143        LastHeartbeat = source.LastHeartbeat,
    42         State = source.State,
     44        State = Convert.ToDto(source.State),
    4345        StateLog = (source.StateLogs == null ? new List<DT.StateLog>() : source.StateLogs.Select(x => Convert.ToDto(x)).OrderBy(x => x.DateTime).ToList()),
    4446        IsParentJob = source.IsParentJob,
    4547        FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished,
    46         Command = source.Command,
     48        Command = Convert.ToDto(source.Command),
    4749        LastJobDataUpdate = (source.JobData == null ? DateTime.MinValue : source.JobData.LastUpdate),
    4850        HiveExperimentId = source.HiveExperimentId,
     
    5052      };
    5153    }
    52     public static Job ToEntity(DT.Job source) {
    53       if (source == null) return null;
    54       var entity = new Job(); ToEntity(source, entity);
    55       return entity;
    56     }
    57     public static void ToEntity(DT.Job source, Job target) {
     54
     55    public static DB.Job ToEntity(DT.Job source) {
     56      if (source == null) return null;
     57      var entity = new DB.Job(); ToEntity(source, entity);
     58      return entity;
     59    }
     60    public static void ToEntity(DT.Job source, DB.Job target) {
    5861      if ((source != null) && (target != null)) {
    5962        target.JobId = source.Id;
     
    6467        target.Priority = source.Priority;
    6568        target.LastHeartbeat = source.LastHeartbeat;
    66         target.State = source.State;
    67         if (target.StateLogs == null) target.StateLogs = new EntitySet<StateLog>();
     69        target.State = Convert.ToEntity(source.State);
     70        if (target.StateLogs == null) target.StateLogs = new EntitySet<DB.StateLog>();
    6871        foreach (DT.StateLog sl in source.StateLog.Where(x => x.Id == Guid.Empty)) {
    6972          target.StateLogs.Add(Convert.ToEntity(sl));
     
    7174        target.IsParentJob = source.IsParentJob;
    7275        target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished;
    73         target.Command = source.Command;
     76        target.Command = Convert.ToEntity(source.Command);
    7477        // RequiredPlugins are added by Dao
    7578        target.HiveExperimentId = source.HiveExperimentId;
     
    8083
    8184    #region JobData
    82     public static DT.JobData ToDto(JobData source) {
     85    public static DT.JobData ToDto(DB.JobData source) {
    8386      if (source == null) return null;
    8487      return new DT.JobData { JobId = source.JobId, Data = source.Data.ToArray(), LastUpdate = source.LastUpdate };
    8588    }
    86     public static JobData ToEntity(DT.JobData source) {
    87       if (source == null) return null;
    88       var entity = new JobData(); ToEntity(source, entity);
    89       return entity;
    90     }
    91     public static void ToEntity(DT.JobData source, JobData target) {
     89    public static DB.JobData ToEntity(DT.JobData source) {
     90      if (source == null) return null;
     91      var entity = new DB.JobData(); ToEntity(source, entity);
     92      return entity;
     93    }
     94    public static void ToEntity(DT.JobData source, DB.JobData target) {
    9295      if ((source != null) && (target != null)) {
    9396        target.JobId = source.JobId; target.Data = new Binary(source.Data); target.LastUpdate = source.LastUpdate;
     
    97100
    98101    #region StateLog
    99     public static DT.StateLog ToDto(StateLog source) {
    100       if (source == null) return null;
    101       return new DT.StateLog { Id = source.StateLogId, DateTime = source.DateTime, Exception = source.Exception, JobId = source.JobId, SlaveId = source.SlaveId, State = source.State, UserId = source.UserId };
    102     }
    103     public static StateLog ToEntity(DT.StateLog source) {
    104       if (source == null) return null;
    105       var entity = new StateLog(); ToEntity(source, entity);
    106       return entity;
    107     }
    108     public static void ToEntity(DT.StateLog source, StateLog target) {
    109       if ((source != null) && (target != null)) {
    110         target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target.JobId = source.JobId; target.SlaveId = source.SlaveId; target.State = source.State; target.UserId = source.UserId;
     102    public static DT.StateLog ToDto(DB.StateLog source) {
     103      if (source == null) return null;
     104      return new DT.StateLog { Id = source.StateLogId, DateTime = source.DateTime, Exception = source.Exception, JobId = source.JobId, SlaveId = source.SlaveId, State = Convert.ToDto(source.State), UserId = source.UserId };
     105    }
     106    public static DB.StateLog ToEntity(DT.StateLog source) {
     107      if (source == null) return null;
     108      var entity = new DB.StateLog(); ToEntity(source, entity);
     109      return entity;
     110    }
     111    public static void ToEntity(DT.StateLog source, DB.StateLog target) {
     112      if ((source != null) && (target != null)) {
     113        target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target.JobId = source.JobId; target.SlaveId = source.SlaveId; target.State = Convert.ToEntity(source.State); target.UserId = source.UserId;
    111114      }
    112115    }
     
    114117
    115118    #region Downtimes
    116     public static DT.Downtime ToDto(Downtime source) {
     119    public static DT.Downtime ToDto(DB.Downtime source) {
    117120      if (source == null) return null;
    118121      return new DT.Downtime { Id = source.DowntimeId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate };
    119122    }
    120     public static Downtime ToEntity(DT.Downtime source) {
    121       if (source == null) return null;
    122       var entity = new Downtime(); ToEntity(source, entity);
    123       return entity;
    124     }
    125     public static void ToEntity(DT.Downtime source, Downtime target) {
     123    public static DB.Downtime ToEntity(DT.Downtime source) {
     124      if (source == null) return null;
     125      var entity = new DB.Downtime(); ToEntity(source, entity);
     126      return entity;
     127    }
     128    public static void ToEntity(DT.Downtime source, DB.Downtime target) {
    126129      if ((source != null) && (target != null)) {
    127130        target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate;
     
    131134
    132135    #region HiveExperiment
    133     public static DT.HiveExperiment ToDto(HiveExperiment source) {
     136    public static DT.HiveExperiment ToDto(DB.HiveExperiment source) {
    134137      if (source == null) return null;
    135138      return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed };
    136139    }
    137     public static HiveExperiment ToEntity(DT.HiveExperiment source) {
    138       if (source == null) return null;
    139       var entity = new HiveExperiment(); ToEntity(source, entity);
    140       return entity;
    141     }
    142     public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) {
     140    public static DB.HiveExperiment ToEntity(DT.HiveExperiment source) {
     141      if (source == null) return null;
     142      var entity = new DB.HiveExperiment(); ToEntity(source, entity);
     143      return entity;
     144    }
     145    public static void ToEntity(DT.HiveExperiment source, DB.HiveExperiment target) {
    143146      if ((source != null) && (target != null)) {
    144147        target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed;
     
    148151
    149152    #region HiveExperimentPermission
    150     public static DT.HiveExperimentPermission ToDto(HiveExperimentPermission source) {
    151       if (source == null) return null;
    152       return new DT.HiveExperimentPermission { HiveExperimentId = source.HiveExperimentId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId, Permission = source.Permission };
    153     }
    154     public static HiveExperimentPermission ToEntity(DT.HiveExperimentPermission source) {
    155       if (source == null) return null;
    156       var entity = new HiveExperimentPermission(); ToEntity(source, entity);
    157       return entity;
    158     }
    159     public static void ToEntity(DT.HiveExperimentPermission source, HiveExperimentPermission target) {
    160       if ((source != null) && (target != null)) {
    161         target.HiveExperimentId = source.HiveExperimentId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; target.Permission = source.Permission;
     153    public static DT.HiveExperimentPermission ToDto(DB.HiveExperimentPermission source) {
     154      if (source == null) return null;
     155      return new DT.HiveExperimentPermission { HiveExperimentId = source.HiveExperimentId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId, Permission = Convert.ToDto(source.Permission) };
     156    }
     157    public static DB.HiveExperimentPermission ToEntity(DT.HiveExperimentPermission source) {
     158      if (source == null) return null;
     159      var entity = new DB.HiveExperimentPermission(); ToEntity(source, entity);
     160      return entity;
     161    }
     162    public static void ToEntity(DT.HiveExperimentPermission source, DB.HiveExperimentPermission target) {
     163      if ((source != null) && (target != null)) {
     164        target.HiveExperimentId = source.HiveExperimentId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; target.Permission = Convert.ToEntity(source.Permission);
    162165      }
    163166    }
     
    165168
    166169    #region Plugin
    167     public static DT.Plugin ToDto(Plugin source) {
     170    public static DT.Plugin ToDto(DB.Plugin source) {
    168171      if (source == null) return null;
    169172      return new DT.Plugin { Id = source.PluginId, Name = source.Name, Version = new Version(source.Version), UserId = source.UserId, DateCreated = source.DateCreated, Hash = source.Hash };
    170173    }
    171     public static Plugin ToEntity(DT.Plugin source) {
    172       if (source == null) return null;
    173       var entity = new Plugin(); ToEntity(source, entity);
    174       return entity;
    175     }
    176     public static void ToEntity(DT.Plugin source, Plugin target) {
     174    public static DB.Plugin ToEntity(DT.Plugin source) {
     175      if (source == null) return null;
     176      var entity = new DB.Plugin(); ToEntity(source, entity);
     177      return entity;
     178    }
     179    public static void ToEntity(DT.Plugin source, DB.Plugin target) {
    177180      if ((source != null) && (target != null)) {
    178181        target.PluginId = source.Id; target.Name = source.Name; target.Version = source.Version.ToString(); target.UserId = source.UserId; target.DateCreated = source.DateCreated; target.Hash = source.Hash;
     
    182185
    183186    #region PluginData
    184     public static DT.PluginData ToDto(PluginData source) {
     187    public static DT.PluginData ToDto(DB.PluginData source) {
    185188      if (source == null) return null;
    186189      return new DT.PluginData { Id = source.PluginDataId, PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName };
    187190    }
    188     public static PluginData ToEntity(DT.PluginData source) {
    189       if (source == null) return null;
    190       var entity = new PluginData(); ToEntity(source, entity);
    191       return entity;
    192     }
    193     public static void ToEntity(DT.PluginData source, PluginData target) {
     191    public static DB.PluginData ToEntity(DT.PluginData source) {
     192      if (source == null) return null;
     193      var entity = new DB.PluginData(); ToEntity(source, entity);
     194      return entity;
     195    }
     196    public static void ToEntity(DT.PluginData source, DB.PluginData target) {
    194197      if ((source != null) && (target != null)) {
    195198        target.PluginDataId = source.Id; target.PluginId = source.PluginId; target.Data = new Binary(source.Data); target.FileName = source.FileName;
     
    199202
    200203    #region Slave
    201     public static DT.Slave ToDto(Slave source) {
     204    public static DT.Slave ToDto(DB.Slave source) {
    202205      if (source == null) return null;
    203206      return new DT.Slave {
     
    211214        Memory = source.Memory,
    212215        Name = source.Name,
    213         SlaveState = source.SlaveState,
    214         CpuArchitecture = source.CpuArchitecture,
     216        SlaveState = Convert.ToDto(source.SlaveState),
     217        CpuArchitecture = Convert.ToDto(source.CpuArchitecture),
    215218        OperatingSystem = source.OperatingSystem,
    216219        LastHeartbeat = source.LastHeartbeat,
     
    218221      };
    219222    }
    220     public static Slave ToEntity(DT.Slave source) {
    221       if (source == null) return null;
    222       var entity = new Slave(); ToEntity(source, entity);
    223       return entity;
    224     }
    225     public static void ToEntity(DT.Slave source, Slave target) {
     223    public static DB.Slave ToEntity(DT.Slave source) {
     224      if (source == null) return null;
     225      var entity = new DB.Slave(); ToEntity(source, entity);
     226      return entity;
     227    }
     228    public static void ToEntity(DT.Slave source, DB.Slave target) {
    226229      if ((source != null) && (target != null)) {
    227230        target.ResourceId = source.Id;
     
    234237        target.Memory = source.Memory;
    235238        target.Name = source.Name;
    236         target.SlaveState = source.SlaveState;
    237         target.CpuArchitecture = source.CpuArchitecture;
     239        target.SlaveState = Convert.ToEntity(source.SlaveState);
     240        target.CpuArchitecture = Convert.ToEntity(source.CpuArchitecture);
    238241        target.OperatingSystem = source.OperatingSystem;
    239242        target.LastHeartbeat = source.LastHeartbeat;
     
    244247
    245248    #region SlaveGroup
    246     public static DT.SlaveGroup ToDto(SlaveGroup source) {
     249    public static DT.SlaveGroup ToDto(DB.SlaveGroup source) {
    247250      if (source == null) return null;
    248251      return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId };
    249252    }
    250     public static SlaveGroup ToEntity(DT.SlaveGroup source) {
    251       if (source == null) return null;
    252       var entity = new SlaveGroup(); ToEntity(source, entity);
    253       return entity;
    254     }
    255     public static void ToEntity(DT.SlaveGroup source, SlaveGroup target) {
     253    public static DB.SlaveGroup ToEntity(DT.SlaveGroup source) {
     254      if (source == null) return null;
     255      var entity = new DB.SlaveGroup(); ToEntity(source, entity);
     256      return entity;
     257    }
     258    public static void ToEntity(DT.SlaveGroup source, DB.SlaveGroup target) {
    256259      if ((source != null) && (target != null)) {
    257260        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId;
     
    261264
    262265    #region Resource
    263     public static DT.Resource ToDto(Resource source) {
     266    public static DT.Resource ToDto(DB.Resource source) {
    264267      if (source == null) return null;
    265268      return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId };
    266269    }
    267     public static Resource ToEntity(DT.Resource source) {
    268       if (source == null) return null;
    269       var entity = new Resource(); ToEntity(source, entity);
    270       return entity;
    271     }
    272     public static void ToEntity(DT.Resource source, Resource target) {
     270    public static DB.Resource ToEntity(DT.Resource source) {
     271      if (source == null) return null;
     272      var entity = new DB.Resource(); ToEntity(source, entity);
     273      return entity;
     274    }
     275    public static void ToEntity(DT.Resource source, DB.Resource target) {
    273276      if ((source != null) && (target != null)) {
    274277        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId;
     
    278281
    279282    #region Statistics
    280     public static DT.Statistics ToDto(Statistics source) {
     283    public static DT.Statistics ToDto(DB.Statistics source) {
    281284      if (source == null) return null;
    282285      return new DT.Statistics {
     
    287290      };
    288291    }
    289     public static Statistics ToEntity(DT.Statistics source) {
    290       if (source == null) return null;
    291       var entity = new Statistics(); ToEntity(source, entity);
    292       return entity;
    293     }
    294     public static void ToEntity(DT.Statistics source, Statistics target) {
     292    public static DB.Statistics ToEntity(DT.Statistics source) {
     293      if (source == null) return null;
     294      var entity = new DB.Statistics(); ToEntity(source, entity);
     295      return entity;
     296    }
     297    public static void ToEntity(DT.Statistics source, DB.Statistics target) {
    295298      if ((source != null) && (target != null)) {
    296299        target.StatisticsId = source.Id;
     
    302305
    303306    #region SlaveStatistics
    304     public static DT.SlaveStatistics ToDto(SlaveStatistics source) {
     307    public static DT.SlaveStatistics ToDto(DB.SlaveStatistics source) {
    305308      if (source == null) return null;
    306309      return new DT.SlaveStatistics {
     
    314317      };
    315318    }
    316     public static SlaveStatistics ToEntity(DT.SlaveStatistics source) {
    317       if (source == null) return null;
    318       var entity = new SlaveStatistics(); ToEntity(source, entity);
    319       return entity;
    320     }
    321     public static void ToEntity(DT.SlaveStatistics source, SlaveStatistics target) {
     319    public static DB.SlaveStatistics ToEntity(DT.SlaveStatistics source) {
     320      if (source == null) return null;
     321      var entity = new DB.SlaveStatistics(); ToEntity(source, entity);
     322      return entity;
     323    }
     324    public static void ToEntity(DT.SlaveStatistics source, DB.SlaveStatistics target) {
    322325      if ((source != null) && (target != null)) {
    323326        target.StatisticsId = source.Id;
     
    333336
    334337    #region UserStatistics
    335     public static DT.UserStatistics ToDto(UserStatistics source) {
     338    public static DT.UserStatistics ToDto(DB.UserStatistics source) {
    336339      if (source == null) return null;
    337340      return new DT.UserStatistics {
     
    344347      };
    345348    }
    346     public static UserStatistics ToEntity(DT.UserStatistics source) {
    347       if (source == null) return null;
    348       var entity = new UserStatistics(); ToEntity(source, entity);
    349       return entity;
    350     }
    351     public static void ToEntity(DT.UserStatistics source, UserStatistics target) {
     349    public static DB.UserStatistics ToEntity(DT.UserStatistics source) {
     350      if (source == null) return null;
     351      var entity = new DB.UserStatistics(); ToEntity(source, entity);
     352      return entity;
     353    }
     354    public static void ToEntity(DT.UserStatistics source, DB.UserStatistics target) {
    352355      if ((source != null) && (target != null)) {
    353356        target.StatisticsId = source.Id;
     
    360363    }
    361364    #endregion
     365
     366
     367    #region JobState
     368    public static DT.JobState ToDto(DB.JobState source) {
     369      if (source == DB.JobState.Aborted) {
     370        return JobState.Aborted;
     371      } else if (source == DB.JobState.Calculating) {
     372        return JobState.Calculating;
     373      } else if (source == DB.JobState.Failed) {
     374        return JobState.Failed;
     375      } else if (source == DB.JobState.Finished) {
     376        return JobState.Finished;
     377      } else if (source == DB.JobState.Offline) {
     378        return JobState.Offline;
     379      } else if (source == DB.JobState.Paused) {
     380        return JobState.Paused;
     381      } else if (source == DB.JobState.Transferring) {
     382        return JobState.Transferring;
     383      } else if (source == DB.JobState.Waiting) {
     384        return JobState.Waiting;
     385      } else
     386        return JobState.Failed;
     387    }
     388
     389    public static DB.JobState ToEntity(DT.JobState source) {
     390      if (source == DT.JobState.Aborted) {
     391        return DB.JobState.Aborted;
     392      } else if (source == DT.JobState.Calculating) {
     393        return DB.JobState.Calculating;
     394      } else if (source == DT.JobState.Failed) {
     395        return DB.JobState.Failed;
     396      } else if (source == DT.JobState.Finished) {
     397        return DB.JobState.Finished;
     398      } else if (source == DT.JobState.Offline) {
     399        return DB.JobState.Offline;
     400      } else if (source == DT.JobState.Paused) {
     401        return DB.JobState.Paused;
     402      } else if (source == DT.JobState.Transferring) {
     403        return DB.JobState.Transferring;
     404      } else if (source == DT.JobState.Waiting) {
     405        return DB.JobState.Waiting;
     406      } else
     407        return DB.JobState.Failed;
     408    }
     409    #endregion
     410
     411    #region Permission
     412    public static DT.Permission ToDto(DB.Permission source) {
     413      if (source == DB.Permission.Full) {
     414        return Permission.Full;
     415      } else if (source == DB.Permission.NotAllowed) {
     416        return Permission.NotAllowed;
     417      } else if (source == DB.Permission.Read) {
     418        return Permission.Read;
     419      } else
     420        return Permission.NotAllowed;
     421    }
     422
     423    public static DB.Permission ToEntity(DT.Permission source) {
     424      if (source == DT.Permission.Full) {
     425        return DB.Permission.Full;
     426      } else if (source == DT.Permission.NotAllowed) {
     427        return DB.Permission.NotAllowed;
     428      } else if (source == DT.Permission.Read) {
     429        return DB.Permission.Read;
     430      } else
     431        return DB.Permission.NotAllowed;
     432    }
     433    #endregion
     434
     435
     436    #region Command
     437    public static DT.Command? ToDto(DB.Command? source) {
     438      if (source.HasValue) {
     439        if (source.Value == DB.Command.Abort) {
     440          return Command.Abort;
     441        } else if (source.Value == DB.Command.Pause) {
     442          return Command.Pause;
     443        } else if (source.Value == DB.Command.Stop) {
     444          return Command.Stop;
     445        } else
     446          return Command.Pause;
     447      }
     448      return null;
     449    }
     450
     451    public static DB.Command? ToEntity(DT.Command? source) {
     452      if (source.HasValue) {
     453        if (source == DT.Command.Abort) {
     454          return DB.Command.Abort;
     455        } else if (source == DT.Command.Pause) {
     456          return DB.Command.Pause;
     457        } else if (source == DT.Command.Stop) {
     458          return DB.Command.Stop;
     459        } else
     460          return DB.Command.Pause;
     461      } else
     462        return null;
     463    }
     464
     465    #endregion
     466
     467    #region CpuArchiteture
     468    public static DT.CpuArchitecture ToDto(DB.CpuArchitecture source) {
     469      if (source == DB.CpuArchitecture.x64) {
     470        return CpuArchitecture.x64;
     471      } else if (source == DB.CpuArchitecture.x86) {
     472        return CpuArchitecture.x86;
     473      } else
     474        return CpuArchitecture.x86;
     475    }
     476
     477    public static DB.CpuArchitecture ToEntity(DT.CpuArchitecture source) {
     478      if (source == DT.CpuArchitecture.x64) {
     479        return DB.CpuArchitecture.x64;
     480      } else if (source == DT.CpuArchitecture.x86) {
     481        return DB.CpuArchitecture.x86;
     482      } else
     483        return DB.CpuArchitecture.x86;
     484    }
     485    #endregion
     486
     487    #region SlaveState
     488    public static DT.SlaveState ToDto(DB.SlaveState source) {
     489      if (source == DB.SlaveState.Calculating) {
     490        return SlaveState.Calculating;
     491      } else if (source == DB.SlaveState.Idle) {
     492        return SlaveState.Idle;
     493      } else if (source == DB.SlaveState.Offline) {
     494        return SlaveState.Offline;
     495      } else
     496        return SlaveState.Offline;
     497    }
     498
     499    public static DB.SlaveState ToEntity(DT.SlaveState source) {
     500      if (source == DT.SlaveState.Calculating) {
     501        return DB.SlaveState.Calculating;
     502      } else if (source == DT.SlaveState.Idle) {
     503        return DB.SlaveState.Idle;
     504      } else if (source == DT.SlaveState.Offline) {
     505        return DB.SlaveState.Offline;
     506      } else
     507        return DB.SlaveState.Offline;
     508    }
     509    #endregion
    362510  }
    363511}
Note: See TracChangeset for help on using the changeset viewer.