Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Services.Hive/3.3/Convert.cs @ 11597

Last change on this file since 11597 was 11171, checked in by ascheibe, 10 years ago

#2115 merged r11170 (copyright update) into trunk

File size: 23.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2014 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
22using System;
23using System.Collections.Generic;
24using System.Data.Linq;
25using System.Linq;
26using DB = HeuristicLab.Services.Hive.DataAccess;
27using DT = HeuristicLab.Services.Hive.DataTransfer;
28
29namespace HeuristicLab.Services.Hive.DataTransfer {
30  public static class Convert {
31    #region Task
32    public static DT.Task ToDto(DB.Task source) {
33      if (source == null) return null;
34      return new DT.Task {
35        Id = source.TaskId,
36        CoresNeeded = source.CoresNeeded,
37        ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs),
38        MemoryNeeded = source.MemoryNeeded,
39        ParentTaskId = source.ParentTaskId,
40        Priority = source.Priority,
41        PluginsNeededIds = (source.RequiredPlugins == null ? new List<Guid>() : source.RequiredPlugins.Select(x => x.PluginId).ToList()),
42        LastHeartbeat = source.LastHeartbeat,
43        State = Convert.ToDto(source.State),
44        StateLog = (source.StateLogs == null ? new List<DT.StateLog>() : source.StateLogs.Select(x => Convert.ToDto(x)).OrderBy(x => x.DateTime).ToList()),
45        IsParentTask = source.IsParentTask,
46        FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished,
47        Command = Convert.ToDto(source.Command),
48        LastTaskDataUpdate = (source.JobData == null ? DateTime.MinValue : source.JobData.LastUpdate),
49        JobId = source.JobId,
50        IsPrivileged = source.IsPrivileged
51      };
52    }
53
54    public static DB.Task ToEntity(DT.Task source) {
55      if (source == null) return null;
56      var entity = new DB.Task(); ToEntity(source, entity);
57      return entity;
58    }
59    public static void ToEntity(DT.Task source, DB.Task target) {
60      if ((source != null) && (target != null)) {
61        target.TaskId = source.Id;
62        target.CoresNeeded = source.CoresNeeded;
63        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
64        target.MemoryNeeded = source.MemoryNeeded;
65        target.ParentTaskId = source.ParentTaskId;
66        target.Priority = source.Priority;
67        target.LastHeartbeat = source.LastHeartbeat;
68        target.State = Convert.ToEntity(source.State);
69        foreach (DT.StateLog sl in source.StateLog.Where(x => x.Id == Guid.Empty)) {
70          target.StateLogs.Add(Convert.ToEntity(sl));
71        }
72        target.IsParentTask = source.IsParentTask;
73        target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished;
74        target.Command = Convert.ToEntity(source.Command);
75        // RequiredPlugins are added by Dao
76        target.JobId = source.JobId;
77        target.IsPrivileged = source.IsPrivileged;
78      }
79    }
80
81    public static void ToEntityTaskOnly(DT.Task source, DB.Task target) {
82      if ((source != null) && (target != null)) {
83        target.TaskId = source.Id;
84        target.CoresNeeded = source.CoresNeeded;
85        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
86        target.MemoryNeeded = source.MemoryNeeded;
87        target.ParentTaskId = source.ParentTaskId;
88        target.Priority = source.Priority;
89        target.LastHeartbeat = source.LastHeartbeat;
90        target.State = Convert.ToEntity(source.State);
91        target.IsParentTask = source.IsParentTask;
92        target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished;
93        target.Command = Convert.ToEntity(source.Command);
94        // RequiredPlugins are added by Dao
95        target.JobId = source.JobId;
96        target.IsPrivileged = source.IsPrivileged;
97      }
98    }
99    #endregion
100
101    #region TaskData
102    public static DT.TaskData ToDto(DB.TaskData source) {
103      if (source == null) return null;
104      return new DT.TaskData { TaskId = source.TaskId, Data = source.Data, LastUpdate = source.LastUpdate };
105    }
106    public static DB.TaskData ToEntity(DT.TaskData source) {
107      if (source == null) return null;
108      var entity = new DB.TaskData(); ToEntity(source, entity);
109      return entity;
110    }
111    public static void ToEntity(DT.TaskData source, DB.TaskData target) {
112      if ((source != null) && (target != null)) {
113        target.TaskId = source.TaskId;
114        target.Data = source.Data;
115        target.LastUpdate = source.LastUpdate;
116      }
117    }
118    #endregion
119
120    #region StateLog
121    public static DT.StateLog ToDto(DB.StateLog source) {
122      if (source == null) return null;
123      return new DT.StateLog { Id = source.StateLogId, DateTime = source.DateTime, Exception = source.Exception, TaskId = source.TaskId, SlaveId = source.SlaveId, State = Convert.ToDto(source.State), UserId = source.UserId };
124    }
125    public static DB.StateLog ToEntity(DT.StateLog source) {
126      if (source == null) return null;
127      var entity = new DB.StateLog(); ToEntity(source, entity);
128      return entity;
129    }
130    public static void ToEntity(DT.StateLog source, DB.StateLog target) {
131      if ((source != null) && (target != null)) {
132        target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target.TaskId = source.TaskId; target.SlaveId = source.SlaveId; target.State = Convert.ToEntity(source.State); target.UserId = source.UserId;
133      }
134    }
135    #endregion
136
137    #region Downtimes
138    public static DT.Downtime ToDto(DB.Downtime source) {
139      if (source == null) return null;
140      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, DowntimeType = source.DowntimeType };
141    }
142    public static DB.Downtime ToEntity(DT.Downtime source) {
143      if (source == null) return null;
144      var entity = new DB.Downtime(); ToEntity(source, entity);
145      return entity;
146    }
147    public static void ToEntity(DT.Downtime source, DB.Downtime target) {
148      if ((source != null) && (target != null)) {
149        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; target.DowntimeType = source.DowntimeType;
150      }
151    }
152    #endregion
153
154    #region Job
155    public static DT.Job ToDto(DB.Job source) {
156      if (source == null) return null;
157      return new DT.Job { Id = source.JobId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds };
158    }
159    public static DB.Job ToEntity(DT.Job source) {
160      if (source == null) return null;
161      var entity = new DB.Job(); ToEntity(source, entity);
162      return entity;
163    }
164    public static void ToEntity(DT.Job source, DB.Job target) {
165      if ((source != null) && (target != null)) {
166        target.JobId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames;
167      }
168    }
169    #endregion
170
171    #region JobPermission
172    public static DT.JobPermission ToDto(DB.JobPermission source) {
173      if (source == null) return null;
174      return new DT.JobPermission { JobId = source.JobId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId, Permission = Convert.ToDto(source.Permission) };
175    }
176    public static DB.JobPermission ToEntity(DT.JobPermission source) {
177      if (source == null) return null;
178      var entity = new DB.JobPermission(); ToEntity(source, entity);
179      return entity;
180    }
181    public static void ToEntity(DT.JobPermission source, DB.JobPermission target) {
182      if ((source != null) && (target != null)) {
183        target.JobId = source.JobId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; target.Permission = Convert.ToEntity(source.Permission);
184      }
185    }
186    #endregion
187
188    #region Plugin
189    public static DT.Plugin ToDto(DB.Plugin source) {
190      if (source == null) return null;
191      return new DT.Plugin { Id = source.PluginId, Name = source.Name, Version = new Version(source.Version), UserId = source.UserId, DateCreated = source.DateCreated, Hash = source.Hash };
192    }
193    public static DB.Plugin ToEntity(DT.Plugin source) {
194      if (source == null) return null;
195      var entity = new DB.Plugin(); ToEntity(source, entity);
196      return entity;
197    }
198    public static void ToEntity(DT.Plugin source, DB.Plugin target) {
199      if ((source != null) && (target != null)) {
200        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;
201      }
202    }
203    #endregion
204
205    #region PluginData
206    public static DT.PluginData ToDto(DB.PluginData source) {
207      if (source == null) return null;
208      return new DT.PluginData { Id = source.PluginDataId, PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName };
209    }
210    public static DB.PluginData ToEntity(DT.PluginData source) {
211      if (source == null) return null;
212      var entity = new DB.PluginData(); ToEntity(source, entity);
213      return entity;
214    }
215    public static void ToEntity(DT.PluginData source, DB.PluginData target) {
216      if ((source != null) && (target != null)) {
217        target.PluginDataId = source.Id;
218        target.PluginId = source.PluginId;
219        target.Data = source.Data;
220        target.FileName = source.FileName;
221      }
222    }
223    #endregion
224
225    #region Resource
226    public static DT.Resource ToDto(DB.Resource source) {
227      if (source == null) return null;
228      return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval, OwnerUserId = source.OwnerUserId };
229    }
230    public static DB.Resource ToEntity(DT.Resource source) {
231      if (source == null) return null;
232      var entity = new DB.Resource(); ToEntity(source, entity);
233      return entity;
234    }
235    public static void ToEntity(DT.Resource source, DB.Resource target) {
236      if ((source != null) && (target != null)) {
237        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; target.OwnerUserId = source.OwnerUserId;
238      }
239    }
240    #endregion
241
242    #region SlaveGroup
243    public static DT.SlaveGroup ToDto(DB.SlaveGroup source) {
244      if (source == null) return null;
245      return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval, OwnerUserId = source.OwnerUserId };
246    }
247    public static DB.SlaveGroup ToEntity(DT.SlaveGroup source) {
248      if (source == null) return null;
249      var entity = new DB.SlaveGroup(); ToEntity(source, entity);
250      return entity;
251    }
252    public static void ToEntity(DT.SlaveGroup source, DB.SlaveGroup target) {
253      if ((source != null) && (target != null)) {
254        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; target.OwnerUserId = source.OwnerUserId;
255      }
256    }
257    #endregion
258
259    #region Slave
260    public static DT.Slave ToDto(DB.Slave source) {
261      if (source == null) return null;
262      return new DT.Slave {
263        Id = source.ResourceId,
264        ParentResourceId = source.ParentResourceId,
265        Cores = source.Cores,
266        CpuSpeed = source.CpuSpeed,
267        FreeCores = source.FreeCores,
268        FreeMemory = source.FreeMemory,
269        IsAllowedToCalculate = source.IsAllowedToCalculate,
270        Memory = source.Memory,
271        Name = source.Name,
272        SlaveState = Convert.ToDto(source.SlaveState),
273        CpuArchitecture = Convert.ToDto(source.CpuArchitecture),
274        OperatingSystem = source.OperatingSystem,
275        LastHeartbeat = source.LastHeartbeat,
276        CpuUtilization = source.CpuUtilization,
277        HbInterval = source.HbInterval,
278        IsDisposable = source.IsDisposable,
279        OwnerUserId = source.OwnerUserId
280      };
281    }
282    public static DB.Slave ToEntity(DT.Slave source) {
283      if (source == null) return null;
284      var entity = new DB.Slave(); ToEntity(source, entity);
285      return entity;
286    }
287    public static void ToEntity(DT.Slave source, DB.Slave target) {
288      if ((source != null) && (target != null)) {
289        target.ResourceId = source.Id;
290        target.ParentResourceId = source.ParentResourceId;
291        target.Cores = source.Cores;
292        target.CpuSpeed = source.CpuSpeed;
293        target.FreeCores = source.FreeCores;
294        target.FreeMemory = source.FreeMemory;
295        target.IsAllowedToCalculate = source.IsAllowedToCalculate;
296        target.Memory = source.Memory;
297        target.Name = source.Name;
298        target.SlaveState = Convert.ToEntity(source.SlaveState);
299        target.CpuArchitecture = Convert.ToEntity(source.CpuArchitecture);
300        target.OperatingSystem = source.OperatingSystem;
301        target.LastHeartbeat = source.LastHeartbeat;
302        target.CpuUtilization = source.CpuUtilization;
303        target.HbInterval = source.HbInterval;
304        target.IsDisposable = source.IsDisposable;
305        target.OwnerUserId = source.OwnerUserId;
306      }
307    }
308    #endregion
309
310    #region ResourcePermission
311    public static DT.ResourcePermission ToDto(DB.ResourcePermission source) {
312      if (source == null) return null;
313      return new DT.ResourcePermission { ResourceId = source.ResourceId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId };
314    }
315    public static DB.ResourcePermission ToEntity(DT.ResourcePermission source) {
316      if (source == null) return null;
317      var entity = new DB.ResourcePermission(); ToEntity(source, entity);
318      return entity;
319    }
320    public static void ToEntity(DT.ResourcePermission source, DB.ResourcePermission target) {
321      if ((source != null) && (target != null)) {
322        target.ResourceId = source.ResourceId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId;
323      }
324    }
325    #endregion
326
327    #region SlaveStatistics
328    public static DT.SlaveStatistics ToDto(DB.SlaveStatistics source) {
329      if (source == null) return null;
330      return new DT.SlaveStatistics {
331        Id = source.StatisticsId,
332        SlaveId = source.SlaveId,
333        Cores = source.Cores,
334        CpuUtilization = source.CpuUtilization,
335        FreeCores = source.FreeCores,
336        FreeMemory = source.FreeMemory,
337        Memory = source.Memory
338      };
339    }
340    public static DB.SlaveStatistics ToEntity(DT.SlaveStatistics source) {
341      if (source == null) return null;
342      var entity = new DB.SlaveStatistics(); ToEntity(source, entity);
343      return entity;
344    }
345    public static void ToEntity(DT.SlaveStatistics source, DB.SlaveStatistics target) {
346      if ((source != null) && (target != null)) {
347        target.StatisticsId = source.Id;
348        target.SlaveId = source.SlaveId;
349        target.Cores = source.Cores;
350        target.CpuUtilization = source.CpuUtilization;
351        target.FreeCores = source.FreeCores;
352        target.FreeMemory = source.FreeMemory;
353        target.Memory = source.Memory;
354      }
355    }
356    #endregion
357
358    #region Statistics
359    public static DT.Statistics ToDto(DB.Statistics source) {
360      if (source == null) return null;
361      return new DT.Statistics {
362        Id = source.StatisticsId,
363        TimeStamp = source.Timestamp,
364        SlaveStatistics = source.SlaveStatistics.Select(x => Convert.ToDto(x)).ToArray(),
365        UserStatistics = source.UserStatistics.Select(x => Convert.ToDto(x)).ToArray()
366      };
367    }
368    public static DB.Statistics ToEntity(DT.Statistics source) {
369      if (source == null) return null;
370      var entity = new DB.Statistics(); ToEntity(source, entity);
371      return entity;
372    }
373    public static void ToEntity(DT.Statistics source, DB.Statistics target) {
374      if ((source != null) && (target != null)) {
375        target.StatisticsId = source.Id;
376        target.Timestamp = source.TimeStamp;
377
378      }
379    }
380    #endregion
381
382    #region UserStatistics
383    public static DT.UserStatistics ToDto(DB.UserStatistics source) {
384      if (source == null) return null;
385      return new DT.UserStatistics {
386        Id = source.StatisticsId,
387        UserId = source.UserId,
388        UsedCores = source.UsedCores,
389        ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs),
390        ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(source.ExecutionTimeMsFinishedJobs),
391        StartToEndTime = TimeSpan.FromMilliseconds(source.StartToEndTimeMs)
392      };
393    }
394    public static DB.UserStatistics ToEntity(DT.UserStatistics source) {
395      if (source == null) return null;
396      var entity = new DB.UserStatistics(); ToEntity(source, entity);
397      return entity;
398    }
399    public static void ToEntity(DT.UserStatistics source, DB.UserStatistics target) {
400      if ((source != null) && (target != null)) {
401        target.StatisticsId = source.Id;
402        target.UserId = source.UserId;
403        target.UsedCores = source.UsedCores;
404        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
405        target.ExecutionTimeMsFinishedJobs = source.ExecutionTimeFinishedJobs.TotalMilliseconds;
406        target.StartToEndTimeMs = source.StartToEndTime.TotalMilliseconds;
407      }
408    }
409    #endregion
410
411    #region TaskData
412    public static DT.TaskState ToDto(DB.TaskState source) {
413      if (source == DB.TaskState.Aborted) {
414        return TaskState.Aborted;
415      } else if (source == DB.TaskState.Calculating) {
416        return TaskState.Calculating;
417      } else if (source == DB.TaskState.Failed) {
418        return TaskState.Failed;
419      } else if (source == DB.TaskState.Finished) {
420        return TaskState.Finished;
421      } else if (source == DB.TaskState.Offline) {
422        return TaskState.Offline;
423      } else if (source == DB.TaskState.Paused) {
424        return TaskState.Paused;
425      } else if (source == DB.TaskState.Transferring) {
426        return TaskState.Transferring;
427      } else if (source == DB.TaskState.Waiting) {
428        return TaskState.Waiting;
429      } else
430        return TaskState.Failed;
431    }
432
433    public static DB.TaskState ToEntity(DT.TaskState source) {
434      if (source == DT.TaskState.Aborted) {
435        return DB.TaskState.Aborted;
436      } else if (source == DT.TaskState.Calculating) {
437        return DB.TaskState.Calculating;
438      } else if (source == DT.TaskState.Failed) {
439        return DB.TaskState.Failed;
440      } else if (source == DT.TaskState.Finished) {
441        return DB.TaskState.Finished;
442      } else if (source == DT.TaskState.Offline) {
443        return DB.TaskState.Offline;
444      } else if (source == DT.TaskState.Paused) {
445        return DB.TaskState.Paused;
446      } else if (source == DT.TaskState.Transferring) {
447        return DB.TaskState.Transferring;
448      } else if (source == DT.TaskState.Waiting) {
449        return DB.TaskState.Waiting;
450      } else
451        return DB.TaskState.Failed;
452    }
453    #endregion
454
455    #region Permission
456    public static DT.Permission ToDto(DB.Permission source) {
457      if (source == DB.Permission.Full) {
458        return Permission.Full;
459      } else if (source == DB.Permission.NotAllowed) {
460        return Permission.NotAllowed;
461      } else if (source == DB.Permission.Read) {
462        return Permission.Read;
463      } else
464        return Permission.NotAllowed;
465    }
466
467    public static DB.Permission ToEntity(DT.Permission source) {
468      if (source == DT.Permission.Full) {
469        return DB.Permission.Full;
470      } else if (source == DT.Permission.NotAllowed) {
471        return DB.Permission.NotAllowed;
472      } else if (source == DT.Permission.Read) {
473        return DB.Permission.Read;
474      } else
475        return DB.Permission.NotAllowed;
476    }
477    #endregion
478
479    #region Command
480    public static DT.Command? ToDto(DB.Command? source) {
481      if (source.HasValue) {
482        if (source.Value == DB.Command.Abort) {
483          return Command.Abort;
484        } else if (source.Value == DB.Command.Pause) {
485          return Command.Pause;
486        } else if (source.Value == DB.Command.Stop) {
487          return Command.Stop;
488        } else
489          return Command.Pause;
490      }
491      return null;
492    }
493
494    public static DB.Command? ToEntity(DT.Command? source) {
495      if (source.HasValue) {
496        if (source == DT.Command.Abort) {
497          return DB.Command.Abort;
498        } else if (source == DT.Command.Pause) {
499          return DB.Command.Pause;
500        } else if (source == DT.Command.Stop) {
501          return DB.Command.Stop;
502        } else
503          return DB.Command.Pause;
504      } else
505        return null;
506    }
507    #endregion
508
509    #region CpuArchiteture
510    public static DT.CpuArchitecture ToDto(DB.CpuArchitecture source) {
511      if (source == DB.CpuArchitecture.x64) {
512        return CpuArchitecture.x64;
513      } else if (source == DB.CpuArchitecture.x86) {
514        return CpuArchitecture.x86;
515      } else
516        return CpuArchitecture.x86;
517    }
518
519    public static DB.CpuArchitecture ToEntity(DT.CpuArchitecture source) {
520      if (source == DT.CpuArchitecture.x64) {
521        return DB.CpuArchitecture.x64;
522      } else if (source == DT.CpuArchitecture.x86) {
523        return DB.CpuArchitecture.x86;
524      } else
525        return DB.CpuArchitecture.x86;
526    }
527    #endregion
528
529    #region SlaveState
530    public static DT.SlaveState ToDto(DB.SlaveState source) {
531      if (source == DB.SlaveState.Calculating) {
532        return SlaveState.Calculating;
533      } else if (source == DB.SlaveState.Idle) {
534        return SlaveState.Idle;
535      } else if (source == DB.SlaveState.Offline) {
536        return SlaveState.Offline;
537      } else
538        return SlaveState.Offline;
539    }
540
541    public static DB.SlaveState ToEntity(DT.SlaveState source) {
542      if (source == DT.SlaveState.Calculating) {
543        return DB.SlaveState.Calculating;
544      } else if (source == DT.SlaveState.Idle) {
545        return DB.SlaveState.Idle;
546      } else if (source == DT.SlaveState.Offline) {
547        return DB.SlaveState.Offline;
548      } else
549        return DB.SlaveState.Offline;
550    }
551    #endregion
552
553    #region UserPriority
554    public static DT.UserPriority ToDto(DB.UserPriority source) {
555      if (source == null) return null;
556      return new DT.UserPriority() { Id = source.UserId, DateEnqueued = source.DateEnqueued };
557    }
558    public static DB.UserPriority ToEntity(DT.UserPriority source) {
559      if (source == null) return null;
560      var entity = new DB.UserPriority(); ToEntity(source, entity);
561      return entity;
562    }
563    public static void ToEntity(DT.UserPriority source, DB.UserPriority target) {
564      if ((source != null) && (target != null)) {
565        target.UserId = source.Id;
566        target.DateEnqueued = source.DateEnqueued;
567      }
568    }
569    #endregion
570  }
571}
Note: See TracBrowser for help on using the repository browser.