RecurrenceRule

13 posts, 1 answers
  1. Jeremy Murtishaw
    Jeremy Murtishaw avatar
    86 posts
    Member since:
    Apr 2009

    Posted 08 Aug 2009 Link to this post

    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
  2. Answer
    Robert
    Robert avatar
    82 posts
    Member since:
    Jun 2009

    Posted 10 Aug 2009 Link to this post

    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





  3. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 11 Aug 2009 Link to this post

    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.
  4. shinu rag
    shinu rag avatar
    48 posts
    Member since:
    Feb 2010

    Posted 18 Feb 2010 Link to this post


  5. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    353 posts

    Posted 18 Feb 2010 Link to this post

    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.
  6. shinu rag
    shinu rag avatar
    48 posts
    Member since:
    Feb 2010

    Posted 18 Feb 2010 Link to this post

    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...


  7. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    353 posts

    Posted 18 Feb 2010 Link to this post

    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.
  8. shinu rag
    shinu rag avatar
    48 posts
    Member since:
    Feb 2010

    Posted 18 Feb 2010 Link to this post

    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..
  9. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    353 posts

    Posted 19 Feb 2010 Link to this post

    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.
  10. shinu rag
    shinu rag avatar
    48 posts
    Member since:
    Feb 2010

    Posted 19 Feb 2010 Link to this post

    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
           }  

  11. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    353 posts

    Posted 19 Feb 2010 Link to this post

    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.
  12. abm
    abm avatar
    5 posts
    Member since:
    Jun 2008

    Posted 08 Mar 2010 Link to this post

    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

  13. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    353 posts

    Posted 09 Mar 2010 Link to this post

    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.
Back to Top