Copy all appointments server side

2 posts, 0 answers
  1. David
    David avatar
    1 posts
    Member since:
    Aug 2016

    Posted 09 Jan Link to this post

    Hi, I would like to develop a staff rota system, where the staff member would copy all appointments from a "Master Rota" which they would have previously created onto the current month.

    E.G the master rota would contain 4 weeks of appointments, which they can then copy each time on to the current month.  They can then do this each month to avoid having to create the appointments each time.  I know that you could set a recurring appointment but we would like to have a fixed 4 week rota which can copied onto a month just by clicking a button which would copy all appointments across from this "master rota" onto the Live rota.

     

    Would this be possible?

  2. Nencho
    Admin
    Nencho avatar
    1521 posts

    Posted 12 Jan Link to this post

    Hello David,

    In order to achieve the needed functionality, you can clone the appointments for a specific range (one month in your case), clone them and insert the new appointments with 1 month increased. :

    protected void Buttoon1_Click(object sender, EventArgs e)
    {
     
        DateTime startTime = new DateTime(2017, 1, 1);
        DateTime endtime = startTime.AddMonths(1);
     
        foreach (Appointment app in RadScheduler1.Appointments.GetAppointmentsInRange(startTime, endtime))
        {
            Appointment newAppointment = new Appointment();
            newAppointment = app.Clone();
            newAppointment.Start =  newAppointment.Start.AddMonths(1);
            newAppointment.End = newAppointment.End.AddMonths(1);
            RadScheduler1.InsertAppointment(newAppointment);
        }
    }


    Regards,
    Nencho
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top