Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Schedule"/> class.
        /// </summary>
        /// <param name="step">The walk.</param>
        /// <param name="startDate">The start date.</param>
        /// <param name="endDate">The end date.</param>
        public Schedule(ScheduleStep step, DateTime startDate, DateTime endDate)
        {
            _currentStart = startDate;
            _endDate      = endDate;
            // ScheduleStep is converted to ScheduleWalkTo
            // Done just to maintain clarity when setting up constructor
            // otherwise caller will have confusion when using this constructor regarding end dates
            // which are ignored
            switch (step)
            {
            case ScheduleStep.Years:
                _walk = ScheduleWalkThrough.Years;
                break;

            case ScheduleStep.Months:
                _walk = ScheduleWalkThrough.MonthsInYear;
                break;

            case ScheduleStep.Weeks:
                _walk = ScheduleWalkThrough.WeeksInYear;
                break;

            case ScheduleStep.Days:
                _walk = ScheduleWalkThrough.DaysInYear;
                break;

            case ScheduleStep.Hours:
                _walk = ScheduleWalkThrough.HoursInDay;
                break;

            case ScheduleStep.Minutes:
                _walk = ScheduleWalkThrough.MinutesInHour;
                break;

            case ScheduleStep.Seconds:
                _walk = ScheduleWalkThrough.SecondsInMinute;
                break;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Schedule"/> class.
 /// Start and EndDate are irrelevent when chaining.
 /// </summary>
 /// <param name="walk">The walk.</param>
 public Schedule(ScheduleWalkThrough walk)
 {
     _walk         = walk;
     _currentStart = _endDate = DateTime.MinValue;
 }