示例#1
0
 public static IActivity <int> FromDto(ActivityDto dto)
 {
     if (dto == null)
     {
         throw new ArgumentNullException(nameof(dto));
     }
     return(new Activity <int>(
                dto.Id,
                dto.Name,
                dto.TargetResources,
                dto.TargetResourceOperator,
                dto.CanBeRemoved,
                dto.Duration,
                dto.FreeSlack,
                dto.EarliestStartTime,
                dto.LatestFinishTime,
                dto.MinimumFreeSlack,
                dto.MinimumEarliestStartTime,
                dto.MinimumEarliestStartDateTime));
 }
示例#2
0
 public static ActivityDto Copy(this ActivityDto activityDto)
 {
     if (activityDto == null)
     {
         throw new ArgumentNullException(nameof(activityDto));
     }
     return(new ActivityDto
     {
         Id = activityDto.Id,
         Name = activityDto.Name,
         TargetResources = activityDto.TargetResources != null?activityDto.TargetResources.ToList() : new List <int>(),
                               TargetResourceOperator = activityDto.TargetResourceOperator,
                               CanBeRemoved = activityDto.CanBeRemoved,
                               Duration = activityDto.Duration,
                               FreeSlack = activityDto.FreeSlack,
                               EarliestStartTime = activityDto.EarliestStartTime,
                               LatestFinishTime = activityDto.LatestFinishTime,
                               MinimumFreeSlack = activityDto.MinimumFreeSlack,
                               MinimumEarliestStartTime = activityDto.MinimumEarliestStartTime,
                               MinimumEarliestStartDateTime = activityDto.MinimumEarliestStartDateTime
     });
 }