Contains an entry in the journal
Example #1
0
        /// <summary>
        /// Add an entry to the journal
        /// </summary>
        /// <param name="entry"></param>
        public void AddEntry(JournalEntry entry)
        {
            if (_oldestEntry == null)
            {
                // No existing entries
                _oldestEntry = entry;
                _newestEntry = entry;
            }
            else
            {
                _newestEntry.NextEntry = entry; // Append to existing entries
                _newestEntry = entry;
            }

            _entryCount++;
        }
Example #2
0
        /// <summary>
        /// Iterator for entries before the provided date. After the entry has been returned it will be removed from the
        /// journal. (THIS METHOD IS *NOT* THREAD-SAFE).
        /// </summary>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        public IEnumerable<JournalEntry> GetEntriesBeforeDateAndDelete(DateTime beforeDateTime)
        {
            List<JournalEntry> toReturnList = new List<JournalEntry>();

            while (_oldestEntry != null && _oldestEntry.EntryDateTime < beforeDateTime)
            {
                // Now remove entry from the journal
                toReturnList.Add(_oldestEntry);

                _oldestEntry = _oldestEntry.NextEntry;

                _entryCount--;
            }

            return toReturnList;
        }