Telerik Scheduler“UniqueId属性” - 如何访问它

时间:2009-12-17 10:03:15

标签: telerik-scheduler

我使用Telerik Demo Scheduler作为我的基础。我修改了这样的数据加载:

public class SessionAppointmentCollection : ObservableCollection<SessionAppointment>, IAppointmentFactory 
    { 

        /// <summary> 
        /// Gets sample appointments. 
        /// </summary> 
        /// <value>The appointments.</value> 
        public SessionAppointmentCollection(RadScheduler scheduler) 
        { 
//            int month = DateTime.Now.Month; 
//            DateTime mondayDate = CalendarHelper.GetFirstDayOfWeek(DateTime.Today, DayOfWeek.Monday); 
//            DateTime satDate = CalendarHelper.GetFirstDayOfWeek(DateTime.Today, DayOfWeek.Saturday); 
//            DateTime lastsundayDate = CalendarHelper.GetEndOfMonth(DateTime.Today); 



            DataTable dtActions = SqlHelper.GetTable("base_Action_Search");//, new string[] { "@CompanyName", client, "@TaskTypeID", db_TaskTypeID.SelectedValue.ToString() });//, "@Users", Users }); 
            foreach (DataRow dr in dtActions.Rows) 
            { 
                SessionAppointment appointmentas = new SessionAppointment(); 

                appointmentas.UniqueId = dr["ActionID"].ToString(); 
                appointmentas.Subject = dr["ActionName"].ToString(); 
                appointmentas.Body = dr["Comments"].ToString(); 
                DateTime start = Convert.ToDateTime(dr["StartDate"].ToString()); 
                appointmentas.Start = start; 
                appointmentas.End = start.AddMinutes(Convert.ToInt32(dr["Duration"].ToString())); 
                appointmentas.SessionRoom = "01"; 
                appointmentas.Speaker = "Testinis vartotojas"; 
                appointmentas.Level = 300; 
                appointmentas.Category = dr["Priority"].ToString().Equals("-1") ? scheduler.Categories.GetCategoryByName("WebDevelopement") : scheduler.Categories.GetCategoryByName("WindowsAndFrameworks"); ; 

                Add(appointmentas); 
            } 

现在我要实现删除。但是我无法访问Unique ID属性?我怎么能这样做..?

2 个答案:

答案 0 :(得分:0)

以下帖子对此有所了解: http://www.telerik.com/community/forums/wpf/scheduler/uniqueid-property-how-to-access-it.aspx

基本上,您必须将AppointmentDeletedEventArgs的e.Appointment参数(因为它的类型为IAppointment)转换为RadScheduler的Appointment对象才能访问UniqueId。

答案 1 :(得分:0)

This article给出了以下答案,该答案适合您:

Appointment appointment = appointmentElement.Appointment as Appointment;
Guid appId = appointment.UniqueId;