protected override void InitSchedule(NSchedule schedule) { DateTime today = DateTime.Today; // Create a recurring appointment, which occurs every day NAppointment appointment = new NAppointment("Appointment", today.AddHours(12), today.AddHours(14)); NRecurrenceDailyRule rule = new NRecurrenceDailyRule(); rule.StartDate = new DateTime(2015, 1, 1); appointment.RecurrenceRule = rule; // Add the recurring appointment to the schedule schedule.Appointments.Add(appointment); // Change the time of the first appointment in the current week NAppointmentBase appChild = appointment.Occurrences[0]; appChild.Start = appChild.Start.AddHours(-2); appChild.End = appChild.End.AddHours(-2); // Change the subject of the second appointment appChild = appointment.Occurrences[1]; appChild.Subject = "Custom Subject"; // Change the category of the third appointment appChild = appointment.Occurrences[2]; appChild.Category = "Red"; // Delete the fourth appointment appointment.Occurrences.RemoveAt(3); }
private NRecurrenceDailyRule CreateDailyRule() { // Create a rule, which occurs every day NRecurrenceDailyRule rule = new NRecurrenceDailyRule(); rule.StartDate = RuleStart; return(rule); }
private NRecurrenceDailyRule CreateDailyRuleForFiveOccurrences() { NRecurrenceDailyRule rule = new NRecurrenceDailyRule(); rule.EndMode = ENRecurrenceEndMode.AfterOccurrences; rule.MaxOccurrences = 5; return(rule); }
private NRecurrenceDailyRule CreateDailyRuleForOneMonth() { NRecurrenceDailyRule rule = new NRecurrenceDailyRule(); rule.EndMode = ENRecurrenceEndMode.ByDate; rule.EndDate = DateTime.Today.AddMonths(1); rule.Interval = 2; return(rule); }