/// <summary> /// Factory method for creating a Task (subclass of). /// </summary> /// <param name="uniqueID">The Task ID or TaskRef ID that a Task shuld be created for. If a Task ID is given then the MainRef of the task will be used to determine which view is applicable.</param> /// <returns>A concrete task acting as a wrapper to access the Hansoft API for the task in question.</returns> public static Task GetTask(HPMUniqueID uniqueID) { HPMUniqueID refID; if (SdkSession.UtilIsIDTask(uniqueID)) { refID = SdkSession.TaskGetMainReference(uniqueID); } else { refID = uniqueID; } return(CreateTask(refID)); }
/// <summary> /// Factory method for creating a Task (subclass of). /// </summary> /// <param name="uniqueID">The Task ID or TaskRef ID that a Task shuld be created for</param> /// <param name="viewType">The view that the task appears in (primarily important for product backlog items which can appear in mutiple views).</param> /// <returns>A concrete task acting as a wrapper to access the Hansoft API for the task in question.</returns> internal static Task GetTask(HPMUniqueID uniqueID, EHPMReportViewType viewType) { if ((viewType == EHPMReportViewType.ScheduleMainProject || viewType == EHPMReportViewType.AgileMainProject) && SdkSession.UtilIsIDTask(uniqueID) && SdkSession.UtilIsIDBacklogProject(SdkSession.TaskGetContainer(uniqueID))) { return(GetTask(SdkSession.TaskGetProxy(uniqueID))); } else { return(GetTask(uniqueID)); } }