示例#1
0
        static YearlyRecurrenceSettings GetRecurrenceSettings(string seriesInfo, int modifiedOccurrencesValue, DateTime modifiedEndDate)
        {
            // Get the Recurrence Info object. This makes it easy to work with existing series of date patterns.
            RecurrenceInfo info = YearlyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);

            return(GetRecurrenceSettings(seriesInfo, modifiedOccurrencesValue, info.StartDate, modifiedEndDate));
        }
示例#2
0
        static YearlyRecurrenceSettings GetRecurrenceSettings(string seriesInfo, int modifiedOccurrencesValue, DateTime modifiedStartDate, DateTime modifiedEndDate)
        {
            // Get the Recurrence Info object. This makes it easy to work with existing series of date patterns.
            RecurrenceInfo           info     = YearlyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo);
            YearlyRecurrenceSettings settings = null;

            // 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 YearlyRecurrenceSettings(modifiedStartDate, info.NumberOfOccurrences);
                break;

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

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

            settings.AdjustmentValue = info.AdjustmentValue;

            // Determine the Type of dates to get, specific, custom, etc.
            switch (info.YearlyRegenType)
            {
            case YearlyRegenType.OnSpecificDayOfYear:
                settings.SetValues(info.SpecificDateDayValue, info.SpecificDateMonthValue);
                break;

            case YearlyRegenType.OnCustomDateFormat:
                settings.SetValues(info.YearlySpecificDatePartOne, info.YearlySpecificDatePartTwo, info.YearlySpecificDatePartThree);
                break;

            case YearlyRegenType.AfterOccurrenceCompleted:

                break;
            }
            return(settings);
        }
示例#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[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);
        }
示例#4
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);
        }