0

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

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

4

1 回答 1

0

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

于 2013-10-23T07:21:56.603 回答