次のコード サンプルを使用して、customMicrosoft Dynamics CRM 2011 エンティティから定期的な予定を生成します。この予定は表示のみを目的としており、どこにも保存されません。特定の従業員が週のスケジュールに従っていつ働かなければならないかを示すために使用されます。
string vmstartuur = weekkalender.GetAttributeValue<OptionSetValue>("acm_" + weekdag + "vmstartuur").Value.ToString(dutchCultureInfo);
string vmstartminuut = weekkalender.GetAttributeValue<OptionSetValue>("acm_" + weekdag + "vmstartminuut").Value.ToString(dutchCultureInfo);
string vmeinduur = weekkalender.GetAttributeValue<OptionSetValue>("acm_" + weekdag + "vmeinduur").Value.ToString(dutchCultureInfo);
string vmeindminuut = weekkalender.GetAttributeValue<OptionSetValue>("acm_" + weekdag + "vmeindminuut").Value.ToString(dutchCultureInfo);
DateTime vmstartDateTime = new DateTime(nextDateTime.Year, nextDateTime.Month, nextDateTime.Day, Convert.ToInt32(vmstartuur.Substring(Math.Max(0, vmstartuur.Length - 2))), Convert.ToInt32(vmstartminuut.Substring(Math.Max(0, vmstartminuut.Length - 2))), 0, DateTimeKind.Local);
DateTime vmendDateTime = new DateTime(nextDateTime.Year, nextDateTime.Month, nextDateTime.Day, Convert.ToInt32(vmeinduur.Substring(Math.Max(0, vmeinduur.Length - 2))), Convert.ToInt32(vmeindminuut.Substring(Math.Max(0, vmeindminuut.Length - 2))), 0, DateTimeKind.Local);
Telerik.Web.UI.Appointment vmrecurringAppointment = new Telerik.Web.UI.Appointment {Subject = weekdag + " voormiddag", ID= weekkalender.acm_werknemer.Name + weekdag + "_voormiddag", Start = vmstartDateTime, End = vmendDateTime};
RecurrenceRange vmrange = new RecurrenceRange {Start = vmrecurringAppointment.Start, EventDuration = vmrecurringAppointment.End - vmrecurringAppointment.Start, RecursUntil = contract.slfn_Eindeovereenkomst.GetValueOrDefault(DateTime.MaxValue), MaxOccurrences = Int32.MaxValue};
WeeklyRecurrenceRule vmWeeklyRecurrenceRule = new WeeklyRecurrenceRule(1, GetRecurrenceDay(dayOfWeek), vmrange);
vmrecurringAppointment.RecurrenceRule = vmWeeklyRecurrenceRule.ToString();
vmrecurringAppointment.RecurrenceState = RecurrenceState.Master;
appointmentList.Add(vmrecurringAppointment);
私は 2 から 14 までの定期的な予定を生成します (毎日 2 回)。次に、RadSchedulerRadScheduler.DataSource
にバインドするために使用します。appointmentList
予定は作成されますが、問題は予定が繰り返されないことです。最初の予定は、必要なときに表示されます。つまり、彼の雇用開始日ですが、繰り返されません。http://www.telerik.com/help/aspnet-ajax/scheduler-working-with-recurring-appointments.htmlおよびhttp://dotnetslackers.com/articles/aspnet/で定期的な予定に関する Telerik ガイドに従いました。 Using-Teleriks-Scheduler-Component.aspxですが、再発しない理由がわかりません。