Changeset 16117 for trunk/HeuristicLab.Services.Hive/3.3/Converter.cs
- Timestamp:
- 08/30/18 11:32:56 (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Services.Hive
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Services.Hive/3.3/Converter.cs
r15583 r16117 121 121 OwnerUserId = source.OwnerUserId, 122 122 DateCreated = source.DateCreated, 123 ResourceNames = source.ResourceIds 123 ProjectId = source.ProjectId, 124 State = source.State.ToDto() 124 125 }; 125 126 } … … 139 140 target.OwnerUserId = source.OwnerUserId; 140 141 target.DateCreated = source.DateCreated; 141 target.ResourceIds = source.ResourceNames; 142 target.ProjectId = source.ProjectId; 143 target.State = source.State.ToEntity(); 144 } 145 #endregion 146 147 #region AssignedJobResource 148 public static DT.AssignedJobResource ToDto(this DA.AssignedJobResource source) { 149 if (source == null) return null; 150 return new DT.AssignedJobResource { 151 JobId = source.JobId, 152 ResourceId = source.ResourceId 153 }; 154 } 155 public static DA.AssignedJobResource ToEntity(this DT.AssignedJobResource source) { 156 if (source == null) return null; 157 var result = new DA.AssignedJobResource(); 158 source.CopyToEntity(result); 159 return result; 160 } 161 public static void CopyToEntity(this DT.AssignedJobResource source, DA.AssignedJobResource target) { 162 if ((source == null) || (target == null)) return; 163 target.JobId = source.JobId; 164 target.ResourceId = source.ResourceId; 142 165 } 143 166 #endregion … … 221 244 #endregion 222 245 223 #region State246 #region TaskState 224 247 public static DT.TaskState ToDto(this DA.TaskState source) { 225 248 switch (source) { … … 247 270 case DT.TaskState.Waiting: return DA.TaskState.Waiting; 248 271 default: return DA.TaskState.Failed; 272 } 273 } 274 #endregion 275 276 #region JobState 277 public static DT.JobState ToDto(this DA.JobState source) { 278 switch (source) { 279 case DA.JobState.Online: return DT.JobState.Online; 280 case DA.JobState.StatisticsPending: return DT.JobState.StatisticsPending; 281 case DA.JobState.DeletionPending: return DT.JobState.DeletionPending; 282 default: return DT.JobState.Online; 283 } 284 } 285 286 public static DA.JobState ToEntity(this DT.JobState source) { 287 switch (source) { 288 case DT.JobState.Online: return DA.JobState.Online; 289 case DT.JobState.StatisticsPending: return DA.JobState.StatisticsPending; 290 case DT.JobState.DeletionPending: return DA.JobState.DeletionPending; 291 default: return DA.JobState.Online; 249 292 } 250 293 } … … 333 376 #endregion 334 377 335 #region ResourcePermission 336 public static DT.ResourcePermission ToDto(this DA.ResourcePermission source) { 337 if (source == null) return null; 338 return new DT.ResourcePermission { 339 ResourceId = source.ResourceId, 378 #region Project 379 public static DT.Project ToDto(this DA.Project source) { 380 if (source == null) return null; 381 return new DT.Project { 382 Id = source.ProjectId, 383 ParentProjectId = source.ParentProjectId, 384 DateCreated = source.DateCreated, 385 Name = source.Name, 386 Description = source.Description, 387 OwnerUserId = source.OwnerUserId, 388 StartDate = source.StartDate, 389 EndDate = source.EndDate 390 }; 391 } 392 public static DA.Project ToEntity(this DT.Project source) { 393 if (source == null) return null; 394 var result = new DA.Project(); 395 source.CopyToEntity(result); 396 return result; 397 } 398 public static void CopyToEntity(this DT.Project source, DA.Project target) { 399 if ((source == null) || (target == null)) return; 400 target.ProjectId = source.Id; 401 target.ParentProjectId = source.ParentProjectId; 402 target.DateCreated = source.DateCreated; 403 target.Name = source.Name; 404 target.Description = source.Description; 405 target.OwnerUserId = source.OwnerUserId; 406 target.StartDate = source.StartDate; 407 target.EndDate = source.EndDate; 408 } 409 #endregion 410 411 #region ProjectPermission 412 public static DT.ProjectPermission ToDto(this DA.ProjectPermission source) { 413 if (source == null) return null; 414 return new DT.ProjectPermission { 415 ProjectId = source.ProjectId, 340 416 GrantedUserId = source.GrantedUserId, 341 417 GrantedByUserId = source.GrantedByUserId 342 418 }; 343 419 } 344 public static DA. ResourcePermission ToEntity(this DT.ResourcePermission source) {345 if (source == null) return null; 346 var result = new DA. ResourcePermission();347 source.CopyToEntity(result); 348 return result; 349 } 350 public static void CopyToEntity(this DT. ResourcePermission source, DA.ResourcePermission target) {351 if ((source == null) || (target == null)) return; 352 target. ResourceId = source.ResourceId;420 public static DA.ProjectPermission ToEntity(this DT.ProjectPermission source) { 421 if (source == null) return null; 422 var result = new DA.ProjectPermission(); 423 source.CopyToEntity(result); 424 return result; 425 } 426 public static void CopyToEntity(this DT.ProjectPermission source, DA.ProjectPermission target) { 427 if ((source == null) || (target == null)) return; 428 target.ProjectId = source.ProjectId; 353 429 target.GrantedUserId = source.GrantedUserId; 354 430 target.GrantedByUserId = source.GrantedByUserId; 431 } 432 #endregion 433 434 #region AssignedProjectResource 435 public static DT.AssignedProjectResource ToDto(this DA.AssignedProjectResource source) { 436 if (source == null) return null; 437 return new DT.AssignedProjectResource { 438 ProjectId = source.ProjectId, 439 ResourceId = source.ResourceId 440 }; 441 } 442 public static DA.AssignedProjectResource ToEntity(this DT.AssignedProjectResource source) { 443 if (source == null) return null; 444 var result = new DA.AssignedProjectResource(); 445 source.CopyToEntity(result); 446 return result; 447 } 448 public static void CopyToEntity(this DT.AssignedProjectResource source, DA.AssignedProjectResource target) { 449 if ((source == null) || (target == null)) return; 450 target.ProjectId = source.ProjectId; 451 target.ResourceId = source.ResourceId; 355 452 } 356 453 #endregion
Note: See TracChangeset
for help on using the changeset viewer.