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);
        }
Beispiel #2
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);
        }
Beispiel #3
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));
        }