Beispiel #1
0
 public dtoPlainProject()
 {
     Availability   = ProjectAvailability.Draft;
     Visibility     = ProjectVisibility.Full;
     Permissions    = new dtoProjectPermission();
     Roles          = new List <dtoProjectRole>();
     Urls           = new dtoProjectUrls();
     UserCompletion = new Dictionary <ResourceActivityStatus, long>();
 }
 public dtoProjectGroupInfo(Project project, PmActivityPermission permissions = PmActivityPermission.None, ProjectResource 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.Community == null) ? (project.isPortal ? 0 : -1) : project.Community.Id;
         Name          = project.Name;
         Completeness  = project.Completeness;
         Status        = project.Status;
         CommunityName = (project.Community != null) ? project.Community.Name : "";
         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);
 }
Beispiel #3
0
        public dtoPlainProject(Project project, ActivityRole projectRole, ProjectVisibility visibility, Dictionary <ActivityRole, String> roleTranslations, Boolean alsoAsResource = false)
        {
            Id            = project.Id;
            IsCompleted   = project.IsCompleted;
            IdCommunity   = (project.Community == null) ? (project.isPortal ? 0 : -1) : project.Community.Id;
            Name          = project.Name;
            Completeness  = project.Completeness;
            Status        = project.Status;
            CommunityName = (project.Community != null) ? project.Community.Name:"";
            Deleted       = project.Deleted;
            isPersonal    = project.isPersonal;
            isPortal      = project.isPortal;
            Deleted       = project.Deleted;
            Visibility    = visibility;
            Roles         = new List <dtoProjectRole>();
            Roles.Add(new dtoProjectRole()
            {
                ProjectRole = projectRole, LongName = roleTranslations[projectRole], ShortName = roleTranslations[projectRole].ToCharArray()[0].ToString()
            });
            if (projectRole == ActivityRole.ProjectOwner)
            {
                Roles.Add(new dtoProjectRole()
                {
                    ProjectRole = ActivityRole.Manager, LongName = roleTranslations[ActivityRole.Manager], ShortName = roleTranslations[ActivityRole.Manager].ToCharArray()[0].ToString()
                });
            }
            if (alsoAsResource)
            {
                Roles.Add(new dtoProjectRole()
                {
                    ProjectRole = ActivityRole.Resource, LongName = roleTranslations[ActivityRole.Resource], ShortName = roleTranslations[ActivityRole.Resource].ToCharArray()[0].ToString()
                });
            }

            StartDate                = project.StartDate;
            EndDate                  = project.EndDate;
            Deadline                 = project.Deadline;
            Availability             = project.Availability;
            Permissions              = new dtoProjectPermission();
            Urls                     = new dtoProjectUrls();
            ProjectAttachmentsCount  = (project.Attachments != null ? project.Attachments.Where(a => a.Deleted == BaseStatusDeleted.None && a.IsForProject).LongCount() : 0);
            HasProjectAttachments    = !(ProjectAttachmentsCount == 0);
            HasActivitiesAttachments = (project.AttachmentLinks != null && project.AttachmentLinks.Where(a => a.Deleted == BaseStatusDeleted.None && !a.IsForProject).Any());
        }
Beispiel #4
0
 public dtoPlainProject(ModuleProjectManagement modulePermission, Project project, ProjectVisibility visibility, Dictionary <ActivityRole, String> roleTranslations, Boolean alsoAsResource = false)
 {
     Id            = project.Id;
     IsCompleted   = project.IsCompleted;
     IdCommunity   = (project.Community == null) ? (project.isPortal ? 0 : -1) : project.Community.Id;
     Name          = project.Name;
     Completeness  = project.Completeness;
     Status        = project.Status;
     CommunityName = (project.Community != null) ? project.Community.Name:"";
     Deleted       = project.Deleted;
     isPersonal    = project.isPersonal;
     isPortal      = project.isPortal;
     Deleted       = project.Deleted;
     Visibility    = visibility;
     Roles         = new List <dtoProjectRole>();
     if (alsoAsResource)
     {
         Roles.Add(new dtoProjectRole()
         {
             ProjectRole = ActivityRole.Resource, LongName = roleTranslations[ActivityRole.Resource], ShortName = roleTranslations[ActivityRole.Resource].ToCharArray()[0].ToString()
         });
     }
     StartDate                   = project.StartDate;
     EndDate                     = project.EndDate;
     Deadline                    = project.Deadline;
     Availability                = project.Availability;
     Urls                        = new dtoProjectUrls();
     Permissions                 = new dtoProjectPermission();
     Permissions.Edit            = (modulePermission.Administration || modulePermission.Edit) && project.Deleted == BaseStatusDeleted.None;
     Permissions.EditMap         = (modulePermission.Administration || modulePermission.Edit) && project.Deleted == BaseStatusDeleted.None;
     Permissions.EditResources   = (modulePermission.Administration || modulePermission.Edit) && project.Deleted == BaseStatusDeleted.None;
     Permissions.PhisicalDelete  = (modulePermission.Administration || modulePermission.Edit) && project.Deleted != BaseStatusDeleted.None;
     Permissions.VirtualDelete   = (modulePermission.Administration || modulePermission.Edit) && project.Deleted == BaseStatusDeleted.None;
     Permissions.VirtualUndelete = (modulePermission.Administration || modulePermission.Edit) && project.Deleted != BaseStatusDeleted.None;
     Permissions.ViewAttachments = (modulePermission.Administration || modulePermission.Edit);
     Permissions.EditAttachments = (modulePermission.Administration || modulePermission.Edit) && project.Deleted == BaseStatusDeleted.None;
     //Permissions.ViewAttachments = ((modulePermission.Administration && !project.isPersonal) || modulePermission.Edit) && project.Deleted == BaseStatusDeleted.None;
     //Permissions.EditAttachments = (modulePermission.Administration || modulePermission.Edit) && project.Deleted == BaseStatusDeleted.None;
     ProjectAttachmentsCount  = (project.Attachments != null ? project.Attachments.Where(a => a.Deleted == BaseStatusDeleted.None && a.IsForProject).LongCount() : 0);
     HasProjectAttachments    = !(ProjectAttachmentsCount == 0);
     HasActivitiesAttachments = (project.AttachmentLinks != null && project.AttachmentLinks.Where(a => a.Deleted == BaseStatusDeleted.None && !a.IsForProject).Any());
 }
 public dtoProjectGroupInfo()
 {
     projectPermissions = PmActivityPermission.None;
     ProjectUrls        = new dtoProjectUrls();
     UserCompletion     = new Dictionary <ResourceActivityStatus, long>();
 }