static MonthlyRecurrenceSettings 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 = MonthlyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo); return(GetRecurrenceSettings(seriesInfo, modifiedOccurrencesValue, info.StartDate, modifiedEndDate)); }
static MonthlyRecurrenceSettings 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 = MonthlyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo); MonthlyRecurrenceSettings 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 MonthlyRecurrenceSettings(modifiedStartDate, info.NumberOfOccurrences); break; case EndDateType.SpecificDate: settings = new MonthlyRecurrenceSettings(modifiedStartDate, info.EndDate.Value); break; case EndDateType.NoEndDate: settings = new MonthlyRecurrenceSettings(modifiedStartDate); break; } settings.AdjustmentValue = info.AdjustmentValue; // Determine the Type of dates to get, specific, custom, etc. switch (info.MonthlyRegenType) { case MonthlyRegenType.OnSpecificDayOfMonth: settings.SetValues(info.MonthlyRegenerateOnSpecificDateDayValue, info.MonthlyRegenEveryXMonths); break; case MonthlyRegenType.OnCustomDateFormat: settings.SetValues(info.MonthlySpecificDatePartOne, info.MonthlySpecificDatePartTwo, info.MonthlyRegenEveryXMonths); break; case MonthlyRegenType.AfterOccurrenceCompleted: break; } return(settings); }
/// <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); }
/// <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); }