Esempio n. 1
0
        private static Task CreateTask(HPMUniqueID uniqueID)
        {
            HPMUniqueID        uniqueTaskID = SdkSession.TaskRefGetTask(uniqueID);
            EHPMTaskLockedType lockedType   = SdkSession.TaskGetLockedType(uniqueTaskID);

            switch (lockedType)
            {
            case EHPMTaskLockedType.BacklogItem:
                if (SdkSession.UtilIsIDBacklogProject(SdkSession.TaskGetContainer(uniqueTaskID)))
                {
                    if (SdkSession.TaskGetMainReference(uniqueTaskID).m_ID == uniqueID.m_ID)
                    {
                        return(ProductBacklogItem.GetProductBacklogItem(uniqueID, uniqueTaskID));
                    }
                    else
                    {
                        return(ProductBacklogItemInSprint.GetProductBacklogItemInSprint(uniqueID, uniqueTaskID));
                    }
                }
                else
                {
                    return(SprintBacklogItem.GetSprintBacklogItem(uniqueID, uniqueTaskID));
                }

            case EHPMTaskLockedType.QABug:
                return(Bug.GetBug(uniqueID, uniqueTaskID));

            case EHPMTaskLockedType.SprintItem:
                return(Sprint.GetSprint(uniqueID, uniqueTaskID));

            case EHPMTaskLockedType.Normal:
            default:
                if (SdkSession.TaskGetForceSubProject(uniqueTaskID))
                {
                    return(SubProject.GetSubProject(uniqueID, uniqueTaskID));
                }
                else
                {
                    EHPMTaskType taskType = SdkSession.TaskGetType(uniqueTaskID);
                    switch (taskType)
                    {
                    case EHPMTaskType.Milestone:
                        return(Release.GetRelease(uniqueID, uniqueTaskID));

                    case EHPMTaskType.Planned:
                    default:
                        if (SdkSession.UtilIsIDBacklogProject(SdkSession.TaskGetContainer(uniqueTaskID)))
                        {
                            return(ProductBacklogItemInSchedule.GetProductBacklogItemInSchedule(uniqueID, uniqueTaskID));
                        }
                        else
                        {
                            return(ScheduledTask.GetScheduledTask(uniqueID, uniqueTaskID));
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 /// <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));
     }
 }