2013-10-22 74 views
0

我使用下面的代碼示例從customMicrosoft Dynamics CRM 2011實體中生成定期約會。此預約僅用於顯示目的,不會存儲在任何地方。它只是用來顯示某個員工何時需要按照他的周計劃工作。Telerik Radscheduler定期約會只顯示第一個約會

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,但我不明白爲什麼它不會再發生。

回答

0

我的一位同事幫助了我。原因是RadScheduler本身有兩個觸發重複的字段:DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"。所以我的約會發電機代碼很好。