Beispiel #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);
        }
Beispiel #2
0
        /// <summary>
        /// Gets the list of tasks for a project and a user
        /// </summary>
        /// <param name="projectId">The project which the tasks belong to</param>
        /// <param name="userId">The user with access to the tasks</param>
        /// <param name="activeOnly">Indicator of active tasks or not</param>
        /// <returns>Populated list of tasks if there are any, otherwise an empty list</returns>
        public static List <Task> GetTasksForProjectAndUser(Guid projectId, Guid userId, bool activeOnly)
        {
            List <Task> items = new List <Task>();

            foreach (Guid currItem in AllUserTaskAccess.GetTaskIdsForUserAndProject(userId, projectId))
            {
                Task currTask = AllTasks.GetForIdAndProject(currItem, projectId, activeOnly);

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

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