private void FixupTask(TaskDto previousValue) { if (previousValue != null && previousValue.Resources.Contains(this)) { previousValue.Resources.Remove(this); } if (Task != null) { if (!Task.Resources.Contains(this)) { Task.Resources.Add(this); } if (TaskId != Task.Id) { TaskId = Task.Id; } } }
private List<TaskDto> GetTask() { var taskDtoListIndexes = new List<TaskDto>(); var taskDtoList = new List<TaskDto>(); foreach (var tmpTask in GetTaskInCalendar(ultraCalendarInfo.Tasks.ToList())) { if (tmpTask.Dependencies.Count > 0) { foreach (var tmpTaskDependency in tmpTask.Dependencies) { var taskParent = taskDtoListIndexes.Where(x => x.RowNumber == tmpTaskDependency.Predecessor.RowNumber).SingleOrDefault(); var tmpTaskDto = new TaskDto(); Mapper(tmpTask, tmpTaskDto); if (taskParent != null) taskParent.Tasks.Add(tmpTaskDto); taskDtoListIndexes.Add(tmpTaskDto); } } else { var tmpTaskDto = new TaskDto(); Mapper(tmpTask, tmpTaskDto); //Si la tarea no tiene dependencias se agrega normal a la lista taskDtoList.Add(tmpTaskDto); taskDtoListIndexes.Add(tmpTaskDto); } } return taskDtoList; }
private void Mapper(Task source, TaskDto destination) { destination.ProjectId = _project.Id; destination.Name = source.Name; destination.Duration = source.Duration.ToString(); destination.PercentComplete = source.PercentComplete; destination.StartDateTime = source.StartDateTime; destination.EndDateTime = source.EndDateTime; destination.Notes = source.Notes; destination.DeadLine = source.Deadline; destination.Expanded = source.Expanded; destination.Milestone = source.Milestone; destination.RowNumber = source.RowNumber; destination.TaskLevel = source.Level; destination.Resources = source.Tag as List<ResourceDto>; #region Properties that are not necessary destination.IsRoot = source.IsRoot; destination.IsSumary = source.IsSummary; destination.BindingListIndex = source.BindingListIndex; destination.CompleteThrough = source.CompleteThrough; destination.DurationResolved = source.DurationResolved.ToString(); destination.EndDateTimeResolved = source.EndDateTimeResolved; destination.MilestoneResolved = source.MilestoneResolved; #endregion }
private static void Mapper(TaskDto source, Task destination) { destination.Name = source.Name; destination.Duration = TimeSpan.Parse(source.Duration); destination.PercentComplete = (float)source.PercentComplete; destination.StartDateTime = source.StartDateTime; destination.EndDateTime = source.EndDateTime; destination.Notes = source.Notes; destination.Deadline = source.DeadLine; destination.Expanded = source.Expanded; destination.Milestone = source.Milestone; }