Пример #1
0
        /// <summary>
        ///     Get the next date in the series given the current date in the series
        ///     and the series information
        /// </summary>
        /// <param name="currentDate" type="System.DateTime">
        ///     <para>
        ///         The current date in the recurrence dates. This is the date just before
        ///         the one you're trying to locate.
        ///     </para>
        /// </param>
        /// <param name="seriesInfo" type="string">
        ///     <para>
        ///         The recurrence pattern series information.
        ///     </para>
        /// </param>
        /// <returns>
        ///     The next date in the recurrence pattern as defined by the series
        ///     information string.
        /// </returns>
        public static DateTime GetNextDate(DateTime currentDate, string seriesInfo)
        {
            RecurrenceSettings returnValues = null;

            switch (seriesInfo[0])
            {
            case 'Y':                       // Yearly
                returnValues = YearlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;

            case 'M':                       // Monthly
                returnValues = MonthlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;

            case 'W':                       // Weekly
                returnValues = WeeklyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;

            case 'D':                       // Daily
                returnValues = DailyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;
            }
            // Return just the next date. The function "GetNextDate" is an abstract
            // method overriden in each of the RecurrenceSettings classes.
            return(returnValues.GetNextDate(currentDate));
        }
Пример #2
0
        public static RecurrenceValues GetPostRecurrenceValues(string seriesInfo, int modifiedOccurrencesValue)
        {
            RecurrenceSettings settings = null;
            RecurrenceValues   tempValues;
            DateTime           lastDate;

            switch (seriesInfo[0])
            {
            case 'Y':                       // Yearly
                settings = YearlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;

            case 'M':                       // Monthly
                settings = MonthlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;

            case 'W':                       // Weekly
                settings = WeeklyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;

            case 'D':                       // Daily
                settings = DailyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;
            }

            // get the RecurrenceValues
            tempValues = settings.GetValues();
            // Add one day to the last date so it now becomes the Start date past the last
            // date in the series
            lastDate = tempValues.LastDate.AddDays(1);

            return(settings.GetValues(lastDate, modifiedOccurrencesValue));
        }
Пример #3
0
        /// <summary>
        ///     Get a collection of recurrence values that are AFTER the values as defined by the
        ///     Series Info value. The endDate param. defines how far past the existing end date
        ///     as defined by the Series Info.
        /// </summary>
        /// <param name="seriesInfo" type="string">
        ///     <para>
        ///         The recurrence pattern series information.
        ///     </para>
        /// </param>
        /// <param name="endDate" type="System.DateTime">
        ///     <para>
        ///         DateTime of the end date that is past the end date in the Series Info where
        ///         you want the collection of values to end.
        ///     </para>
        /// </param>
        /// <returns>
        ///     A RecurrenceGenerator.RecurrenceValues value...
        /// </returns>
        public static RecurrenceValues GetPostRecurrenceValues(string seriesInfo, DateTime endDate)
        {
            RecurrenceSettings settings = null;
            RecurrenceValues   tempValues;
            DateTime           lastDate;

            switch (seriesInfo.Substring(0, 1))
            {
            case "Y":       // Yearly
                settings = YearlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;

            case "M":       // Monthly
                settings = MonthlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;

            case "W":       // Weekly
                settings = WeeklyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;

            case "D":       // Daily
                settings = DailyRecurrenceSettings.GetRecurrenceSettings(seriesInfo);
                break;
            }

            // get the RecurrenceValues
            tempValues = settings.GetValues();
            // Add one day to the last date so it now becomes the Start date past the last
            // date in the series
            lastDate = tempValues.LastDate.AddDays(1);

            return(settings.GetValues(lastDate, endDate));
        }
Пример #4
0
        public static RecurrenceValues GetRecurrenceValues(string seriesInfo, DateTime modifiedStartDateValue, DateTime modifiedEndDateValue)
        {
            RecurrenceSettings settings = null;

            switch (seriesInfo[0])
            {
            case 'Y':                       // Yearly
                settings = YearlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo, modifiedStartDateValue, modifiedEndDateValue);
                break;

            case 'M':                       // Monthly
                settings = MonthlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo, modifiedStartDateValue, modifiedEndDateValue);
                break;

            case 'W':                       // Weekly
                settings = WeeklyRecurrenceSettings.GetRecurrenceSettings(seriesInfo, modifiedStartDateValue, modifiedEndDateValue);
                break;

            case 'D':                       // Daily
                settings = DailyRecurrenceSettings.GetRecurrenceSettings(seriesInfo, modifiedStartDateValue, modifiedEndDateValue);
                break;
            }

            // Return the RecurrenceValues
            return(settings.GetValues());
        }
Пример #5
0
        /// <summary>
        ///     Get a modified collection of recurrence values from an existing Series Info value and modified
        ///     End Date value.
        /// </summary>
        /// <param name="seriesInfo" type="string">
        ///     <para>
        ///         The recurrence pattern series information.
        ///     </para>
        /// </param>
        /// <param name="modifiedEndDateValue" type="System.DateTime">
        ///     <para>
        ///         DateTime of the modified end date that you want the recurrence values to continue until.
        ///     </para>
        /// </param>
        /// <returns>
        ///     A RecurrenceGenerator.RecurrenceValues value...
        /// </returns>
        public static RecurrenceValues GetRecurrenceValues(string seriesInfo, DateTime modifiedEndDateValue)
        {
            RecurrenceSettings settings = null;

            switch (seriesInfo.Substring(0, 1))
            {
            case "Y":       // Yearly
                settings = YearlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo, modifiedEndDateValue);
                break;

            case "M":       // Monthly
                settings = MonthlyRecurrenceSettings.GetRecurrenceSettings(seriesInfo, modifiedEndDateValue);
                break;

            case "W":       // Weekly
                settings = WeeklyRecurrenceSettings.GetRecurrenceSettings(seriesInfo, modifiedEndDateValue);
                break;

            case "D":       // Daily
                settings = DailyRecurrenceSettings.GetRecurrenceSettings(seriesInfo, modifiedEndDateValue);
                break;
            }

            // Return the RecurrenceValues
            return(settings.GetValues());
        }