Ejemplo n.º 1
0
        public dtoResource(liteResource resource, String unknownUser)
        {
            IdResource = resource.Id;
            switch (resource.Type)
            {
            case Domain.ResourceType.Internal:
                if (resource.Person != null)
                {
                    IdPerson  = resource.Person.Id;
                    LongName  = resource.Person.SurnameAndName;
                    ShortName = resource.GetShortName();
                }
                else
                {
                    LongName = unknownUser;
                }
                break;

            case Domain.ResourceType.External:
            case Domain.ResourceType.Removed:
                LongName  = resource.LongName;
                ShortName = resource.ShortName;
                break;
            }

            DefaultForActivity = resource.DefaultForActivity;
            ProjectRole        = resource.ProjectRole;
        }
Ejemplo n.º 2
0
 public dtoProjectGroupInfo(liteProjectSettings project, PmActivityPermission permissions = PmActivityPermission.None, liteResource resource = null)
 {
     ProjectUrls    = new dtoProjectUrls();
     UserCompletion = new Dictionary <ResourceActivityStatus, long>();
     if (project == null)
     {
         Id          = 0;
         Name        = "";
         IdCommunity = -1;
     }
     else
     {
         Id           = project.Id;
         IsCompleted  = project.IsCompleted;
         IdCommunity  = project.IdCommunity;
         Name         = project.Name;
         Completeness = project.Completeness;
         Status       = project.Status;
         Deleted      = project.Deleted;
         isPersonal   = project.isPersonal;
         isPortal     = project.isPortal;
         Deleted      = project.Deleted;
         StartDate    = project.StartDate;
         EndDate      = project.EndDate;
         Deadline     = project.Deadline;
     }
     if (resource != null)
     {
         long notStarted = resource.AssignedActivities;
         UserCompletion[ResourceActivityStatus.completed] = resource.CompletedActivities;
         notStarted -= resource.CompletedActivities;
         if (project.ConfirmCompletion)
         {
             UserCompletion[ResourceActivityStatus.confirmed] = resource.ConfirmedActivities;
             notStarted -= resource.ConfirmedActivities;
         }
         notStarted = notStarted - resource.LateActivities - resource.StartedActivities;
         if (notStarted < 0)
         {
             notStarted = 0;
         }
         UserCompletion[ResourceActivityStatus.late]       = resource.LateActivities;
         UserCompletion[ResourceActivityStatus.started]    = resource.StartedActivities;
         UserCompletion[ResourceActivityStatus.notstarted] = notStarted;
         UserCompletion[ResourceActivityStatus.all]        = resource.AssignedActivities;
     }
     SetPermissions(permissions);
 }
Ejemplo n.º 3
0
        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;
        }