/// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>A new object that is a copy of this instance.</returns>
        public override object Clone()
        {
            MonthlyCalendar clone = (MonthlyCalendar)base.Clone();

            bool[] excludeCopy = new bool[excludeDays.Length];
            Array.Copy(excludeDays, excludeCopy, excludeDays.Length);
            clone.excludeDays = excludeCopy;
            return(clone);
        }
예제 #2
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>A new object that is a copy of this instance.</returns>
        public override ICalendar Clone()
        {
            MonthlyCalendar clone = new MonthlyCalendar();

            CloneFields(clone);
            bool[] excludeCopy = new bool[excludeDays.Length];
            Array.Copy(excludeDays, excludeCopy, excludeDays.Length);
            clone.excludeDays = excludeCopy;
            return(clone);
        }
예제 #3
0
        public void TestForInfiniteLoop()
        {
            MonthlyCalendar monthlyCalendar = new MonthlyCalendar();

            for (int i = 1; i < 9; i++)
            {
                monthlyCalendar.SetDayExcluded(i, true);
            }

            DateTime d = new DateTime(2007, 11, 8, 12, 0, 0);

            monthlyCalendar.GetNextIncludedTimeUtc(d.ToUniversalTime());
        }
예제 #4
0
        public void TestTimeZone()
        {
            TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
            MonthlyCalendar monthlyCalendar = new MonthlyCalendar();
            monthlyCalendar.TimeZone = tz;

            monthlyCalendar.SetDayExcluded(4, true);

            // 11/5/2012 12:00:00 AM -04:00  translate into 11/4/2012 11:00:00 PM -05:00 (EST)
            DateTimeOffset date = new DateTimeOffset(2012, 11, 5, 0, 0, 0, TimeSpan.FromHours(-4));

            Assert.IsFalse(monthlyCalendar.IsTimeIncluded(date));
        }
예제 #5
0
        public bool Equals(MonthlyCalendar obj)
        {
            //a little trick here : Monthly calendar knows nothing
            //about the precise month it is dealing with, so
            //FebruaryCalendars will be only equal if their
            //31st days are equally included
            //but that's not going to be a problem since
            //there's no need to redefine default value of false
            //for such days
            if (obj == null)
            {
                return(false);
            }
            bool baseEqual = GetBaseCalendar() == null || GetBaseCalendar().Equals(obj.GetBaseCalendar());

            return(baseEqual && DaysExcluded.SequenceEqual(obj.DaysExcluded));
        }
예제 #6
0
        public bool Equals(MonthlyCalendar obj)
        {
            //a little trick here : Monthly calendar knows nothing
            //about the precise month it is dealing with, so
            //FebruaryCalendars will be only equal if their
            // 31st days are equally included ))
            //but that's not going to be a problem since
            //there's no need to redefine default value of false
            //for such days
            if (obj == null)
            {
                return(false);
            }
            var baseEqual = GetBaseCalendar() != null?
                            GetBaseCalendar().Equals(obj.GetBaseCalendar()) : true;

            return(baseEqual && (ArraysEqualElementsOnEqualPlaces(DaysExcluded, obj.DaysExcluded)
                                 ));
        }
예제 #7
0
 public void Setup()
 {
     cal = new MonthlyCalendar();
 }
예제 #8
0
 static void InitializeMonthly(MonthlyCalendar monthlyCalendar, IMonthlyCalendar calendar) {
     monthlyCalendar.TimeZone = TimeZoneInfo.FindSystemTimeZoneById(Persistent.Base.General.RegistryTimeZoneProvider.GetRegistryKeyNameByTimeZoneId(calendar.TimeZone));
     calendar.DaysExcluded.ForEach(i => monthlyCalendar.SetDayExcluded(i, true));
     calendar.DaysIncluded.ForEach(i => monthlyCalendar.SetDayExcluded(i, false));
 }
예제 #9
0
        public bool Equals(MonthlyCalendar obj)
        {
            //a little trick here : Monthly calendar knows nothing
            //about the precise month it is dealing with, so
            //FebruaryCalendars will be only equal if their
            // 31st days are equally included ))
            //but that's not going to be a problem since
            //there's no need to redefine default value of false
            //for such days
            if (obj == null)
            {
                return false;
            }
            bool baseEqual = GetBaseCalendar() == null || GetBaseCalendar().Equals(obj.GetBaseCalendar());

            return baseEqual && (ArraysEqualElementsOnEqualPlaces(DaysExcluded, obj.DaysExcluded)
                                );
        }
        public void TestRemoveCalendarWhenTriggersPresent()
        {
            // QRTZNET-29

            IOperableTrigger trigger = new SimpleTriggerImpl("trigger1", "triggerGroup1", fJobDetail.Name, fJobDetail.Group, DateTimeOffset.Now.AddSeconds(100), DateTimeOffset.Now.AddSeconds(200), 2, TimeSpan.FromSeconds(2));
            trigger.ComputeFirstFireTimeUtc(null);
            ICalendar cal = new MonthlyCalendar();
            fJobStore.StoreTrigger(trigger, false);
            fJobStore.StoreCalendar("cal", cal, false, true);

            fJobStore.RemoveCalendar("cal");
        }
예제 #11
0
 public MonthlyCalendarDto(MonthlyCalendar calendar) : base(calendar)
 {
     DaysExcluded = calendar.DaysExcluded.ToList();
     TimeZone = new TimeZoneDto(calendar.TimeZone);
 }