private void FindAll(IntervalNode <T> node, DateTimeRange range, IntervalTreeMatch match, List <T> result) { if (node == null) { return; } if (match == IntervalTreeMatch.Contained && range.Contains(node.Interval)) { result.Add(node.Data); } else if (match == IntervalTreeMatch.ContainedBy && node.Interval.Contains(range)) { result.Add(node.Data); } else if (match == IntervalTreeMatch.Overlap && range.Overlaps(node.Interval)) { result.Add(node.Data); } else if (match == IntervalTreeMatch.Exact && range.Equals(node.Interval)) { result.Add(node.Data); } if (node.Left != null && range.Start < node.Interval.Start && range.Start < node.Left.Max) { FindAll(node.Left, range, match, result); } if (node.Right != null && range.End >= node.Interval.Start && range.Start <= node.Right.Max) { FindAll(node.Right, range, match, result); } }
public void TestDateCompare() { Assert.That(dateUnspec.CompareTo(dateLocal) == 0); Assert.That(dateUnspec.Equals(dateLocal)); Assert.AreEqual(dateUnspec.GetHashCode(), dateLocal.GetHashCode()); Assert.That(dateLocal.CompareTo(dateUnspec) == 0); Assert.That(dateLocal.Equals(dateUnspec)); Assert.AreEqual(dateLocal.GetHashCode(), dateUnspec.GetHashCode()); DateTimeRange rangeUnspec = new DateTimeRange(dateUnspec, dateUnspec); DateTimeRange rangeLocal = new DateTimeRange(dateLocal, dateLocal); Assert.That(rangeUnspec.CompareTo(rangeLocal) == 0); Assert.That(rangeUnspec.Equals(rangeLocal)); Assert.AreEqual(rangeUnspec.GetHashCode(), rangeLocal.GetHashCode()); }
public void TestDateCompare() { Assert.That(dateUnspec.CompareTo(dateLocal) == 0); Assert.That(dateUnspec.Equals(dateLocal)); Assert.AreEqual(dateUnspec.GetHashCode(), dateLocal.GetHashCode()); Assert.That(dateLocal.CompareTo(dateUnspec) == 0); Assert.That(dateLocal.Equals(dateUnspec)); Assert.AreEqual(dateLocal.GetHashCode(), dateUnspec.GetHashCode()); DateTimeRange rangeUnspec = new DateTimeRange(dateUnspec, dateUnspec); DateTimeRange rangeLocal = new DateTimeRange(dateLocal, dateLocal); Assert.That(rangeUnspec.CompareTo(rangeLocal) == 0); Assert.That(rangeUnspec.Equals(rangeLocal)); Assert.AreEqual(rangeUnspec.GetHashCode(), rangeLocal.GetHashCode()); }
/// <summary> /// Returns a list of Exchange users, provides free busy times and /// appointments if available within the date range. /// </summary> /// <param name="ldapAttribute">Parameter to search upon</param> /// <param name="utcRange">DateRange for search</param> /// <param name="searchTerms">Search terms to search exchange for</param> /// <returns></returns> public ExchangeUserDict Search( string ldapAttribute, DateTimeRange utcRange, params string[] searchTerms) { if(utcRange.Equals(DateTimeRange.Full)) { throw new Exception("Must specify a time range"); } /* Create the network credentials and WebDav resources needed for user */ ExchangeUserDict activeDirectoryResults = QueryActiveDirectoryByAttribute(ldapAttribute, searchTerms); /* Assign user free busy times if any users were returned */ if ( activeDirectoryResults != null && activeDirectoryResults.Count > 0 ) { GetCalendarInfoForUsers( activeDirectoryResults, utcRange ); } return activeDirectoryResults; }