Ejemplo n.º 1
0
        private void DoUpdateFromHistory(Task task, HPMDataHistory history)
        {
            // Ensure that we get the custom column of the right project
            HPMProjectCustomColumnsColumn actualCustomColumn = task.ProjectView.GetCustomColumn(trackingColumn.m_Name);
            DateTimeValue storedValue = (DateTimeValue)task.GetCustomColumnValue(actualCustomColumn);
            // ToInt64 will return the value as microseconds since 1970 Jan 1
            ulong storedHpmTime = storedValue.ToHpmDateTime();

            if (history.m_Latests.m_Time > storedHpmTime)
            {
                foreach (HPMDataHistoryEntry entry in history.m_HistoryEntries)
                {
                    // Check if it is the status field
                    if (entry.m_FieldID == 15)
                    {
                        if (entry.m_Time > storedHpmTime)
                        {
                            storedHpmTime = entry.m_Time;
                            task.SetCustomColumnValue(trackingColumn, DateTimeValue.FromHpmDateTime(task, actualCustomColumn, storedHpmTime));
                        }
                    }
                }
            }
        }