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>();
 }
Beispiel #2
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 #3
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());
 }