static WeeklyRecurrenceSettings GetRecurrenceSettings(string seriesInfo, int modifiedOccurrencesValue, DateTime modifiedStartDate, DateTime modifiedEndDate) { WeeklyRecurrenceSettings settings = null; RecurrenceInfo info = WeeklyRecurrenceSettings.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 WeeklyRecurrenceSettings(modifiedStartDate, info.NumberOfOccurrences); break; case EndDateType.SpecificDate: settings = new WeeklyRecurrenceSettings(modifiedStartDate, info.EndDate.Value); break; case EndDateType.NoEndDate: settings = new WeeklyRecurrenceSettings(modifiedStartDate); break; } // Determine the Type of dates to get, specific, custom, etc. switch (info.WeeklyRegenType) { case WeeklyRegenType.OnEveryXWeeks: settings.SetValues(info.WeeklyRegenEveryXWeeks, info.WeeklySelectedDays); break; case WeeklyRegenType.NotSet: 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); }
static WeeklyRecurrenceSettings GetRecurrenceSettings(string seriesInfo, int modifiedOccurrencesValue, DateTime modifiedEndDate) { RecurrenceInfo info = WeeklyRecurrenceSettings.GetFriendlyRecurrenceInfo(seriesInfo); return(GetRecurrenceSettings(seriesInfo, modifiedOccurrencesValue, info.StartDate, modifiedEndDate)); }