Schedule linked to database

Posted by: fsegui on 3 February 2021, 4:37 am EST

    • Post Options:
    • Link

    Posted 3 February 2021, 4:37 am EST

    Hello,

    I’m using C1Schedule control and i’ve linked it to a PostGreSQL database.

    Another thing is that I use a custom form for appointments.

    Creating appointment works well but I need to update other fields in the database for this appointment. What’s the better way to achieve that?

    I need to do this wether the user double click on the appointment and validate through the custom form or moving the appointment directly in the control.

  • Posted 5 February 2021, 6:08 am EST - Updated 3 October 2022, 11:23 pm EST

    Hi,

    As we understand, you have some other fields in your database for an appointment and you want to change them also with the other details of the Appointment using a custom form. You need to use the DataRow associate with the appointment for this purpose, you can use the Key property of the appointment to get the key which you can then use to find the data row using the Find() method of the data row collection of the data table. Once you have the data row, you can use it to get or set the data in any field of the appointment.

    You can update the database in the AppointmentChanged event which fires if the appointment changes which also includes moving an appointment as moving changes the time of the appointment. To update data after you have done changes in the custom form, you can use the FormClosed event of the custom form. Please refer to the sample and GIF attached.

    Regards.

    Avnish

    C1SchedulerUpdate.zip

  • Posted 9 February 2021, 7:11 am EST

    Hi Avnish,

    Thanks, that works fine like this.

    One more question: is it possible to prevent an Appointment deletion?

    Before deleting the appointment, I need to make some operations (delete other records in the database in other tables).

    If I use the AppointmentDeleted event, will I be able to prevent the final deletion if the operations fail?

  • Posted 9 February 2021, 7:20 am EST

    Hi,

    You can use the BeforeAppointmentDelete event to prevent an appointment from being deleted. Just set the Cancel property of the CancelAppointmentEventArgs of this event to true whenever you want to prevent the deletion of an appointment.

    private void C1Schedule1_BeforeAppointmentDelete(object sender, CancelAppointmentEventArgs e)
            {
                // do operation
                if (failed)
                {
                    e.Cancel = true;
                    return;
                }
            }
    

    Regards.

    Avnish

  • Posted 9 February 2021, 7:39 am EST

    Thanks for your quick feedback.

    that’s exactly what I need!!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels