Ejemplo n.º 1
0
        /// <summary>
        /// Returns true if any day in the given DateTime range is contained in
        /// the current CalendarDateRange.
        /// </summary>
        /// <param name="range">Inherited code: Requires comment 1.</param>
        /// <returns>Inherited code: Requires comment 2.</returns>
        internal bool ContainsAny(CalendarDateRange range)
        {
            Contract.Requires <ArgumentNullException>(range != null);

            int start = DateTime.Compare(Start, range.Start);

            // Check if any part of the supplied range is contained by this
            // range or if the supplied range completely covers this range.
            return((start <= 0 && DateTime.Compare(End, range.Start) >= 0) ||
                   (start >= 0 && DateTime.Compare(Start, range.End) <= 0));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns true if any day in the given DateTime range is contained in
        /// the current CalendarDateRange.
        /// </summary>
        /// <param name="range">Inherited code: Requires comment 1.</param>
        /// <returns>Inherited code: Requires comment 2.</returns>
        internal bool ContainsAny(CalendarDateRange range)
        {
            _ = range ?? throw new ArgumentNullException(nameof(range));

            int start = DateTime.Compare(Start, range.Start);

            // Check if any part of the supplied range is contained by this
            // range or if the supplied range completely covers this range.
            return((start <= 0 && DateTime.Compare(End, range.Start) >= 0) ||
                   (start >= 0 && DateTime.Compare(Start, range.End) <= 0));
        }
Ejemplo n.º 3
0
        public static bool InRange(DateTime date, CalendarDateRange range)
        {
            Debug.Assert(DateTime.Compare(range.Start, range.End) < 1, "The range should start before it ends!");

            if (CompareDays(date, range.Start) > -1 && CompareDays(date, range.End) < 1)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns true if any day in the given DateTime range is contained in
        /// the current CalendarDateRange.
        /// </summary>
        /// <param name="range">Inherited code: Requires comment 1.</param>
        /// <returns>Inherited code: Requires comment 2.</returns>
        internal bool ContainsAny(CalendarDateRange range)
        {
            Debug.Assert(range != null, "range should not be null!");

            int start = DateTime.Compare(Start, range.Start);

            // Check if any part of the supplied range is contained by this
            // range or if the supplied range completely covers this range.
            return((start <= 0 && DateTime.Compare(End, range.Start) >= 0) ||
                   (start >= 0 && DateTime.Compare(Start, range.End) <= 0));
        }