private RawBurndownHistory GetRawHistory(HistoryKind historyKind) { HPMDataHistoryGetHistoryParameters getHistoryParameters = new HPMDataHistoryGetHistoryParameters(); if (historyKind == HistoryKind.Points) { getHistoryParameters.m_FieldID = EHPMStatisticsField.ComplexityPoints; } else if (historyKind == HistoryKind.EstimatedDays) { getHistoryParameters.m_FieldID = EHPMStatisticsField.EstimatedIdealDays; } getHistoryParameters.m_DataIdent0 = EHPMStatisticsScope.Milestone; getHistoryParameters.m_DataIdent1 = (uint)UniqueID.m_ID; int nTries = 0; HPMDataHistory history = null; while (nTries < 25) { // TODO: Consider to move the reponsibility to the client to register a callback instead. It really isn't kosher to do polling here. history = Session.DataHistoryGetHistory(getHistoryParameters); if (history == null) { ++nTries; System.Threading.Thread.Sleep(100); } else { break; } } if (history != null && (cache.rawHistoryCached[(int)historyKind] == null || history.m_Latests.m_Time > cache.rawHistoryCached[(int)historyKind].LastTimeEntry)) { cache.rawHistoryCached[(int)historyKind] = new RawBurndownHistory(history.m_HistoryEntries.Length, history.m_Latests.m_Time); for (uint j = 0; j < history.m_HistoryEntries.Length; j += 1) { HPMDataHistoryEntry historyEntry = history.m_HistoryEntries[j]; ulong time = historyEntry.m_Time; DateTime date = HPMUtilities.FromHPMDateTime(time); if (historyEntry.m_bHasDataRecorded && historyEntry.m_EntryType == EHPMDataHistoryEntryType.Statistics_AbsoluteValue) { HPMVariantData data = Session.DataHistoryGetEntryData(history, j); HPMStatisticsMultiFrequency value = Session.VariantDecode_HPMStatisticsMultiFrequency(data); cache.rawHistoryCached[(int)historyKind].InsertAt(j, date, value.m_FrequencyEntries[1].m_FrequencyFP); } } cache.normalizedHistoryCached[(int)historyKind] = null; } return(cache.rawHistoryCached[(int)historyKind]); }
/// <summary> /// Checks if a certain date in the project is a working day according to the project calendar. /// </summary> /// <param name="date">The date to check.</param> /// <returns>true if date is a working day in the project otherwise false.</returns> public bool IsWorkingDay(DateTime date) { HPMCalendarDayInfo info = Session.ProjectGetCalendarDayInfo(UniqueID, -1, HPMUtilities.HPMDateTime(date.Date)); return(info.m_bWorkingDay); }