Ejemplo n.º 1
0
		/// <summary>
		/// This is a factory method to return a RecurringEvent appropriate for the given pattern.
		/// </summary>
		/// <param name="pattern">The type of recurrence.</param>
		/// <param name="StartDate">The first date on which the event occurs.</param>
		/// <param name="EndDate">The last date on which a recurrence can occur, or null if no end date.</param>
		/// <returns></returns>
		public static RecurringEvent Get(TRecurrencePattern pattern, DateTime StartDate, int DurationMinutes, DateTime? RecurUntilDate, string RecurrenceData) {
			RecurringEvent e;
			switch (pattern) {
				case TRecurrencePattern.None:
					e = new NonRecurringEvent(); break;
				case TRecurrencePattern.Hourly:
					e = new HourlyRecurringEvent(); break;
				case TRecurrencePattern.Daily:
					e = new DailyRecurringEvent(); break;
				case TRecurrencePattern.Weekly:
					e = new WeeklyRecurringEvent(); break;
				case TRecurrencePattern.MonthlySimple:
					e = new MonthlySimpleRecurringEvent(); break;
				case TRecurrencePattern.MonthlyComplex:
					e = new MonthlyComplexRecurringEvent(); break;
				case TRecurrencePattern.YearlySimple:
					e = new YearlySimpleRecurringEvent(); break;
				case TRecurrencePattern.YearlyComplex:
					e = new YearlyComplexRecurringEvent(); break;
				default:
					throw new EnumerationValueException(pattern);
			}
			e.StartDate = StartDate;
			e.DurationMinutes = DurationMinutes;
			e.RecurUntil = RecurUntilDate;
			if (!string.IsNullOrEmpty(RecurrenceData))
				e.RecurrenceData = RecurrenceData;
			return e;
		}
Ejemplo n.º 2
0
		/// <summary>
		/// This is a factory method to return a RecurringEvent appropriate for the given pattern.
		/// </summary>
		/// <param name="pattern">The type of recurrence.</param>
		/// <param name="StartDate">The first date on which the event occurs.</param>
		/// <param name="EndDate">The last date on which a recurrence can occur, or null if no end date.</param>
		/// <returns></returns>
		public static RecurringEvent Get(TRecurrencePattern pattern, DateTime StartDate, int DurationMinutes, DateTime? RecurUntilDate) {
			return Get(pattern, StartDate, DurationMinutes, RecurUntilDate, null);
		}