This is a migrated thread and some comments may be shown as answers.

RecurrenceRule

12 Answers 313 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Jeremy Murtishaw
Top achievements
Rank 1
Jeremy Murtishaw asked on 08 Aug 2009, 11:46 PM
Hello,
Is there a way to save off the RecurrenceRule and then easily load it back in during a future load?

I save the rule to a string variable in:

void Appointments_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)        
        {
string sRule;
sRule = ev.RecurrenceRule.ToString();
}

When I am manually creating appointments, 

Appointment appointment = null;
                appointment = new Appointment(start, end, summary, description, location);


How can I insert the saved RecurrenceRule into the appointment?

appointment.RecurrenceRule.Equals(sRule);     //does not work


Thanks

12 Answers, 1 is accepted

Sort by
0
Accepted
Robert
Top achievements
Rank 1
answered on 10 Aug 2009, 08:58 PM
Jeremy,

appointment.RecurrenceRule.Equals() is a comparing function that can be used to determine if two recurrence rules are the same.

I suggest using the CalHelper class to load your saved recurrence,

        string savedRecurrence; 
 
        public Form1() 
        { 
            InitializeComponent(); 
 
            radScheduler1.Appointments.CollectionChanged += new Telerik.WinControls.Data.NotifyCollectionChangedEventHandler(Appointments_CollectionChanged); 
        } 
 
        void Appointments_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e) 
        { 
            Appointment app = (Appointment)e.NewItems[0]; 
            savedRecurrence = app.RecurrenceRule.ToString(); 
        } 
 
        private void radButton1_Click(object sender, EventArgs e) 
        { 
            Appointment app = new Appointment(DateTime.Today, DateTime.Today.AddDays(1), "Hello""Hello"); 
            RecurrenceRule recRule; 
            if (CalHelper.TryParseRecurrenceRule(savedRecurrence, out recRule)) 
            { 
                app.RecurrenceRule = recRule; 
                radScheduler1.Appointments.Add(app); 
            } 
        } 
  


I hope this helps.

- Robert





0
Jordan
Telerik team
answered on 11 Aug 2009, 06:46 AM
Hello,

Thank you Robert. The data binding functionality in RadScheduler actually uses the same method for parsing recurrence rules. And for converting recurrence rules to their iCal string representation the CalHelper.RecurrenceRuleToString is used (which is also used by RecurrenceRule.ToString() method).

Greetings,
Jordan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
shinu rag
Top achievements
Rank 1
answered on 18 Feb 2010, 09:13 AM

0
Dobry Zranchev
Telerik team
answered on 18 Feb 2010, 12:04 PM
Hi shinu rag,

Thank you for contacting us. Perhaps you have clicked the Send button before writing your question. What was it?

All the best,
Dobry Zranchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
shinu rag
Top achievements
Rank 1
answered on 18 Feb 2010, 12:12 PM
actually i got the solution, so i try to delete the post but there is no option to delete it....
so just make it as blank...

my question was ,  the code for navigate on next and previous view

i got one solution that
radScheduler1.ActiveView = radScheduler1.ActiveView.OffsetView(1);
thank you Dobry Zranchev
thank you very much...


0
Dobry Zranchev
Telerik team
answered on 18 Feb 2010, 01:53 PM
Hi shinu rag,

Thank you for the question. We have some ways to do it. The first is that you found. You can also use:
RadScheduler.NavigateToNextViewCommand.ExecuteCommand(this.radScheduler1);

RadScheduler.NavigateToPreviousViewCommand.ExecuteCommand(this.radScheduler1);

In the next release we will provide and commands with specific steps.

I hope that my info will help you.

Best wishes,
Dobry Zranchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
shinu rag
Top achievements
Rank 1
answered on 19 Feb 2010, 05:38 AM
can i bind scheduler using collection of class objects..
is it posible?..

like this


// Function Starts Here  
public IList<ClsAppData> GetAppointments_()  
        {  
            ClsAppData objApp;  
            IList<ClsAppData> AppList = new List<ClsAppData>();  
             
              
            try  
            {  
                con.Open();  
                sql = "select ID,FirstName,LastName,Phone,Dob,Gender,Subject,Location,Start,[End],RecurrenceRule,Description from Appointments";  
                da = new SqlDataAdapter(sql, con);  
                ds = new DataSet();  
                ds.Tables.Clear();  
                da.Fill(ds, "Appointments");  
                foreach (DataRow row in ds.Tables["Appointments"].Rows)  
                {  
                    objApp = new ClsAppData();  
                    objApp.ID_ = Convert.ToInt32(row[0]);  
                    objApp.FirstName_ = Convert.ToString(row[1]);  
                    objApp.LastName_ = Convert.ToString(row[2]);  
                    objApp.Phone_ = Convert.ToString(row[3]);  
                    objApp.DtDob_ = Convert.ToDateTime(row[4]);  
                    objApp.Gender_ = Convert.ToInt32(row[5]);  
                    objApp.Subject_ = Convert.ToString(row[6]);  
                    objApp.Location_ = Convert.ToString(row[7]);  
                    objApp.DtStartDate_ = Convert.ToDateTime(row[8]);  
                    objApp.DtEndDate_ = Convert.ToDateTime(row[9]);  
                    objApp.RecurrenceRule_ = Convert.ToString(row[10]);  
                    objApp.Description_ = Convert.ToString(row[11]);  
                    AppList.Add(objApp);  
                }  
            }  
            catch (Exception ex)  
            { System.Windows.Forms.MessageBox.Show(ex.Message); }  
            finally  
            { con.Close(); }  
             
  
             return AppList;  
        }  
//Function End Here  
  
  
// Calling the above function and binding datas to scheduler  
        try  
            {  
                ClsAppFunc obj = new ClsAppFunc();  
                SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource();  
                dataSource.EventProvider.AppointmentFactory = this.radScheduler1.AppointmentFactory;  
                AppointmentMappingInfo info = new AppointmentMappingInfo();  
  
                info.UniqueId = "ID";  
                info.Summary = "FirstName";  
                info.Location = "Location";  
                info.Start = "Start";  
                info.End = "End";  
                info.RecurrenceRule = "RecurrenceRule";  
                info.Description = "Description";  
                info.Visible = "Visible";  
  
                  
                dataSource.EventProvider.Mapping = info;  
                                  
                //////////////////////////////////////  
                IList<ClsAppData> AppList=new List<ClsAppData>();  
                AppList = obj.GetAppointments_();  
                dataSource.EventProvider.DataSource = AppList;  
                /////////////////////////////////////  
  
                  
                this.radScheduler1.DataSource = dataSource;  
            }  
            catch (Exception ex)  
            { MessageBox.Show(ex.Message); }  

when excecuting the application the values are binding with empty values and placed on wrong location...
i won't bind datas using datatable or datasets...
please help me
thanks..
0
Dobry Zranchev
Telerik team
answered on 19 Feb 2010, 08:54 AM
Hello shinu rag,

Thank you for your question. You could read about the binding in the following link: http://www.telerik.com/help/winforms/using_datasource_property.html.
If you have additional questions feel free to ask.

Kind regards,
Dobry Zranchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
shinu rag
Top achievements
Rank 1
answered on 19 Feb 2010, 10:54 AM
hi Dobry Zranchev
i got one code from this link
http://www.telerik.com/help/winforms/using_a_data_provider.html

but     this.ConvertIdToDataSource  and   this.ConvertIdToScheduler  is not specified.
can you help me please.
thank you.


 private void btnBind_Click(object sender, EventArgs e) 
       { 
           SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource(); 
 
           AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo(); 
           appointmentMappingInfo.Start = "Start"
           appointmentMappingInfo.End = "End"
           appointmentMappingInfo.Summary = "Subject"
           appointmentMappingInfo.Description = "Description"
           appointmentMappingInfo.Location = "Location"
           appointmentMappingInfo.UniqueId = "Id"
 
           SchedulerMapping idMapping = appointmentMappingInfo.FindByDataSourceProperty("Id"); 
           idMapping.ConvertToDataSource = new ConvertCallback(this.ConvertIdToDataSource); 
           idMapping.ConvertToScheduler = new ConvertCallback(this.ConvertIdToScheduler); 
 
           dataSource.EventProvider.Mapping = appointmentMappingInfo
           dataSource.EventProvider.DataSource = this.appointments; 
 
           this.radScheduler1.DataSource = dataSource
       }  

0
Dobry Zranchev
Telerik team
answered on 19 Feb 2010, 11:46 AM
Hello shinu rag,

Thank you for your question.

You have to create these methods. Then I suggest that you convert the property of the Appointment class to a property in your custom class and the reverse. For example, you have a custom class that has property string Id, and the Appointment class has a property Id:

private object ConvertUniqueIdToDataSource(object obj)
{
     return (string)((EventId)obj).KeyValue;
}
  
private object ConvertUniqueIdToScheduler(object obj)
{
     return new EventId(obj);
}

and map UniqueId property:

SchedulerMapping idMappingUnigueId = appointmentMappingInfo.FindBySchedulerProperty("UniqueId");
idMappingUnigueId.ConvertToDataSource = new ConvertCallback(this.ConvertUniqueIdToDataSource);
idMappingUnigueId.ConvertToScheduler = new ConvertCallback(this.ConvertUniqueIdToScheduler);

I hope that this helps.

Sincerely yours,
Dobry Zranchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
abm
Top achievements
Rank 1
answered on 08 Mar 2010, 09:03 PM
Hi Telerik Team,

I am trying to save and load appointment and recurrences with radscheduler version 2009 Q3. I am using the sample class - MyAppointment as given in your documentation to load and save appointment data to disk file. While it is fine with normal scheduler data, it does not handle recurrence data. Can you kindly show how to to save/ load recurrences in this situation?

Thanks.

Kabir

0
Dobry Zranchev
Telerik team
answered on 09 Mar 2010, 01:28 PM
Hi abm,

Thank you for contacting us. You could use TryParseRecurrenceRule methods of CalHelper class in order to de-serialize a string to a RecurrenceRule. RecurrenceRule is overriding the method ToString -- it uses CallHelper.RecurrenceRuleToString.

I hope that this information will help. Feel free to write us back, should you have further questions.

Sincerely yours,
Dobry Zranchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Scheduler and Reminder
Asked by
Jeremy Murtishaw
Top achievements
Rank 1
Answers by
Robert
Top achievements
Rank 1
Jordan
Telerik team
shinu rag
Top achievements
Rank 1
Dobry Zranchev
Telerik team
abm
Top achievements
Rank 1
Share this question
or