private RecurrenceRange ConvertRecurrenceRange(ExTimeZone startTimeZone, ExTimeZone endTimeZone, RecurrenceRangeBaseType range) { ExDateTime startDate = new ExDateTime(startTimeZone, this.NormalizeDateToUtc(range.StartDate)); NumberedRecurrenceRangeType numberedRecurrenceRangeType = range as NumberedRecurrenceRangeType; if (numberedRecurrenceRangeType != null) { return(new NumberedRecurrenceRange(startDate, numberedRecurrenceRangeType.NumberOfOccurrences)); } EndDateRecurrenceRangeType endDateRecurrenceRangeType = range as EndDateRecurrenceRangeType; if (endDateRecurrenceRangeType != null) { ExDateTime exDateTime = new ExDateTime(startTimeZone, this.NormalizeDateToUtc(endDateRecurrenceRangeType.EndDate)); if (exDateTime > Recurrence.MaximumDateForRecurrenceEnd) { return(new NoEndRecurrenceRange(startDate)); } return(new EndDateRecurrenceRange(startDate, exDateTime)); } else { NoEndRecurrenceRangeType noEndRecurrenceRangeType = range as NoEndRecurrenceRangeType; if (noEndRecurrenceRangeType != null) { return(new NoEndRecurrenceRange(startDate)); } AppointmentTranslator.Tracer.TraceError <AppointmentTranslator, RecurrenceRangeBaseType>((long)this.GetHashCode(), "{0}: Unknown recurrence range: {1}", this, range); throw new InvalidAppointmentException(); } }
public void MSOXWSMTGS_S01_TC15_ModifyOccurrenceWithRelativeYearlyPatternAndNoEndRange() { // Verify RelativeYearlyRecurrencePatternType and NoEndRecurrenceRangeType. RelativeYearlyRecurrencePatternType relativeYearly = new RelativeYearlyRecurrencePatternType(); relativeYearly.DaysOfWeek = "Wednesday"; relativeYearly.DayOfWeekIndex = DayOfWeekIndexType.First; relativeYearly.Month = MonthNamesType.January; NoEndRecurrenceRangeType nonEndRange = new NoEndRecurrenceRangeType(); this.VerifyModifiedOccurrences(relativeYearly, nonEndRange); }
public void MSOXWSMTGS_S01_TC12_ModifyOccurrenceWithAbsoluteMonthlyPatternAndNoEndRange() { // Verify AbsoluteMonthlyRecurrencePatternType and NoEndRecurrenceRangeType. AbsoluteMonthlyRecurrencePatternType absoluteMonthly = new AbsoluteMonthlyRecurrencePatternType(); absoluteMonthly.DayOfMonth = 5; NoEndRecurrenceRangeType nonEndRange = new NoEndRecurrenceRangeType(); this.VerifyModifiedOccurrences(absoluteMonthly, nonEndRange); }