Example #1
0
        /// <summary>
        /// Determine visibility of control based on UserType
        /// </summary>
        private void SetButtonVisibility()
        {
            // Determine if page is ProjectMgmt page and read user type
            // to determine visibility
            if (Page is ProjectMgmtBasePage)
            {
                ProjectMgmtBasePage projectPage       = Page as ProjectMgmtBasePage;
                ProjectMgmtContext  activePageContext = projectPage.ProjectContext;
                ProjectMgmtUsers    activeUserType    = projectPage.UserType;

                // Buttons default visibility = false
                bool hasPermission = false;

                foreach (ProjectMgmtUsers type in _userTypes)
                {
                    if (activeUserType == type && (!_customContext || _customContext && _projectContext == activePageContext))
                    {
                        hasPermission = true;
                        break;
                    }
                }

                // Finally set button visibility
                this.Visible = hasPermission;
                this.Enabled = hasPermission;
            }
        }
Example #2
0
 private void SetLinkPermissions()
 {
     if (Page is ProjectMgmtBasePage)
     {
         ProjectMgmtBasePage page = Page as ProjectMgmtBasePage;
         // Regular user shouldn't see funding sources
         if (page.UserType == ProjectMgmtUsers.ProjectUser)
         {
             Funding.Visible = false;
         }
         // Hide if in context of organization
         if (page.ProjectContext != ProjectMgmtContext.Project)
         {
             this.Visible = false;
         }
         else
         {
             Funding.HRef = Page.ResolveUrl("ProjectFunding.aspx?projectId=" + ProjectId);
         }
     }
 }