public void Filter(TrackerDateTimeValue Property, DateTime Value) { List <HAP.Data.Tracker.trackerlogentry> removeentries = new List <HAP.Data.Tracker.trackerlogentry>(); foreach (HAP.Data.Tracker.trackerlogentry entry in this) { switch (Property) { case TrackerDateTimeValue.LogOn: if (entry.LogOnDateTime.Date != Value.Date) { removeentries.Add(entry); } break; case TrackerDateTimeValue.LogOff: if (!entry.LogOffDateTime.HasValue) { removeentries.Add(entry); } else if (entry.LogOffDateTime.Value.Date != Value.Date) { removeentries.Add(entry); } break; } } foreach (HAP.Data.Tracker.trackerlogentry entry in removeentries) { this.Remove(entry); } }
public void Filter(TrackerDateTimeValue Property, string Value) { if (string.IsNullOrEmpty(Value) && Property == TrackerDateTimeValue.LogOff) { List <HAP.Data.Tracker.trackerlogentry> removeentries = new List <HAP.Data.Tracker.trackerlogentry>(); foreach (HAP.Data.Tracker.trackerlogentry entry in this) { if (entry.LogOffDateTime.HasValue) { removeentries.Add(entry); } } foreach (HAP.Data.Tracker.trackerlogentry entry in removeentries) { this.Remove(entry); } } else { Filter(Property, DateTime.Parse(Value)); } }