internal static SingleSelectionValue FromName(Task task, HPMProjectCustomColumnsColumn customColumn, string name)
        {
            int selection = HPMUtilities.EncodeDroplistValue(name, customColumn.m_DropListItems);

            string internalValue = selection.ToString();

            return(new SingleSelectionValue(task, customColumn, internalValue, selection));
        }
 /// <summary>
 /// The date value as a string.
 /// </summary>
 /// <returns>The string</returns>
 public override string ToString()
 {
     if (InternalValue != string.Empty)
     {
         return(HPMUtilities.HPMDateTimeToDateString(hpmDateTime));
     }
     else
     {
         return(string.Empty);
     }
 }
Exemple #3
0
        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();
        }
        public static MultipleSelectionValue FromStringList(Task task, HPMProjectCustomColumnsColumn customColumn, IList names)
        {
            int[]         selections = new int[names.Count];
            StringBuilder sb         = new StringBuilder();

            for (int i = 0; i < names.Count; i += 1)
            {
                selections[i] = HPMUtilities.EncodeDroplistValue((string)names[i], customColumn.m_DropListItems);
                if (sb.Length > 0)
                {
                    sb.Append(';');
                }
                sb.Append(selections[i].ToString());
            }
            string internalValue = sb.ToString();

            return(new MultipleSelectionValue(task, customColumn, internalValue, selections));
        }
        internal static MultipleSelectionValue FromName(Task task, HPMProjectCustomColumnsColumn customColumn, string nameSequence)
        {
            string[]      names      = nameSequence.Split(new char[] { ';' });
            int[]         selections = new int[names.Length];
            StringBuilder sb         = new StringBuilder();

            for (int i = 0; i < names.Length; i += 1)
            {
                selections[i] = HPMUtilities.EncodeDroplistValue(names[i], customColumn.m_DropListItems);
                if (sb.Length > 0)
                {
                    sb.Append(';');
                }
                sb.Append(selections[i].ToString());
            }
            string internalValue = sb.ToString();

            return(new MultipleSelectionValue(task, customColumn, internalValue, selections));
        }
Exemple #6
0
        public override void Initialize()
        {
            projects         = new List <Project>();
            projectViews     = new List <ProjectView>();
            initializationOK = false;
            projects         = HPMUtilities.FindProjects(projectName, inverted);
            if (projects.Count == 0)
            {
                throw new ArgumentException("Could not find any matching project:" + projectName);
            }
            foreach (Project project in projects)
            {
                ProjectView projectView;
                if (viewType == EHPMReportViewType.AgileBacklog)
                {
                    projectView = project.ProductBacklog;
                }
                else if (viewType == EHPMReportViewType.AllBugsInProject)
                {
                    projectView = project.BugTracker;
                }
                else
                {
                    projectView = project.Schedule;
                }
                projectViews.Add(projectView);
            }

            trackedColumn = projectViews[0].GetCustomColumn(trackedColumnName);
            if (trackedColumn == null)
            {
                throw new ArgumentException("Could not find custom column in view " + viewName + " " + trackedColumnName);
            }
            trackingColumn = projectViews[0].GetCustomColumn(trackingColumnName);
            if (trackingColumn == null)
            {
                throw new ArgumentException("Could not find custom column in view " + viewName + " " + trackingColumnName);
            }
            initializationOK = true;
            DoUpdateFromHistory();
        }
        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);
            }
        }
 public static string GetShadowValue(Task current_task, string shadowProjectName, string sourceDataBaseIDColumnName, string columnName)
 {
     try
     {
         List <Task> shadowTasks = new List <Task>(HPMUtilities.GetProjects().Find(project => project.Name == shadowProjectName).ProductBacklog.DeepChildren.Cast <Task>());
         Task        shadowTask  = shadowTasks.Find(shadow => shadow.GetCustomColumnValue(sourceDataBaseIDColumnName).ToInt() == current_task.UniqueID.m_ID);
         if (shadowTask != null)
         {
             return(shadowTask.GetCustomColumnValue(columnName).ToString());
         }
         else
         {
             return("");
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         throw e;
     }
 }
Exemple #9
0
        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, "");
        }
Exemple #10
0
        private void InitializeProjects()
        {
            projects     = new List <Project>();
            projectViews = new List <ProjectView>();
            projects     = HPMUtilities.FindProjects(projectName, inverted);
            foreach (Project project in projects)
            {
                ProjectView projectView;
                if (viewType == EHPMReportViewType.AgileBacklog)
                {
                    projectView = project.ProductBacklog;
                }
                else if (viewType == EHPMReportViewType.AllBugsInProject)
                {
                    projectView = project.BugTracker;
                }
                else
                {
                    projectView = project.Schedule;
                }

                projectViews.Add(projectView);
            }
        }
 /// <summary>
 /// Crate a new instance from a DateTime value for a certain task and custom column.
 /// </summary>
 /// <param name="task">The task the value belongs to.</param>
 /// <param name="customColumn">The custom column the value belongs to.</param>
 /// <param name="dateTime">The DateTime value</param>
 /// <returns>The new instance.</returns>
 public static DateValue FromDateTime(Task task, HPMProjectCustomColumnsColumn customColumn, DateTime dateTime)
 {
     return(FromHpmDateTime(task, customColumn, HPMUtilities.HPMDateTime(dateTime, true)));
 }
 /// <summary>
 /// Returns the value as a DateTime value.
 /// </summary>
 /// <returns>The DateTime value.</returns>
 public DateTime ToDateTime()
 {
     return(HPMUtilities.FromHPMDateTime(hpmDateTime));
 }
 /// <summary>
 /// The value as a string formatted as in the Hansoft client.
 /// </summary>
 /// <returns>The string.</returns>
 public override string ToString()
 {
     return(HPMUtilities.DecodeDroplistValue((int)selection, CustomColumn.m_DropListItems));
 }
 /// <summary>
 /// Parses this IntegerValue and converts it to a DateTime value. The value will be interpreted as
 /// the number of microseconds since Jan 1 1970.
 /// </summary>
 /// <returns>The parsed DateTime or January 1 1970 if the TextValue was not possible to parse.</returns>
 public override DateTime ToDateTime(IFormatProvider provider)
 {
     return(HPMUtilities.FromHPMDateTime((ulong)integerValue));
 }
 /// <summary>
 /// Returns all the resources in the format of a string list.
 /// </summary>
 /// <returns>all the resources in the format of a string list</returns>
 public override IList ToStringList()
 {
     return(HPMUtilities.DecodeDroplistValuesToStringList(selections, CustomColumn.m_DropListItems));
 }
Exemple #16
0
 public override void OnTaskChangeCustomColumnData(TaskChangeCustomColumnDataEventArgs e)
 {
     if (initializationOK)
     {
         if (e.Data.m_ColumnHash == trackedColumn.m_Hash)
         {
             Task task = Task.GetTask(e.Data.m_TaskID);
             if (projects.Contains(task.Project) && projectViews.Contains(task.ProjectView))
             {
                 HPMSDKInternalData hid = GetCustomColumn(task);
                 task.SetCustomColumnValue(trackingColumn, DateTimeValue.FromHpmDateTime(task, trackingColumn, HPMUtilities.HPMNow()));
                 writeHIDStatus(task);
             }
         }
     }
 }