private void LoadHistory(IEAElement element) { History.Clear(); IEnumerable <IHistoryEntry> entries = element.GetTaggedValuesByName(EATaggedValueKeys.DecisionStateChange) .Select(tv => (IHistoryEntry) new HistoryEntry(this, tv)); foreach (IHistoryEntry entry in entries) { History.Add(entry); } }
private void SaveHistory(IEAElement element) { //first old history needs to be removed but if I do this, then I will delete existing. //I did not keep track of those that were deleted from the list. //first need to check which one were deleted, i.e. exist in EAelem but not in this list IEnumerable <string> removedHistroyEntries = element.GetTaggedValuesByName(EATaggedValueKeys.DecisionStateChange) .Select(tv => tv.GUID) .Except(History.Select(h => h.TaggedValueGUID)); foreach (string tagGUID in removedHistroyEntries) { element.RemoveTaggedValueByGUID(tagGUID); } foreach (IHistoryEntry historyEntry in History) { historyEntry.SaveChanges(); } }