- Timestamp:
- 06/21/12 18:02:33 (12 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators
- Property svn:ignore
-
old new 20 20 bin 21 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/GP-MoveOperators/HeuristicLab.Services.Hive/3.3/Convert.cs
r7259 r8085 200 200 #endregion 201 201 202 #region Resource 203 public static DT.Resource ToDto(DB.Resource source) { 204 if (source == null) return null; 205 return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval, OwnerUserId = source.OwnerUserId }; 206 } 207 public static DB.Resource ToEntity(DT.Resource source) { 208 if (source == null) return null; 209 var entity = new DB.Resource(); ToEntity(source, entity); 210 return entity; 211 } 212 public static void ToEntity(DT.Resource source, DB.Resource target) { 213 if ((source != null) && (target != null)) { 214 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; target.OwnerUserId = source.OwnerUserId; 215 } 216 } 217 #endregion 218 219 #region SlaveGroup 220 public static DT.SlaveGroup ToDto(DB.SlaveGroup source) { 221 if (source == null) return null; 222 return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval, OwnerUserId = source.OwnerUserId }; 223 } 224 public static DB.SlaveGroup ToEntity(DT.SlaveGroup source) { 225 if (source == null) return null; 226 var entity = new DB.SlaveGroup(); ToEntity(source, entity); 227 return entity; 228 } 229 public static void ToEntity(DT.SlaveGroup source, DB.SlaveGroup target) { 230 if ((source != null) && (target != null)) { 231 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; target.OwnerUserId = source.OwnerUserId; 232 } 233 } 234 #endregion 235 202 236 #region Slave 203 237 public static DT.Slave ToDto(DB.Slave source) { … … 218 252 LastHeartbeat = source.LastHeartbeat, 219 253 CpuUtilization = source.CpuUtilization, 220 HbInterval = source.HbInterval 254 HbInterval = source.HbInterval, 255 IsDisposable = source.IsDisposable, 256 OwnerUserId = source.OwnerUserId 221 257 }; 222 258 } … … 243 279 target.CpuUtilization = source.CpuUtilization; 244 280 target.HbInterval = source.HbInterval; 245 } 246 } 247 #endregion 248 249 #region SlaveGroup 250 public static DT.SlaveGroup ToDto(DB.SlaveGroup source) { 251 if (source == null) return null; 252 return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval }; 253 } 254 public static DB.SlaveGroup ToEntity(DT.SlaveGroup source) { 255 if (source == null) return null; 256 var entity = new DB.SlaveGroup(); ToEntity(source, entity); 257 return entity; 258 } 259 public static void ToEntity(DT.SlaveGroup source, DB.SlaveGroup target) { 260 if ((source != null) && (target != null)) { 261 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; 262 } 263 } 264 #endregion 265 266 #region Resource 267 public static DT.Resource ToDto(DB.Resource source) { 268 if (source == null) return null; 269 return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval }; 270 } 271 public static DB.Resource ToEntity(DT.Resource source) { 272 if (source == null) return null; 273 var entity = new DB.Resource(); ToEntity(source, entity); 274 return entity; 275 } 276 public static void ToEntity(DT.Resource source, DB.Resource target) { 277 if ((source != null) && (target != null)) { 278 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; 279 } 280 } 281 #endregion 282 283 #region Statistics 284 public static DT.Statistics ToDto(DB.Statistics source) { 285 if (source == null) return null; 286 return new DT.Statistics { 287 Id = source.StatisticsId, 288 TimeStamp = source.Timestamp, 289 SlaveStatistics = source.SlaveStatistics.Select(x => Convert.ToDto(x)).ToArray(), 290 UserStatistics = source.UserStatistics.Select(x => Convert.ToDto(x)).ToArray() 291 }; 292 } 293 public static DB.Statistics ToEntity(DT.Statistics source) { 294 if (source == null) return null; 295 var entity = new DB.Statistics(); ToEntity(source, entity); 296 return entity; 297 } 298 public static void ToEntity(DT.Statistics source, DB.Statistics target) { 299 if ((source != null) && (target != null)) { 300 target.StatisticsId = source.Id; 301 target.Timestamp = source.TimeStamp; 302 281 target.IsDisposable = source.IsDisposable; 282 target.OwnerUserId = source.OwnerUserId; 283 } 284 } 285 #endregion 286 287 #region ResourcePermission 288 public static DT.ResourcePermission ToDto(DB.ResourcePermission source) { 289 if (source == null) return null; 290 return new DT.ResourcePermission { ResourceId = source.ResourceId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId }; 291 } 292 public static DB.ResourcePermission ToEntity(DT.ResourcePermission source) { 293 if (source == null) return null; 294 var entity = new DB.ResourcePermission(); ToEntity(source, entity); 295 return entity; 296 } 297 public static void ToEntity(DT.ResourcePermission source, DB.ResourcePermission target) { 298 if ((source != null) && (target != null)) { 299 target.ResourceId = source.ResourceId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; 303 300 } 304 301 } … … 332 329 target.FreeMemory = source.FreeMemory; 333 330 target.Memory = source.Memory; 331 } 332 } 333 #endregion 334 335 #region Statistics 336 public static DT.Statistics ToDto(DB.Statistics source) { 337 if (source == null) return null; 338 return new DT.Statistics { 339 Id = source.StatisticsId, 340 TimeStamp = source.Timestamp, 341 SlaveStatistics = source.SlaveStatistics.Select(x => Convert.ToDto(x)).ToArray(), 342 UserStatistics = source.UserStatistics.Select(x => Convert.ToDto(x)).ToArray() 343 }; 344 } 345 public static DB.Statistics ToEntity(DT.Statistics source) { 346 if (source == null) return null; 347 var entity = new DB.Statistics(); ToEntity(source, entity); 348 return entity; 349 } 350 public static void ToEntity(DT.Statistics source, DB.Statistics target) { 351 if ((source != null) && (target != null)) { 352 target.StatisticsId = source.Id; 353 target.Timestamp = source.TimeStamp; 354 334 355 } 335 356 }
Note: See TracChangeset
for help on using the changeset viewer.