private void setDtoSettings(liteProjectActivityAssignment assignment, PmActivityPermission permissions, liteResource resource = null) { litePmActivity task = assignment.Activity; Id = task.Id; IdAssignment = assignment.Id; ProjectInfo = new dtoProjectGroupInfo(assignment.Project, permissions, resource); Name = task.Name; Description = task.Description; Notes = task.Notes; Completeness = task.Completeness; IsCompleted = task.IsCompleted; Deleted = task.Deleted; Status = task.Status; StartDate = task.EarlyStartDate; EndDate = task.EarlyFinishDate; Deadline = task.Deadline; Duration = task.Duration; IsDurationEstimated = task.IsDurationEstimated; IdResources = task.CurrentAssignments.Select(a => a.Resource.Id).ToList(); Assignments = task.CurrentAssignments.Select(a => new dtoActivityCompletion() { Id = Id, IdResource = a.Resource.Id, Completeness = a.Completeness, IsApproved = a.IsApproved }).ToList(); MyCompleteness = new dtoField <String>(assignment.Completeness.ToString() + "%"); MyAssignmentIsApproved = assignment.IsApproved; }
public dtoPlainTask(liteProjectActivityAssignment assignment, Dictionary <ActivityRole, PmActivityPermission> permissions) { ProjectResources = new List <dtoResource>(); if (assignment == null || assignment.Activity == null) { Id = 0; Deleted = BaseStatusDeleted.Manual; } else { setDtoSettings(assignment, (permissions.ContainsKey(assignment.Resource.ProjectRole) ? permissions[assignment.Resource.ProjectRole] : permissions[ActivityRole.Resource]), assignment.Resource); } }