/// <summary> /// Returns the user with the incoming name if it exists, otherwise null /// </summary> /// <param name="userName">The name of the user to find</param> /// <returns>the user with the incoming name if it exists, otherwise null</returns> public static User FindUser(string userName) { HPMUniqueID userID = SessionManager.Session.ResourceGetResourceFromName(userName); if (userID.IsValid()) { return(User.GetUser(userID)); } return(null); }
internal static List <User> GetAssignees(Task task) { List <User> assignees = new List <User>(); HPMTaskResourceAllocationResource[] allocations = Session.TaskGetResourceAllocation(task.UniqueTaskID).m_Resources; foreach (HPMTaskResourceAllocationResource ra in allocations) { assignees.Add(User.GetUser(ra.m_ResourceID)); } return(assignees); }
/// <summary> /// The users in the database that the SessionManager is connected to. /// </summary> /// <returns>The list of users.</returns> public static List <User> GetUsers() { List <User> users = new List <User>(); HPMResourceEnum userEnum = SessionManager.Session.ResourceEnum(); foreach (HPMUniqueID userId in userEnum.m_Resources) { users.Add(User.GetUser(userId)); } return(users); }
internal static string AssignedAsString(Task task) { StringBuilder sb = new StringBuilder(); HPMTaskResourceAllocationResource[] allocations = SessionManager.Session.TaskGetResourceAllocation(task.UniqueTaskID).m_Resources; for (int i = 0; i < allocations.Length; i += 1) { HPMUniqueID resourceId = allocations[i].m_ResourceID; int percentage = allocations[i].m_PercentAllocated; sb.Append(User.GetUser(resourceId).Name); if (percentage != 100) { sb.Append('['); sb.Append(percentage.ToString()); sb.Append("]"); } if (i < allocations.Length - 1) { sb.Append(", "); } } return(sb.ToString()); }