public override void Initialize()
        {
            targetProject = HPMUtilities.FindProject(targetProjectName);
            if (targetProject == null)
                throw new ArgumentException("Could not find project:" + targetProjectName);
            if (targetViewType == EHPMReportViewType.AgileBacklog)
                targetProjectView = targetProject.ProductBacklog;
            else if (targetViewType == EHPMReportViewType.AllBugsInProject)
                targetProjectView = targetProject.BugTracker;
            else
                targetProjectView = targetProject.Schedule;

            sourceProject = HPMUtilities.FindProject(sourceProjectName);
            if (sourceProject == null)
                throw new ArgumentException("Could not find project:" + sourceProjectName);
            if (sourceViewType == EHPMReportViewType.AgileBacklog)
                sourceProjectView = sourceProject.ProductBacklog;
            else if (targetViewType == EHPMReportViewType.AllBugsInProject)
                sourceProjectView = sourceProject.BugTracker;
            else
                sourceProjectView = sourceProject.Schedule;

            for (int i = 0; i < columnMappings.Count; i += 1 )
            {
                ColumnMapping colDef = columnMappings[i];
                if (colDef.SourceColumn.IsCustomColumn)
                    colDef.SourceColumn.CustomColumn = ResolveCustomColumn(sourceProjectView, colDef.SourceColumn);
                if (colDef.TargetColumn.IsCustomColumn)
                    colDef.TargetColumn.CustomColumn = ResolveCustomColumn(targetProjectView, colDef.TargetColumn);
            }
            DoUpdate();
        }
예제 #2
0
        /// <summary>
        /// Sets the value of a custom column for this task. If the column doesn't exist in the tasks context it will do nothing
        /// </summary>
        /// <param name="customColumnName">The name of the custom column to set the value for</param>
        /// <param name="value">The value to be set, can either be an instance of CustomColumnValue or any other type that can reasonably be converted
        /// to the end user consumable string representation of the value, i.e., as it is displayed in the Hansoft client.</param>
        public void SetCustomColumnValue(string customColumnName, object value)
        {
            // Ensure that we get the custom column of the right project
            HPMProjectCustomColumnsColumn actualCustomColumn = ProjectView.GetCustomColumn(customColumnName);

            if (actualCustomColumn != null)
            {
                SetCustomColumnValue(actualCustomColumn, value);
            }
        }
        public override void Initialize()
        {
            project = HPMUtilities.FindProject(projectName);
            if (project == null)
                throw new ArgumentException("Could not find project:" + projectName);
            if (viewType == EHPMReportViewType.AgileBacklog)
                projectView = project.ProductBacklog;
            else if (viewType == EHPMReportViewType.AllBugsInProject)
                projectView = project.BugTracker;

            foreach (ColumnDefault columnDefault in columnDefaults)
                columnDefault.Initialize(projectView);
        }
예제 #4
0
        /// <summary>
        /// Get the aggregated value of a custom column over all children for this task as it is displayed in the Hansoft client.
        /// </summary>
        /// <param name="columnName">The name of the column to get the value for</param>
        /// <returns>The requested value wrapped by a subclass of CustomColumnValue</returns>
        public CustomColumnValue GetAggregatedCustomColumnValue(string columnName)
        {
            HPMProjectCustomColumnsColumn customColumn = ProjectView.GetCustomColumn(columnName);

            if (customColumn != null)
            {
                return(GetAggregatedCustomColumnValue(customColumn));
            }
            else
            {
                return(CustomColumnValue.FromInternalValue(this, null, ""));
            }
        }
 // TODO: Move to the ColumnDefinition class (to be...) in the Behavior namespace
 private HPMProjectCustomColumnsColumn ResolveCustomColumn(ProjectView projectView, ColumnDefinition colDef)
 {
     HPMProjectCustomColumnsColumn customColumn = projectView.GetCustomColumn(colDef.CustomColumnName);
     if (customColumn == null)
         throw new ArgumentException("Could not find custom column:" + colDef.CustomColumnName);
     else
         return customColumn;
 }
        public override void Initialize()
        {
            project = HPMUtilities.FindProject(projectName);
            if (project == null)
                throw new ArgumentException("Could not find project:" + projectName);
            if (viewType == EHPMReportViewType.AgileBacklog)
                projectView = project.ProductBacklog;
            else
                projectView = project.Schedule;

            rankColumn = projectView.GetCustomColumn(columnName);
            if (rankColumn == null)
                throw new ArgumentException("Could not find custom column:" + columnName);
            DoRenumber(projectView, 1, "");
        }
예제 #7
0
        private void CloneChildTasks(HansoftItem sourceParent, HansoftItem targetParent, ProjectView targetProject, HPMProjectCustomColumns customColumns)
        {
            Task newTask = null;
            foreach (Task task in sourceParent.Children)
            {
                HPMTaskCreateUnifiedReference prevRefID = new HPMTaskCreateUnifiedReference();
                if (newTask == null)
                    prevRefID.m_RefID = -1;
                else
                    prevRefID.m_RefID = newTask.UniqueTaskID;
                prevRefID.m_bLocalID = false;

                HPMTaskCreateUnifiedReference prevWorkPrioRefID = new HPMTaskCreateUnifiedReference();
                prevWorkPrioRefID.m_RefID = -2;
                prevWorkPrioRefID.m_bLocalID = false;

                HPMTaskCreateUnifiedReference[] parentRefIds = new HPMTaskCreateUnifiedReference[1];
                parentRefIds[0] = new HPMTaskCreateUnifiedReference();
                parentRefIds[0].m_RefID = targetParent.Id; // This should be a taskref, which it should be
                parentRefIds[0].m_bLocalID = false;

                HPMTaskCreateUnified createTaskData = new HPMTaskCreateUnified();
                createTaskData.m_Tasks = new HPMTaskCreateUnifiedEntry[1];
                createTaskData.m_Tasks[0] = new HPMTaskCreateUnifiedEntry();
                createTaskData.m_Tasks[0].m_bIsProxy = false;
                createTaskData.m_Tasks[0].m_LocalID = -1;
                createTaskData.m_Tasks[0].m_ParentRefIDs = parentRefIds;
                createTaskData.m_Tasks[0].m_PreviousRefID = prevRefID;
                createTaskData.m_Tasks[0].m_PreviousWorkPrioRefID = prevWorkPrioRefID;
                createTaskData.m_Tasks[0].m_NonProxy_ReuseID = 0;
                createTaskData.m_Tasks[0].m_TaskLockedType = Session.TaskGetLockedType(task.UniqueTaskID);
                createTaskData.m_Tasks[0].m_TaskType = Session.TaskGetType(task.UniqueTaskID);

                HPMChangeCallbackData_TaskCreateUnified createdData = Session.TaskCreateUnifiedBlock(targetProject.UniqueID, createTaskData);
                if (createdData.m_Tasks.Length == 1)
                {
                    newTask = Task.GetTask(createdData.m_Tasks[0].m_TaskRefID);
                    newTask.Category = task.Category;
                    newTask.Confidence = task.Confidence;
                    newTask.DetailedDescription = task.DetailedDescription;
                    newTask.EstimatedDays = task.EstimatedDays;
                    newTask.Hyperlink = task.Hyperlink;
                    newTask.Name = task.Name;
                    newTask.Points = task.Points;
                    newTask.Priority = task.Priority;
                    newTask.Risk = task.Risk;
                    newTask.Severity = task.Severity;
                    newTask.Status = task.Status;
                    newTask.WorkRemaining = task.WorkRemaining;
                    Session.TaskSetFullyCreated(newTask.UniqueTaskID);
                    foreach (HPMProjectCustomColumnsColumn column in customColumns.m_ShowingColumns)
                        newTask.SetCustomColumnValue(column.m_Name, task.GetCustomColumnValue(column.m_Name));
                    CloneChildTasks(task, newTask, targetProject, customColumns);
                }
            }
        }
 internal void Initialize(ProjectView projectView)
 {
     if (isCustomColumn)
     {
         customColumn = projectView.GetCustomColumn(customColumnName);
         if (customColumn == null)
             throw new ArgumentException("Could not find custom column:" + customColumnName);
     }
 }
예제 #9
0
        private void CloneChildTasks(HansoftItem sourceParent, HansoftItem targetParent, ProjectView targetProject, HPMProjectCustomColumns customColumns)
        {
            Task newTask = null;

            foreach (Task task in sourceParent.Children)
            {
                HPMTaskCreateUnifiedReference prevRefID = new HPMTaskCreateUnifiedReference();
                if (newTask == null)
                {
                    prevRefID.m_RefID = -1;
                }
                else
                {
                    prevRefID.m_RefID = newTask.UniqueTaskID;
                }
                prevRefID.m_bLocalID = false;

                HPMTaskCreateUnifiedReference prevWorkPrioRefID = new HPMTaskCreateUnifiedReference();
                prevWorkPrioRefID.m_RefID    = -2;
                prevWorkPrioRefID.m_bLocalID = false;

                HPMTaskCreateUnifiedReference[] parentRefIds = new HPMTaskCreateUnifiedReference[1];
                parentRefIds[0]            = new HPMTaskCreateUnifiedReference();
                parentRefIds[0].m_RefID    = targetParent.Id; // This should be a taskref, which it should be
                parentRefIds[0].m_bLocalID = false;

                HPMTaskCreateUnified createTaskData = new HPMTaskCreateUnified();
                createTaskData.m_Tasks                            = new HPMTaskCreateUnifiedEntry[1];
                createTaskData.m_Tasks[0]                         = new HPMTaskCreateUnifiedEntry();
                createTaskData.m_Tasks[0].m_bIsProxy              = false;
                createTaskData.m_Tasks[0].m_LocalID               = -1;
                createTaskData.m_Tasks[0].m_ParentRefIDs          = parentRefIds;
                createTaskData.m_Tasks[0].m_PreviousRefID         = prevRefID;
                createTaskData.m_Tasks[0].m_PreviousWorkPrioRefID = prevWorkPrioRefID;
                createTaskData.m_Tasks[0].m_NonProxy_ReuseID      = 0;
                createTaskData.m_Tasks[0].m_TaskLockedType        = Session.TaskGetLockedType(task.UniqueTaskID);
                createTaskData.m_Tasks[0].m_TaskType              = Session.TaskGetType(task.UniqueTaskID);


                HPMChangeCallbackData_TaskCreateUnified createdData = Session.TaskCreateUnifiedBlock(targetProject.UniqueID, createTaskData);
                if (createdData.m_Tasks.Length == 1)
                {
                    newTask                     = Task.GetTask(createdData.m_Tasks[0].m_TaskRefID);
                    newTask.Category            = task.Category;
                    newTask.Confidence          = task.Confidence;
                    newTask.DetailedDescription = task.DetailedDescription;
                    newTask.EstimatedDays       = task.EstimatedDays;
                    newTask.Hyperlink           = task.Hyperlink;
                    newTask.Name                = task.Name;
                    newTask.Points              = task.Points;
                    newTask.Priority            = task.Priority;
                    newTask.Risk                = task.Risk;
                    newTask.Severity            = task.Severity;
                    newTask.Status              = task.Status;
                    newTask.WorkRemaining       = task.WorkRemaining;
                    Session.TaskSetFullyCreated(newTask.UniqueTaskID);
                    foreach (HPMProjectCustomColumnsColumn column in customColumns.m_ShowingColumns)
                    {
                        newTask.SetCustomColumnValue(column.m_Name, task.GetCustomColumnValue(column.m_Name));
                    }
                    CloneChildTasks(task, newTask, targetProject, customColumns);
                }
            }
        }
 internal void Initialize(ProjectView projectView, List<string> extensionAssemblies)
 {
     GenerateAssembly(extensionAssemblies);
 }