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

RAD Scheduler: Automatic re-scheduling of tasks

3 Answers 70 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kalindi
Top achievements
Rank 1
Kalindi asked on 02 Sep 2008, 02:37 PM
Hi,

I need to build a simple task manager.  I need to be able to automatically adjust the start and finish dates for new tasks, if I change the start/finish date of a task.

Does the RAD Scheduler have this feature built in, or will I need to write code to accomplish this?  Do you have sample code that demonstrates this?

Appreciate any help you can provide.

Thanks,
Kalindi

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 02 Sep 2008, 03:14 PM
Hello Kalindi,

Yes, you can set the Start and End properties of the Appointment object in the AppointmentInsert event. For example, the code below sets the duration of each new appoitnment to two hours.

 protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)  
    {  
        e.Appointment.End = e.Appointment.Start.Add(new TimeSpan(2, 0, 0));  
    } 


Sincerely yours,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kalindi
Top achievements
Rank 1
answered on 04 Sep 2008, 07:21 AM
Hi Peter,

Thank you for the prompt response and the sample code.

I guess I did not phrase the question correctly.  Here is an example that shows the behavior I am looking for:

Task A 1:00PM - 2:00PM
Task B 2:00-4:00PM
Task C 5:00PM  - 6:00PM

Also assume that the tasks have to be performed in sequence - first Task A, second Task B, and third Task C.

If I move Task A to 1:30PM, I want the new schedule to look like the following, without having to manually move them:

Task A 1:30PM - 2:30PM
Task B 2:30-4:30PM
Task C 5:30PM  - 6:30PM

Does the Scheduler support this or will need to program this behavior?

Thanks again for your help on this.

Kalindi
0
Peter
Telerik team
answered on 04 Sep 2008, 12:52 PM
Hello Kalindi,

Thanks for clarifying. There are still unknowns around your case, but I think I got the main idea. RadScheduler doesn't provide the desired functionality as a built-in feature. However, you can try to implement it from code. Here is a sample code which might give you ideas and help you get started:

    private TimeSpan shift;  
    private string updatedAppointmentSubject;  
    protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)  
    {  
        shift = e.ModifiedAppointment.Start.Subtract(e.Appointment.Start);  
        updatedAppointmentSubject = e.Appointment.Subject;  
    }  
    protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)  
    {  
        if (e.Appointment.Subject != updatedAppointmentSubject)  
        {  
            e.Appointment.Start = e.Appointment.Start.Add(shift);  
            e.Appointment.End = e.Appointment.End.Add(shift);  
        }  
    }  
    protected void RadScheduler1_DataBound(object sender, EventArgs e)  
    {  
        shift = new TimeSpan(0, 0, 0);  
    } 




Best wishes,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
Kalindi
Top achievements
Rank 1
Answers by
Peter
Telerik team
Kalindi
Top achievements
Rank 1
Share this question
or