private bool CheckCondition(DateTime dateTime)
        {
            switch (m_dateType)
            {
            case DateType.Day:
                return(true);

            case DateType.TradingDay:
                return(CalendarCache.IsTradingDay(dateTime));

            case DateType.WorkingDay:
                return(CalendarCache.IsWorkingDay(dateTime));
            }

            CommUtils.Assert(false, "[CheckCondition]不支持的Date类型");
            return(false);
        }
Exemple #2
0
        private bool CheckCondition(DateTime dateTime)
        {
            switch (m_unitType)
            {
            case TimeUnit.Day:
                return(true);

            case TimeUnit.TradingDay:
                return(CalendarCache.IsTradingDay(dateTime));

            case TimeUnit.WorkingDay:
                return(CalendarCache.IsWorkingDay(dateTime));

            default:
                return(false);
            }
        }
Exemple #3
0
        public void TestGetAllTradingDay()
        {
            var endDate = DateTime.Now.AddYears(20);
            var date    = DateTime.Now.AddYears(-10);

            string result = string.Empty;

            while (date < endDate)
            {
                //CalendarCache.IsTradingDay
                if (CalendarCache.IsWorkingDay(date))
                {
                    result += date.ToString("yyyy-MM-dd");
                    result += "\r\n";
                }

                date = date.AddDays(1);
            }

            Assert.IsTrue(CalendarCache.IsTradingDay(DateTime.Parse("2016-09-22")));
            Assert.IsTrue(!CalendarCache.IsTradingDay(DateTime.Parse("2016-09-24")));
        }