Example #1
0
        public bool CheckDateIsHoliday(DateTime time)
        {
            TWHoliday twHoliday = GetHolidyDataByTime(time);

            if (twHoliday == null)
            {
                return(false);
            }
            else
            {
                return(twHoliday.IsHoliday);
            }
        }
Example #2
0
        public bool AddHolidayFromSource()
        {
            SourceHoliday source = this.sourceGraber.GetSource();

            foreach (var item in source.Result.HolidayRecords)
            {
                DateTime time = Convert.ToDateTime(item.DateStr);

                TWHoliday twHoliday = GetHolidyDataByTime(time);

                if (twHoliday == null)
                {
                    TWHoliday holiday = new TWHoliday();
                    holiday.Description = item.Description;
                    holiday.IsHoliday   = item.IsHoliday.Equals("是") ? true : false;
                    holiday.Category    = item.HolidayCategory;
                    holiday.Year        = time.Year;
                    holiday.Month       = time.Month;
                    holiday.Day         = time.Day;
                    this.dataAccess.Add(holiday);
                }
            }
            return(true);
        }