Esempio n. 1
0
        public static ModuleProjectManagement CreatePortalmodule(int UserTypeID)
        {
            ModuleProjectManagement module = new ModuleProjectManagement();

            module.Administration        = (UserTypeID == (int)UserTypeStandard.SysAdmin || UserTypeID == (int)UserTypeStandard.Administrator);
            module.CreatePublicProject   = (UserTypeID == (int)UserTypeStandard.SysAdmin || UserTypeID == (int)UserTypeStandard.Administrator);
            module.CreatePersonalProject = (UserTypeID != (int)UserTypeStandard.Guest);

            module.DownloadAllowed      = (UserTypeID == (int)UserTypeStandard.SysAdmin || UserTypeID == (int)UserTypeStandard.Administrator || UserTypeID == (int)UserTypeStandard.Administrative);
            module.ManagementPermission = (UserTypeID == (int)UserTypeStandard.SysAdmin || UserTypeID == (int)UserTypeStandard.Administrator);
            module.PrintTaskList        = (UserTypeID != (int)UserTypeStandard.Guest);
            module.ViewTaskList         = (UserTypeID != (int)UserTypeStandard.Guest);

            module.UploadFile = (UserTypeID == (int)UserTypeStandard.SysAdmin || UserTypeID == (int)UserTypeStandard.Administrator || UserTypeID == (int)UserTypeStandard.Administrative);

            return(module);
        }
Esempio n. 2
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());
 }