Exemplo n.º 1
0
        public static Project GetProjectForUser(Guid projectId, Guid userId)
        {
            Project item = null;

            List <Guid> access = AllUserTaskAccess.GetTaskIdsForUserAndProject(userId, projectId);

            //check if user has access to this project, if so, retrieve it
            if (access != null && access.Count > 0)
            {
                item = AllProjects.GetForId(projectId, false);
            }

            return(item);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the list of projects for a user
        /// </summary>
        /// <param name="usr">The user with access to the projects</param>
        /// <param name="activeOnly">Indicator of active projects or not</param>
        /// <returns>Populated List of Projects if there are any, otherwise an empty list<Project></returns>
        public static List <Project> GetProjectsForUser(Guid userId, bool activeOnly)
        {
            List <Project> items = new List <Project>();

            foreach (Guid currItem in AllUserTaskAccess.GetProjectIdsForUser(userId))
            {
                Project currProj = AllProjects.GetForId(currItem, activeOnly);

                if (currProj != null)
                {
                    items.Add(currProj);
                }
            }

            items.Sort();
            return(items);
        }