Ejemplo n.º 1
0
        /// <summary>
        ///     Get a static text definition of the Series Info
        /// </summary>
        /// <param name="seriesInfo" type="string">
        ///     <para>
        ///         Series Info string that was generated when a series of recurring dates were created.
        ///     </para>
        /// </param>
        /// <returns>
        ///     A string value of the Series Info definition
        /// </returns>
        public static string GetPatternDefinition(string seriesInfo)
        {
            string value = string.Empty;

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

            case 'M':                       // Monthly
                value = MonthlyRecurrenceSettings.GetPatternDefinition(seriesInfo);
                break;

            case 'W':                       // Weekly
                value = WeeklyRecurrenceSettings.GetPatternDefinition(seriesInfo);
                break;

            case 'D':                       // Daily
                value = DailyRecurrenceSettings.GetPatternDefinition(seriesInfo);
                break;
            }

            return(value);
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
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());
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Get a static text definition of the Series Info
        /// </summary>
        /// <param name="seriesInfo" type="string">
        ///     <para>
        ///         Series Info string that was generated when a series of recurring dates were created.
        ///     </para>
        /// </param>
        /// <returns>
        ///     A string value of the Series Info definition
        /// </returns>
        public static string GetPatternDefinitioin(string seriesInfo)
        {
            string value = string.Empty;

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

            case "M":       // Monthly
                value = MonthlyRecurrenceSettings.GetPatternDefinition(seriesInfo);
                break;

            case "W":       // Weekly
                value = WeeklyRecurrenceSettings.GetPatternDefinition(seriesInfo);
                break;

            case "D":       // Daily
                value = DailyRecurrenceSettings.GetPatternDefinition(seriesInfo);
                break;
            }

            return(value);
        }
Ejemplo n.º 6
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));
        }
Ejemplo n.º 7
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());
        }
        static DailyRecurrenceSettings GetRecurrenceSettings(string seriesInfo, int modifiedOccurrencesValue, DateTime modifiedStartDate, DateTime modifiedEndDate)
        {
            DailyRecurrenceSettings settings = null;
            RecurrenceInfo          info     = DailyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);

            // Check to see if this is to modify the SeriesInfo and run as endtype for occurrences
            if (modifiedOccurrencesValue != -1)
            {
                info.SetEndDateType(EndDateType.NumberOfOccurrences);
                info.SetNumberOfOccurrences(modifiedOccurrencesValue);
            }
            // Check to see if this is to modify the EndDate and run as endType for EndDate
            if (modifiedEndDate != DateTime.MinValue)
            {
                info.SetEndDateType(EndDateType.SpecificDate);
                info.SetEndDate(modifiedEndDate);
            }

            // Determine the Constructor by the type of End Date.
            // All constructors start with a Start date at a minimum.
            switch (info.EndDateType)
            {
            case EndDateType.NumberOfOccurrences:
                settings = new DailyRecurrenceSettings(modifiedStartDate, info.NumberOfOccurrences);
                break;

            case EndDateType.SpecificDate:
                settings = new DailyRecurrenceSettings(modifiedStartDate, info.EndDate.Value);
                break;

            case EndDateType.NoEndDate:
                settings = new DailyRecurrenceSettings(modifiedStartDate);
                break;
            }

            // Determine the Type of dates to get, specific, custom, etc.
            switch (info.DailyRegenType)
            {
            case DailyRegenType.OnEveryXDays:
                settings.SetValues(info.DailyRegenEveryXDays);
                break;

            case DailyRegenType.OnEveryWeekday:
                // This is default. Nothing to set
                break;

            case DailyRegenType.NotSet:

                break;
            }

            return(settings);
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     Get the Series Info in a user-friendly object that can be used as a means to
        ///     populate UI controls.
        /// </summary>
        /// <param name="seriesInfo" type="string">
        ///     <para>
        ///         String of the Series Info.
        ///     </para>
        /// </param>
        /// <returns>
        ///     A RecurrenceGenerator.RecurrenceInfo value...
        /// </returns>
        public static RecurrenceInfo GetFriendlySeriesInfo(string seriesInfo)
        {
            RecurrenceInfo returnValue = null;

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

            case 'M':                       // Monthly
                returnValue = MonthlyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);
                break;

            case 'W':                       // Weekly
                returnValue = WeeklyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);
                break;

            case 'D':                       // Daily
                returnValue = DailyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);
                break;
            }
            return(returnValue);
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Get the Series Info in a user-friendly object that can be used as a means to
        ///     populate UI controls.
        /// </summary>
        /// <param name="seriesInfo" type="string">
        ///     <para>
        ///         String of the Series Info.
        ///     </para>
        /// </param>
        /// <returns>
        ///     A RecurrenceGenerator.RecurrenceInfo value...
        /// </returns>
        public static RecurrenceInfo GetFriendlySeriesInfo(string seriesInfo)
        {
            RecurrenceInfo returnValue = null;

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

            case "M":       // Monthly
                returnValue = MonthlyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);
                break;

            case "W":       // Weekly
                returnValue = WeeklyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);
                break;

            case "D":       // Daily
                returnValue = DailyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);
                break;
            }
            return(returnValue);
        }
        static DailyRecurrenceSettings GetRecurrenceSettings(string seriesInfo, int modifiedOccurrencesValue, DateTime modifiedEndDate)
        {
            RecurrenceInfo info = DailyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);

            return(GetRecurrenceSettings(seriesInfo, modifiedOccurrencesValue, info.StartDate, modifiedEndDate));
        }