public static void Run() { try { // ExStart:CreateMeetingRequestWithRecurrence String szUniqueId; // Create a mail message MailMessage msg1 = new MailMessage(); msg1.To.Add("*****@*****.**"); msg1.From = new MailAddress("*****@*****.**"); // Create appointment object Appointment agendaAppointment = default(Appointment); // Fill appointment object System.DateTime StartDate = new DateTime(2013, 12, 1, 17, 0, 0); System.DateTime EndDate = new DateTime(2013, 12, 31, 17, 30, 0); agendaAppointment = new Appointment("same place", StartDate, EndDate, msg1.From, msg1.To); // Create unique id as it will help to access this appointment later szUniqueId = Guid.NewGuid().ToString(); agendaAppointment.UniqueId = szUniqueId; agendaAppointment.Description = "----------------"; // Create a weekly reccurence pattern object Aspose.Email.Recurrences.WeeklyRecurrencePattern pattern1 = new WeeklyRecurrencePattern(14); // Set weekly pattern properties like days: Mon, Tue and Thu pattern1.StartDays = new CalendarDay[3]; pattern1.StartDays[0] = CalendarDay.Monday; pattern1.StartDays[1] = CalendarDay.Tuesday; pattern1.StartDays[2] =CalendarDay.Thursday; pattern1.Interval = 1; // Set recurrence pattern for the appointment agendaAppointment.Recurrence = pattern1; //Attach this appointment with mail msg1.AlternateViews.Add(agendaAppointment.RequestApointment()); // Create SmtpCleint SmtpClient client = new SmtpClient("smtp.gmail.com", 587, "*****@*****.**", "your.password"); client.SecurityOptions = SecurityOptions.Auto; // Send mail with appointment request client.Send(msg1); // Return unique id for later usage // return szUniqueId; // ExEnd:SendMailUsingDNS } catch (Exception exception) { Console.Write(exception.Message); throw; } }
public RecurrencePattern ConvertEntitiesToStorage(WeeklyRecurrencePattern value) { if (value != null) { return(new WeeklyRecurrencePattern(this.dayOfWeekConverter.Convert(value.DaysOfWeek), value.Interval, value.FirstDayOfWeek)); } return(null); }
public static string GetName(WeeklyRecurrencePattern dayOfWeek, CultureInfo cultureInfo) { Dictionary<WeeklyRecurrencePattern, string> names = GetNames(cultureInfo); if (!names.ContainsKey(dayOfWeek)) throw new ArgumentOutOfRangeException("dayOfWeek"); return names[dayOfWeek]; }
public OwaRecurrenceType MapRecurrenceType() { OwaRecurrenceType result = OwaRecurrenceType.None; if (this.recurrence == null) { result = OwaRecurrenceType.None; } else if (this.recurrence.Pattern is DailyRecurrencePattern) { result = OwaRecurrenceType.Daily; } else if (this.recurrence.Pattern is WeeklyRecurrencePattern) { WeeklyRecurrencePattern weeklyRecurrencePattern = (WeeklyRecurrencePattern)this.recurrence.Pattern; if (weeklyRecurrencePattern.DaysOfWeek == DaysOfWeek.Weekdays) { result = (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyEveryWeekday); } else { result = OwaRecurrenceType.Weekly; } } else if (this.recurrence.Pattern is MonthlyRecurrencePattern) { result = OwaRecurrenceType.Monthly; } else if (this.recurrence.Pattern is MonthlyThRecurrencePattern) { result = (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyTh); } else if (this.recurrence.Pattern is YearlyRecurrencePattern) { result = OwaRecurrenceType.Yearly; } else if (this.recurrence.Pattern is YearlyThRecurrencePattern) { result = (OwaRecurrenceType.Yearly | OwaRecurrenceType.YearlyTh); } else if (this.recurrence.Pattern is DailyRegeneratingPattern) { result = (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyRegenerating); } else if (this.recurrence.Pattern is WeeklyRegeneratingPattern) { result = (OwaRecurrenceType.Weekly | OwaRecurrenceType.WeeklyRegenerating); } else if (this.recurrence.Pattern is MonthlyRegeneratingPattern) { result = (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyRegenerating); } else if (this.recurrence.Pattern is YearlyRegeneratingPattern) { result = (OwaRecurrenceType.Yearly | OwaRecurrenceType.YearlyRegenerating); } return(result); }
public static void Run() { try { // ExStart:CreateMeetingRequestWithRecurrence String szUniqueId; // Create a mail message MailMessage msg1 = new MailMessage(); msg1.To.Add("*****@*****.**"); msg1.From = new MailAddress("*****@*****.**"); // Create appointment object Appointment agendaAppointment = default(Appointment); // Fill appointment object System.DateTime StartDate = new DateTime(2013, 12, 1, 17, 0, 0); System.DateTime EndDate = new DateTime(2013, 12, 31, 17, 30, 0); agendaAppointment = new Appointment("same place", StartDate, EndDate, msg1.From, msg1.To); // Create unique id as it will help to access this appointment later szUniqueId = Guid.NewGuid().ToString(); agendaAppointment.UniqueId = szUniqueId; agendaAppointment.Description = "----------------"; // Create a weekly reccurence pattern object WeeklyRecurrencePattern pattern1 = new WeeklyRecurrencePattern(14); // Set weekly pattern properties like days: Mon, Tue and Thu pattern1.StartDays = new CalendarDay[3]; pattern1.StartDays[0] = CalendarDay.Monday; pattern1.StartDays[1] = CalendarDay.Tuesday; pattern1.StartDays[2] = CalendarDay.Thursday; pattern1.Interval = 1; // Set recurrence pattern for the appointment agendaAppointment.Recurrence = pattern1; //Attach this appointment with mail msg1.AlternateViews.Add(agendaAppointment.RequestApointment()); // Create SmtpCleint SmtpClient client = new SmtpClient("smtp.gmail.com", 587, "*****@*****.**", "your.password"); client.SecurityOptions = SecurityOptions.Auto; // Send mail with appointment request client.Send(msg1); // Return unique id for later usage // return szUniqueId; // ExEnd:CreateMeetingRequestWithRecurrence } catch (Exception exception) { Console.Write(exception.Message); } }
// Token: 0x06001219 RID: 4633 RVA: 0x000624FC File Offset: 0x000606FC private static void PopulateRecurrencePattern(RecurrenceData recurrenceData, RecurrencePattern pattern) { recurrenceData.Interval = (ushort)pattern.Interval; DailyRecurrencePattern dailyRecurrencePattern = pattern as DailyRecurrencePattern; if (dailyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.Daily; return; } WeeklyRecurrencePattern weeklyRecurrencePattern = pattern as WeeklyRecurrencePattern; if (weeklyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.Weekly; recurrenceData.DaysOfWeek = weeklyRecurrencePattern.DaysOfWeek; return; } AbsoluteMonthlyRecurrencePattern absoluteMonthlyRecurrencePattern = pattern as AbsoluteMonthlyRecurrencePattern; if (absoluteMonthlyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.Monthly; recurrenceData.DayOfMonth = (byte)absoluteMonthlyRecurrencePattern.DayOfMonth; return; } RelativeMonthlyRecurrencePattern relativeMonthlyRecurrencePattern = pattern as RelativeMonthlyRecurrencePattern; if (relativeMonthlyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.MonthlyTh; recurrenceData.WeekIndex = relativeMonthlyRecurrencePattern.Index; recurrenceData.DaysOfWeek = relativeMonthlyRecurrencePattern.DaysOfWeek; return; } AbsoluteYearlyRecurrencePattern absoluteYearlyRecurrencePattern = pattern as AbsoluteYearlyRecurrencePattern; if (absoluteYearlyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.Yearly; recurrenceData.DayOfMonth = (byte)absoluteYearlyRecurrencePattern.DayOfMonth; recurrenceData.MonthOfYear = (byte)absoluteYearlyRecurrencePattern.Month; return; } RelativeYearlyRecurrencePattern relativeYearlyRecurrencePattern = pattern as RelativeYearlyRecurrencePattern; if (relativeYearlyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.YearlyTh; recurrenceData.WeekIndex = relativeYearlyRecurrencePattern.Index; recurrenceData.DaysOfWeek = relativeYearlyRecurrencePattern.DaysOfWeek; recurrenceData.MonthOfYear = (byte)relativeYearlyRecurrencePattern.Month; return; } throw new ConversionException("Unexpected Recurrence Pattern"); }
// Token: 0x0600056C RID: 1388 RVA: 0x0002AEE0 File Offset: 0x000290E0 private bool GetIsDaySelected(DayOfWeek dayOfWeek) { if (this.calendarItemData.Recurrence.Pattern is WeeklyRecurrencePattern) { DaysOfWeek daysOfWeek = CalendarUtilities.ConvertDayOfWeekToDaysOfWeek(dayOfWeek); WeeklyRecurrencePattern weeklyRecurrencePattern = (WeeklyRecurrencePattern)this.calendarItemData.Recurrence.Pattern; return((weeklyRecurrencePattern.DaysOfWeek & daysOfWeek) != DaysOfWeek.None); } return(false); }
private static Appointment CreateAppointment() { MailAddressCollection attendees = new MailAddressCollection(); attendees.Add(new MailAddress("*****@*****.**", "Attendee")); WeeklyRecurrencePattern expected = new WeeklyRecurrencePattern(3); Appointment app = new Appointment("Appointment Location", "Appointment Summary", "Appointment Description", DateTime.Now, DateTime.Now.AddMonths(1), "*****@*****.**", attendees, expected); return(app); }
// Token: 0x06001217 RID: 4631 RVA: 0x000622F8 File Offset: 0x000604F8 private static RecurrencePattern CreateRecurrencePattern(RecurrenceData recurrenceData) { RecurrencePattern recurrencePattern; switch (recurrenceData.Type) { case RecurrenceData.RecurrenceType.Daily: if (recurrenceData.SubProperties["DayOfWeek"] != null) { recurrencePattern = new WeeklyRecurrencePattern(); ((WeeklyRecurrencePattern)recurrencePattern).DaysOfWeek = recurrenceData.DaysOfWeek; goto IL_15E; } recurrencePattern = new DailyRecurrencePattern(); goto IL_15E; case RecurrenceData.RecurrenceType.Weekly: recurrencePattern = new WeeklyRecurrencePattern(); ((WeeklyRecurrencePattern)recurrencePattern).DaysOfWeek = recurrenceData.DaysOfWeek; goto IL_15E; case RecurrenceData.RecurrenceType.Monthly: recurrencePattern = new AbsoluteMonthlyRecurrencePattern(); ((AbsoluteMonthlyRecurrencePattern)recurrencePattern).DayOfMonth = (int)recurrenceData.DayOfMonth; goto IL_15E; case RecurrenceData.RecurrenceType.MonthlyTh: recurrencePattern = new RelativeMonthlyRecurrencePattern(); ((RelativeMonthlyRecurrencePattern)recurrencePattern).DaysOfWeek = recurrenceData.DaysOfWeek; ((RelativeMonthlyRecurrencePattern)recurrencePattern).Index = recurrenceData.WeekIndex; goto IL_15E; case RecurrenceData.RecurrenceType.Yearly: recurrencePattern = new AbsoluteYearlyRecurrencePattern(); ((AbsoluteYearlyRecurrencePattern)recurrencePattern).DayOfMonth = (int)recurrenceData.DayOfMonth; ((AbsoluteYearlyRecurrencePattern)recurrencePattern).Month = (int)recurrenceData.MonthOfYear; goto IL_15E; case RecurrenceData.RecurrenceType.YearlyTh: recurrencePattern = new RelativeYearlyRecurrencePattern(); ((RelativeYearlyRecurrencePattern)recurrencePattern).DaysOfWeek = recurrenceData.DaysOfWeek; ((RelativeYearlyRecurrencePattern)recurrencePattern).Index = recurrenceData.WeekIndex; ((RelativeYearlyRecurrencePattern)recurrencePattern).Month = (int)recurrenceData.MonthOfYear; goto IL_15E; } throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "Unexpected recurrence type {0}, should have been caught in a higher validation layer", new object[] { recurrenceData.Type })); IL_15E: recurrencePattern.Interval = (int)(recurrenceData.HasInterval() ? recurrenceData.Interval : 1); return(recurrencePattern); }
public RecurrencePattern ConvertStorageToEntities(WeeklyRecurrencePattern value) { if (value != null) { return(new WeeklyRecurrencePattern { DaysOfWeek = this.dayOfWeekConverter.Convert(value.DaysOfWeek), FirstDayOfWeek = value.FirstDayOfWeek, Interval = value.RecurrenceInterval }); } return(null); }
public static bool IsRecurrencePatternEqual(RecurrencePattern p1, RecurrencePattern p2) { if (p1 == null != (p2 == null)) { return(false); } if (p1 != null) { if (!p1.GetType().Equals(p2.GetType())) { return(false); } DailyRecurrencePattern dailyRecurrencePattern = p1 as DailyRecurrencePattern; if (dailyRecurrencePattern != null) { DailyRecurrencePattern dailyRecurrencePattern2 = p2 as DailyRecurrencePattern; return(dailyRecurrencePattern.RecurrenceInterval == dailyRecurrencePattern2.RecurrenceInterval); } WeeklyRecurrencePattern weeklyRecurrencePattern = p1 as WeeklyRecurrencePattern; if (weeklyRecurrencePattern != null) { WeeklyRecurrencePattern weeklyRecurrencePattern2 = p2 as WeeklyRecurrencePattern; return(weeklyRecurrencePattern.DaysOfWeek == weeklyRecurrencePattern2.DaysOfWeek && weeklyRecurrencePattern.FirstDayOfWeek == weeklyRecurrencePattern2.FirstDayOfWeek && weeklyRecurrencePattern.RecurrenceInterval == weeklyRecurrencePattern2.RecurrenceInterval); } MonthlyRecurrencePattern monthlyRecurrencePattern = p1 as MonthlyRecurrencePattern; if (monthlyRecurrencePattern != null) { MonthlyRecurrencePattern monthlyRecurrencePattern2 = p2 as MonthlyRecurrencePattern; return(monthlyRecurrencePattern.CalendarType == monthlyRecurrencePattern2.CalendarType && monthlyRecurrencePattern.DayOfMonth == monthlyRecurrencePattern2.DayOfMonth && monthlyRecurrencePattern.RecurrenceInterval == monthlyRecurrencePattern2.RecurrenceInterval); } MonthlyThRecurrencePattern monthlyThRecurrencePattern = p1 as MonthlyThRecurrencePattern; if (monthlyThRecurrencePattern != null) { MonthlyThRecurrencePattern monthlyThRecurrencePattern2 = p2 as MonthlyThRecurrencePattern; return(monthlyThRecurrencePattern.CalendarType == monthlyThRecurrencePattern2.CalendarType && monthlyThRecurrencePattern.DaysOfWeek == monthlyThRecurrencePattern2.DaysOfWeek && monthlyThRecurrencePattern.Order == monthlyThRecurrencePattern2.Order && monthlyThRecurrencePattern.RecurrenceInterval == monthlyThRecurrencePattern2.RecurrenceInterval); } YearlyRecurrencePattern yearlyRecurrencePattern = p1 as YearlyRecurrencePattern; if (yearlyRecurrencePattern != null) { YearlyRecurrencePattern yearlyRecurrencePattern2 = p2 as YearlyRecurrencePattern; return(yearlyRecurrencePattern.CalendarType == yearlyRecurrencePattern2.CalendarType && yearlyRecurrencePattern.DayOfMonth == yearlyRecurrencePattern2.DayOfMonth && yearlyRecurrencePattern.IsLeapMonth == yearlyRecurrencePattern2.IsLeapMonth && yearlyRecurrencePattern.Month == yearlyRecurrencePattern2.Month); } YearlyThRecurrencePattern yearlyThRecurrencePattern = p1 as YearlyThRecurrencePattern; if (yearlyThRecurrencePattern != null) { YearlyThRecurrencePattern yearlyThRecurrencePattern2 = p2 as YearlyThRecurrencePattern; return(yearlyThRecurrencePattern.CalendarType == yearlyThRecurrencePattern2.CalendarType && yearlyThRecurrencePattern.DaysOfWeek == yearlyThRecurrencePattern2.DaysOfWeek && yearlyThRecurrencePattern.IsLeapMonth == yearlyThRecurrencePattern2.IsLeapMonth && yearlyThRecurrencePattern.Month == yearlyThRecurrencePattern2.Month && yearlyThRecurrencePattern.Order == yearlyThRecurrencePattern2.Order); } } return(true); }
public RecurrencePattern Convert(RecurrencePattern value) { if (value == null) { return(null); } DailyRecurrencePattern dailyRecurrencePattern = value as DailyRecurrencePattern; if (dailyRecurrencePattern != null) { return(PatternConverter.dailyPatternConverter.ConvertStorageToEntities(dailyRecurrencePattern)); } WeeklyRecurrencePattern weeklyRecurrencePattern = value as WeeklyRecurrencePattern; if (weeklyRecurrencePattern != null) { return(PatternConverter.weeklyPatternConverter.ConvertStorageToEntities(weeklyRecurrencePattern)); } MonthlyRecurrencePattern monthlyRecurrencePattern = value as MonthlyRecurrencePattern; if (monthlyRecurrencePattern != null) { return(PatternConverter.monthlyPatternConverter.ConvertStorageToEntities(monthlyRecurrencePattern)); } MonthlyThRecurrencePattern monthlyThRecurrencePattern = value as MonthlyThRecurrencePattern; if (monthlyThRecurrencePattern != null) { return(PatternConverter.monthlyPatternConverter.ConvertStorageToEntities(monthlyThRecurrencePattern)); } YearlyRecurrencePattern yearlyRecurrencePattern = value as YearlyRecurrencePattern; if (yearlyRecurrencePattern != null) { return(PatternConverter.yearlyPatternConverter.ConvertStorageToEntities(yearlyRecurrencePattern)); } YearlyThRecurrencePattern yearlyThRecurrencePattern = value as YearlyThRecurrencePattern; if (yearlyThRecurrencePattern != null) { return(PatternConverter.yearlyPatternConverter.ConvertStorageToEntities(yearlyThRecurrencePattern)); } if (value is DailyRegeneratingPattern || value is WeeklyRegeneratingPattern || value is MonthlyRegeneratingPattern || value is YearlyRegeneratingPattern) { throw new NotImplementedException("Regenerating tasks are not implemented in Entities yet."); } throw new ArgumentValueCannotBeParsedException("value", value.GetType().FullName, typeof(RecurrencePattern).FullName); }
public static RecurrencePattern CloneRecurrencePattern(RecurrencePattern pattern) { RecurrencePattern result = null; if (pattern == null) { return(result); } DailyRecurrencePattern dailyRecurrencePattern = pattern as DailyRecurrencePattern; if (dailyRecurrencePattern != null) { return(new DailyRecurrencePattern(dailyRecurrencePattern.RecurrenceInterval)); } MonthlyRecurrencePattern monthlyRecurrencePattern = pattern as MonthlyRecurrencePattern; if (monthlyRecurrencePattern != null) { return(new MonthlyRecurrencePattern(monthlyRecurrencePattern.DayOfMonth, monthlyRecurrencePattern.RecurrenceInterval, monthlyRecurrencePattern.CalendarType)); } MonthlyThRecurrencePattern monthlyThRecurrencePattern = pattern as MonthlyThRecurrencePattern; if (monthlyThRecurrencePattern != null) { return(new MonthlyThRecurrencePattern(monthlyThRecurrencePattern.DaysOfWeek, monthlyThRecurrencePattern.Order, monthlyThRecurrencePattern.RecurrenceInterval, monthlyThRecurrencePattern.CalendarType)); } WeeklyRecurrencePattern weeklyRecurrencePattern = pattern as WeeklyRecurrencePattern; if (weeklyRecurrencePattern != null) { return(new WeeklyRecurrencePattern(weeklyRecurrencePattern.DaysOfWeek, weeklyRecurrencePattern.RecurrenceInterval, weeklyRecurrencePattern.FirstDayOfWeek)); } YearlyRecurrencePattern yearlyRecurrencePattern = pattern as YearlyRecurrencePattern; if (yearlyRecurrencePattern != null) { return(new YearlyRecurrencePattern(yearlyRecurrencePattern.DayOfMonth, yearlyRecurrencePattern.Month, yearlyRecurrencePattern.IsLeapMonth, yearlyRecurrencePattern.CalendarType)); } YearlyThRecurrencePattern yearlyThRecurrencePattern = pattern as YearlyThRecurrencePattern; if (yearlyThRecurrencePattern != null) { return(new YearlyThRecurrencePattern(yearlyThRecurrencePattern.DaysOfWeek, yearlyThRecurrencePattern.Order, yearlyThRecurrencePattern.Month, yearlyThRecurrencePattern.IsLeapMonth, yearlyThRecurrencePattern.CalendarType)); } throw new ArgumentException("Unhandled RecurrencePattern type."); }
// ExStart:SendAppointmentUpdateRequest static public void EMAIL_UPDATE_RECURRENCE(String szUniqueId) { System.DateTime StartDate = new DateTime(2013, 12, 12, 17, 0, 0); System.DateTime EndDate = new DateTime(2013, 12, 12, 17, 30, 0); Appointment appUpdate = new Appointment("Different Place", StartDate, EndDate, "*****@*****.**", "*****@*****.**"); appUpdate.UniqueId = szUniqueId; WeeklyRecurrencePattern pattern3 = (WeeklyRecurrencePattern)appUpdate.Recurrence; appUpdate.Summary = "update meeting request summary"; appUpdate.Description = "update"; MailMessage msgUpdate = new MailMessage("*****@*****.**", "*****@*****.**", "06 - test email - update meeting request", "test email"); msgUpdate.AddAlternateView(appUpdate.UpdateAppointment()); SmtpClient smtp = new SmtpClient("server.domain.com", 587, "username", "password"); smtp.Send(msgUpdate); }
private static DaysOfWeekSelector WeeklyDayOfWeek(WeeklyRecurrencePattern weekDay) { return new DaysOfWeekSelector { Sunday = (weekDay == WeeklyRecurrencePattern.Sunday), Monday = (weekDay == WeeklyRecurrencePattern.Monday), Tuesday = (weekDay == WeeklyRecurrencePattern.Tuesday), Wednesday = (weekDay == WeeklyRecurrencePattern.Wednesday), Thursday = (weekDay == WeeklyRecurrencePattern.Thursday), Friday = (weekDay == WeeklyRecurrencePattern.Friday), Saturday = (weekDay == WeeklyRecurrencePattern.Saturday), }; }
protected Recurrence CreateRecurrenceFromRequest() { Recurrence result = null; if (base.IsParameterSet("RcrT")) { OwaRecurrenceType owaRecurrenceType = (OwaRecurrenceType)base.GetParameter("RcrT"); RecurrencePattern recurrencePattern = null; OwaRecurrenceType owaRecurrenceType2 = owaRecurrenceType; if (owaRecurrenceType2 <= (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyTh)) { if (owaRecurrenceType2 <= OwaRecurrenceType.Monthly) { switch (owaRecurrenceType2) { case OwaRecurrenceType.Daily: recurrencePattern = new DailyRecurrencePattern((int)base.GetParameter("RcrI")); break; case OwaRecurrenceType.None | OwaRecurrenceType.Daily: break; case OwaRecurrenceType.Weekly: recurrencePattern = new WeeklyRecurrencePattern((DaysOfWeek)base.GetParameter("RcrDys"), (int)base.GetParameter("RcrI")); break; default: if (owaRecurrenceType2 == OwaRecurrenceType.Monthly) { recurrencePattern = new MonthlyRecurrencePattern((int)base.GetParameter("RcrDy"), (int)base.GetParameter("RcrI")); } break; } } else if (owaRecurrenceType2 != OwaRecurrenceType.Yearly) { if (owaRecurrenceType2 != (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyEveryWeekday)) { if (owaRecurrenceType2 == (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyTh)) { recurrencePattern = new MonthlyThRecurrencePattern((DaysOfWeek)base.GetParameter("RcrDys"), (RecurrenceOrderType)base.GetParameter("RcrO"), (int)base.GetParameter("RcrI")); } } else { recurrencePattern = new WeeklyRecurrencePattern(DaysOfWeek.Weekdays); } } else { recurrencePattern = new YearlyRecurrencePattern((int)base.GetParameter("RcrDy"), (int)base.GetParameter("RcrM")); } } else if (owaRecurrenceType2 <= (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyRegenerating)) { if (owaRecurrenceType2 != (OwaRecurrenceType.Yearly | OwaRecurrenceType.YearlyTh)) { if (owaRecurrenceType2 == (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyRegenerating)) { recurrencePattern = new DailyRegeneratingPattern((int)base.GetParameter("RgrI")); } } else { recurrencePattern = new YearlyThRecurrencePattern((DaysOfWeek)base.GetParameter("RcrDys"), (RecurrenceOrderType)base.GetParameter("RcrO"), (int)base.GetParameter("RcrM")); } } else if (owaRecurrenceType2 != (OwaRecurrenceType.Weekly | OwaRecurrenceType.WeeklyRegenerating)) { if (owaRecurrenceType2 != (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyRegenerating)) { if (owaRecurrenceType2 == (OwaRecurrenceType.Yearly | OwaRecurrenceType.YearlyRegenerating)) { recurrencePattern = new YearlyRegeneratingPattern((int)base.GetParameter("RgrI")); } } else { recurrencePattern = new MonthlyRegeneratingPattern((int)base.GetParameter("RgrI")); } } else { recurrencePattern = new WeeklyRegeneratingPattern((int)base.GetParameter("RgrI")); } if (owaRecurrenceType != OwaRecurrenceType.None) { RecurrenceRangeType recurrenceRangeType = (RecurrenceRangeType)base.GetParameter("RcrRngT"); ExDateTime startDate = (ExDateTime)base.GetParameter("RcrRngS"); RecurrenceRange recurrenceRange; switch (recurrenceRangeType) { case RecurrenceRangeType.Numbered: recurrenceRange = new NumberedRecurrenceRange(startDate, (int)base.GetParameter("RcrRngO")); goto IL_2C8; case RecurrenceRangeType.EndDate: recurrenceRange = new EndDateRecurrenceRange(startDate, (ExDateTime)base.GetParameter("RcrRngE")); goto IL_2C8; } recurrenceRange = new NoEndRecurrenceRange(startDate); IL_2C8: if (recurrencePattern != null && recurrenceRange != null) { result = new Recurrence(recurrencePattern, recurrenceRange); } } } return(result); }
// Token: 0x060001CB RID: 459 RVA: 0x00011324 File Offset: 0x0000F524 private static Recurrence CreateRecurrenceFromRequest(HttpRequest request, ExDateTime startDate, UserContext userContext) { OwaRecurrenceType newRecurrenceTypeFromPost = EditRecurrencePreFormAction.GetNewRecurrenceTypeFromPost(request); RecurrencePattern pattern = null; Recurrence result = null; DaysOfWeek defaultDaysOfWeek = CalendarUtilities.ConvertDateTimeToDaysOfWeek(startDate); int defaultValue = CalendarUtilities.ComputeDayOfMonthOrder(startDate); OwaRecurrenceType owaRecurrenceType = newRecurrenceTypeFromPost; if (owaRecurrenceType <= OwaRecurrenceType.Yearly) { switch (owaRecurrenceType) { case OwaRecurrenceType.Daily: { int num = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtinterval", 1); num = Math.Max(1, num); pattern = new DailyRecurrencePattern(num); break; } case OwaRecurrenceType.None | OwaRecurrenceType.Daily: break; case OwaRecurrenceType.Weekly: { int num = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtinterval", 1); num = Math.Max(1, num); pattern = new WeeklyRecurrencePattern(EditRecurrencePreFormAction.ParseDayCheckboxes(request, defaultDaysOfWeek), num); break; } default: if (owaRecurrenceType != OwaRecurrenceType.Monthly) { if (owaRecurrenceType == OwaRecurrenceType.Yearly) { int num2 = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYD", startDate.Day); int intFormParameter = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYM", startDate.Month); num2 = Math.Min(ExDateTime.DaysInMonth(startDate.Year, intFormParameter), num2); pattern = new YearlyRecurrencePattern(num2, intFormParameter); } } else { int num2 = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtRcrMD", startDate.Day); int num = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtRcrMM", 1); num = Math.Max(1, num); pattern = new MonthlyRecurrencePattern(num2, num); } break; } } else if (owaRecurrenceType != (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyEveryWeekday)) { if (owaRecurrenceType != (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyTh)) { if (owaRecurrenceType == (OwaRecurrenceType.Yearly | OwaRecurrenceType.YearlyTh)) { int intFormParameter2 = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYTI", defaultValue); int intFormParameter = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYTM", startDate.Month); DaysOfWeek daysOfWeek = EditRecurrencePreFormAction.ParseDaysOfWeek(request, "selRcrThD", defaultDaysOfWeek); pattern = new YearlyThRecurrencePattern(daysOfWeek, (RecurrenceOrderType)intFormParameter2, intFormParameter); } } else { int intFormParameter2 = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYTI", defaultValue); int num = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtRcrMThM", 1); num = Math.Max(1, num); DaysOfWeek daysOfWeek = EditRecurrencePreFormAction.ParseDaysOfWeek(request, "selRcrThD", defaultDaysOfWeek); pattern = new MonthlyThRecurrencePattern(daysOfWeek, (RecurrenceOrderType)intFormParameter2, num); } } else { pattern = new WeeklyRecurrencePattern(DaysOfWeek.Weekdays); } if (newRecurrenceTypeFromPost != OwaRecurrenceType.None) { if (startDate == ExDateTime.MinValue) { startDate = CalendarUtilities.ParseDateTimeFromForm(request, "selSY", "selSM", "selSD", null, userContext); } RecurrenceRange range; switch (EditRecurrencePreFormAction.GetRecurrenceRangeTypeFromPost(request)) { case RecurrenceRangeType.Numbered: { int num3 = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtno", 10); num3 = Math.Max(1, num3); range = new NumberedRecurrenceRange(startDate, num3); goto IL_284; } case RecurrenceRangeType.EndDate: { ExDateTime exDateTime = CalendarUtilities.ParseDateTimeFromForm(request, "selEY", "selEM", "selED", null, userContext); if (exDateTime < startDate) { exDateTime = startDate.IncrementDays(10); } range = new EndDateRecurrenceRange(startDate, exDateTime); goto IL_284; } } range = new NoEndRecurrenceRange(startDate); IL_284: result = new Recurrence(pattern, range); } return(result); }
public static Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Recurrence GetRecurrenceData(PatternedRecurrence recurrence) { if (recurrence == null) { return(null); } Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Recurrence recurrence2 = new Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Recurrence(); recurrence2.Interval = new ushort?((ushort)recurrence.Pattern.Interval); RecurrencePatternType type = recurrence.Pattern.Type; switch (type) { case RecurrencePatternType.Daily: { DailyRecurrencePattern dailyRecurrencePattern = (DailyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 0; break; } case RecurrencePatternType.Weekly: { WeeklyRecurrencePattern weeklyRecurrencePattern = (WeeklyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 1; recurrence2.DayOfWeek = new ushort?(SyncCalendarUtils.GetDayOfWeekValue(weeklyRecurrencePattern.DaysOfWeek)); break; } case RecurrencePatternType.AbsoluteMonthly: { AbsoluteMonthlyRecurrencePattern absoluteMonthlyRecurrencePattern = (AbsoluteMonthlyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 2; recurrence2.DayOfMonth = new byte?((byte)absoluteMonthlyRecurrencePattern.DayOfMonth); break; } case RecurrencePatternType.RelativeMonthly: { RelativeMonthlyRecurrencePattern relativeMonthlyRecurrencePattern = (RelativeMonthlyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 3; recurrence2.DayOfWeek = new ushort?(SyncCalendarUtils.GetDayOfWeekValue(relativeMonthlyRecurrencePattern.DaysOfWeek)); recurrence2.WeekOfMonth = new byte?((byte)relativeMonthlyRecurrencePattern.Index); break; } case RecurrencePatternType.AbsoluteYearly: { AbsoluteYearlyRecurrencePattern absoluteYearlyRecurrencePattern = (AbsoluteYearlyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 5; recurrence2.DayOfMonth = new byte?((byte)absoluteYearlyRecurrencePattern.DayOfMonth); recurrence2.MonthOfYear = new byte?((byte)absoluteYearlyRecurrencePattern.Month); break; } case RecurrencePatternType.RelativeYearly: { RelativeYearlyRecurrencePattern relativeYearlyRecurrencePattern = (RelativeYearlyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 6; recurrence2.DayOfWeek = new ushort?(SyncCalendarUtils.GetDayOfWeekValue(relativeYearlyRecurrencePattern.DaysOfWeek)); recurrence2.WeekOfMonth = new byte?((byte)relativeYearlyRecurrencePattern.Index); recurrence2.MonthOfYear = new byte?((byte)relativeYearlyRecurrencePattern.Month); break; } default: throw new EasSyncFailedPermanentException("Invalid recurrence type: " + type); } RecurrenceRangeType type2 = recurrence.Range.Type; switch (type2) { case RecurrenceRangeType.EndDate: { EndDateRecurrenceRange endDateRecurrenceRange = (EndDateRecurrenceRange)recurrence.Range; recurrence2.Until = SyncCalendarUtils.ToStringDateTime(endDateRecurrenceRange.EndDate); break; } case RecurrenceRangeType.NoEnd: break; case RecurrenceRangeType.Numbered: { NumberedRecurrenceRange numberedRecurrenceRange = (NumberedRecurrenceRange)recurrence.Range; recurrence2.Occurrences = new ushort?((ushort)numberedRecurrenceRange.NumberOfOccurrences); break; } default: throw new EasSyncFailedPermanentException("Invalid recurrence range type: {0}" + type2); } return(recurrence2); }
private static RecurrencePattern CreateRecurrencePattern(TypeOfRecurrence recurrenceType, RecurrenceData recurrenceData, Recurrence oldRecurrence) { ushort recurrenceInterval = 1; RecurrenceData.RecurrenceType type = recurrenceData.Type; if (recurrenceData.HasInterval()) { recurrenceInterval = recurrenceData.Interval; } if (recurrenceData.HasWeekOfMonth()) { recurrenceData.WeekOfMonth = ((recurrenceData.WeekOfMonth == 5) ? byte.MaxValue : recurrenceData.WeekOfMonth); } if (recurrenceType == TypeOfRecurrence.Calendar || (recurrenceType == TypeOfRecurrence.Task && !recurrenceData.Regenerate)) { switch (type) { case RecurrenceData.RecurrenceType.Daily: if (recurrenceData.SubProperties["DayOfMonth"] != null || recurrenceData.SubProperties["WeekOfMonth"] != null || recurrenceData.SubProperties["MonthOfYear"] != null || recurrenceData.SubProperties["CalendarType"] != null || recurrenceData.SubProperties["IsLeapMonth"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfMonth, WeekOfMonth, MonthOfYear, CalendarType, IsLeapMonth is not expected with recurrence type {0}", new object[] { type.ToString() })); } if (recurrenceData.SubProperties["DayOfWeek"] != null) { return(new WeeklyRecurrencePattern((DaysOfWeek)recurrenceData.DayOfWeek, (int)recurrenceInterval)); } return(new DailyRecurrencePattern((int)recurrenceInterval)); case RecurrenceData.RecurrenceType.Weekly: { if (recurrenceData.SubProperties["DayOfMonth"] != null || recurrenceData.SubProperties["WeekOfMonth"] != null || recurrenceData.SubProperties["MonthOfYear"] != null || recurrenceData.SubProperties["CalendarType"] != null || recurrenceData.SubProperties["IsLeapMonth"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfMonth, WeekOfMonth, MonthOfYear, CalendarType, IsLeapMonth is not expected with recurrence type {0}", new object[] { type.ToString() })); } if (recurrenceData.SubProperties["DayOfWeek"] == null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfWeek is expected with recurrence type {0}", new object[] { type.ToString() })); } WeeklyRecurrencePattern weeklyRecurrencePattern = (oldRecurrence != null) ? (oldRecurrence.Pattern as WeeklyRecurrencePattern) : null; return(new WeeklyRecurrencePattern((DaysOfWeek)recurrenceData.DayOfWeek, (int)recurrenceInterval, (recurrenceData.ProtocolVersion < 141 && weeklyRecurrencePattern != null) ? weeklyRecurrencePattern.FirstDayOfWeek : recurrenceData.FirstDayOfWeek)); } case RecurrenceData.RecurrenceType.Monthly: if (recurrenceData.SubProperties["DayOfWeek"] != null || recurrenceData.SubProperties["WeekOfMonth"] != null || recurrenceData.SubProperties["MonthOfYear"] != null || recurrenceData.SubProperties["IsLeapMonth"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfWeek, WeekOfMonth, MonthOfYear, IsLeapMonth is not expected with recurrence type {0}", new object[] { type.ToString() })); } if (recurrenceData.SubProperties["DayOfMonth"] == null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfMonth is expected with recurrence type {0}", new object[] { type.ToString() })); } return(new MonthlyRecurrencePattern((int)recurrenceData.DayOfMonth, (int)recurrenceInterval, recurrenceData.CalendarType)); case RecurrenceData.RecurrenceType.MonthlyTh: { if (recurrenceData.SubProperties["DayOfMonth"] != null || recurrenceData.SubProperties["MonthOfYear"] != null || recurrenceData.SubProperties["IsLeapMonth"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfMonth, MonthOfYear, IsLeapMonth is not expected with recurrence type {0}", new object[] { type.ToString() })); } if (recurrenceData.SubProperties["WeekOfMonth"] == null || recurrenceData.SubProperties["DayOfWeek"] == null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "WeekOfMonth, DayOfWeek is expected with recurrence type {0}", new object[] { type.ToString() })); } RecurrenceOrderType recurrenceOrderType = (recurrenceData.WeekOfMonth == byte.MaxValue) ? RecurrenceOrderType.Last : ((RecurrenceOrderType)recurrenceData.WeekOfMonth); if (!EnumValidator.IsValidValue <RecurrenceOrderType>(recurrenceOrderType)) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "WeekOfMonth value {0} is invalid", new object[] { recurrenceOrderType.ToString() })); } return(new MonthlyThRecurrencePattern((DaysOfWeek)recurrenceData.DayOfWeek, recurrenceOrderType, (int)recurrenceInterval, recurrenceData.CalendarType)); } case RecurrenceData.RecurrenceType.Yearly: if (recurrenceData.SubProperties["DayOfWeek"] != null || recurrenceData.SubProperties["WeekOfMonth"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfWeek, WeekOfMonth is not expected with recurrence type {0}", new object[] { type.ToString() })); } if (recurrenceData.SubProperties["DayOfMonth"] == null || recurrenceData.SubProperties["MonthOfYear"] == null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfMonth, MonthOfYear is expected with recurrence type {0}", new object[] { type.ToString() })); } return(new YearlyRecurrencePattern((int)recurrenceData.DayOfMonth, (int)recurrenceData.MonthOfYear, recurrenceData.IsLeapMonth, recurrenceData.CalendarType)); case RecurrenceData.RecurrenceType.YearlyTh: { if (recurrenceData.SubProperties["DayOfMonth"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfMonth is not expected with recurrence type {0}", new object[] { type.ToString() })); } if (recurrenceData.SubProperties["WeekOfMonth"] == null || recurrenceData.SubProperties["DayOfWeek"] == null || recurrenceData.SubProperties["MonthOfYear"] == null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "WeekOfMonth, DayOfWeek, MonthOfYear is expected with recurrence type {0}", new object[] { type.ToString() })); } RecurrenceOrderType recurrenceOrderType = (recurrenceData.WeekOfMonth == byte.MaxValue) ? RecurrenceOrderType.Last : ((RecurrenceOrderType)recurrenceData.WeekOfMonth); if (!EnumValidator.IsValidValue <RecurrenceOrderType>(recurrenceOrderType)) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "WeekOfMonth value {0} is invalid", new object[] { recurrenceOrderType.ToString() })); } return(new YearlyThRecurrencePattern((DaysOfWeek)recurrenceData.DayOfWeek, recurrenceOrderType, (int)recurrenceData.MonthOfYear, recurrenceData.IsLeapMonth, recurrenceData.CalendarType)); } } throw new ConversionException("Unexpected recurrence type, should have been caught in a higher validation layer"); } switch (type) { case RecurrenceData.RecurrenceType.Daily: if (recurrenceData.SubProperties["DayOfWeek"] != null || recurrenceData.SubProperties["DayOfMonth"] != null || recurrenceData.SubProperties["WeekOfMonth"] != null || recurrenceData.SubProperties["MonthOfYear"] != null || recurrenceData.SubProperties["CalendarType"] != null || recurrenceData.SubProperties["IsLeapMonth"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfWeek, DayOfMonth, WeekOfMonth, MonthOfYear, CalendarType, IsLeapMonth is not expected with recurrence type {0}", new object[] { type.ToString() })); } return(new DailyRegeneratingPattern((int)recurrenceInterval)); case RecurrenceData.RecurrenceType.Weekly: if (recurrenceData.SubProperties["DayOfWeek"] != null || recurrenceData.SubProperties["DayOfMonth"] != null || recurrenceData.SubProperties["WeekOfMonth"] != null || recurrenceData.SubProperties["MonthOfYear"] != null || recurrenceData.SubProperties["CalendarType"] != null || recurrenceData.SubProperties["IsLeapMonth"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfWeek, DayOfMonth, WeekOfMonth, MonthOfYear, CalendarType, IsLeapMonth is not expected with recurrence type {0}", new object[] { type.ToString() })); } return(new WeeklyRegeneratingPattern((int)recurrenceInterval)); case RecurrenceData.RecurrenceType.Monthly: if (recurrenceData.SubProperties["DayOfWeek"] != null || recurrenceData.SubProperties["DayOfMonth"] != null || recurrenceData.SubProperties["WeekOfMonth"] != null || recurrenceData.SubProperties["MonthOfYear"] != null || recurrenceData.SubProperties["IsLeapMonth"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfWeek, DayOfMonth, WeekOfMonth, MonthOfYear, IsLeapMonth is not expected with recurrence type {0}", new object[] { type.ToString() })); } return(new MonthlyRegeneratingPattern((int)recurrenceInterval, recurrenceData.CalendarType)); case RecurrenceData.RecurrenceType.Yearly: if (recurrenceData.SubProperties["DayOfWeek"] != null || recurrenceData.SubProperties["DayOfMonth"] != null || recurrenceData.SubProperties["WeekOfMonth"] != null || recurrenceData.SubProperties["MonthOfYear"] != null) { throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "DayOfWeek, DayOfMonth, WeekOfMonth, MonthOfYear is not expected with recurrence type {0}", new object[] { type.ToString() })); } return(new YearlyRegeneratingPattern((int)recurrenceInterval, recurrenceData.CalendarType)); } throw new ConversionException("Unexpected recurrence type '" + type + "', should have been caught in a higher validation layer"); }