Telerik Radscheduler定期约会只显示第一次约会

时间:2013-10-22 12:46:09

标签: c# asp.net telerik radscheduler

我使用以下代码示例从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个。然后我使用RadScheduler.DataSourceappointmentList绑定到RadScheduler。

约会已创建,但问题是它们不再发生。第一次约会确实在需要时出现,即在他的工作开始的那天,但他们不再重复。我跟随Telerik指南在http://www.telerik.com/help/aspnet-ajax/scheduler-working-with-recurring-appointments.htmlhttp://dotnetslackers.com/articles/aspnet/Using-Teleriks-Scheduler-Component.aspx上重复约会,但我无法弄清楚为什么它不再发生。

1 个答案:

答案 0 :(得分:0)

我的一位同事帮助了我。事实证明,RadScheduler本身有2个字段会触发重复:DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"。所以我的约会生成器代码很好。