Ejemplo n.º 1
0
        /// <summary>
        /// Returns the holidays between two dates
        /// </summary>
        public static List <Date> holidayList(Calendar calendar, Date from, Date to, bool includeWeekEnds = false)
        {
            Utils.QL_REQUIRE(to > from, () => "'from' date (" + from + ") must be earlier than 'to' date (" + to + ")");
            List <Date> result = new List <Date>();

            for (Date d = from; d <= to; ++d)
            {
                if (calendar.isHoliday(d) &&
                    (includeWeekEnds || !calendar.isWeekend(d.DayOfWeek)))
                {
                    result.Add(d);
                }
            }
            return(result);
        }
        public static List <Date> holidayList(Calendar calendar, Date from, Date to, bool includeWeekEnds)
        {
            if (to <= from)
            {
                throw new Exception("'from' date (" + from + ") must be earlier than 'to' date (" + to + ")");
            }

            List <Date> result = new List <Date>();

            for (Date d = from; d <= to; ++d)
            {
                if (calendar.isHoliday(d) &&
                    (includeWeekEnds || !calendar.isWeekend(d.DayOfWeek)))
                {
                    result.Add(d);
                }
            }
            return(result);
        }
        public static List<Date> holidayList(Calendar calendar, Date from, Date to, bool includeWeekEnds) {
            if (to <= from)
            {
                throw new Exception("'from' date (" + from + ") must be earlier than 'to' date (" + to + ")");
            }

            List<Date> result = new List<Date>();

            for (Date d = from; d <= to; ++d)
            {
                if (calendar.isHoliday(d)
                    && (includeWeekEnds || !calendar.isWeekend(d.DayOfWeek)))
                    result.Add(d);
            }
            return result;
        }