PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Deleting an appointment
OrganizerDeleteAppointment (Example)
Deleting an appointment
This example is used to delete an appointment defined as a recurring task that occurs every day.
// Delete a daily recurring task
arrApt is array of 0 Appointment
gMyAptList is Appointment
dtDateFirstOccurrence is DateTime = gMyOrganizer..StartDate
dtStartDateTimeSelectedApt is DateTime
dtEndDateTimeSelectedApt is DateTime
arrApt = OrganizerListAppointment(ORG_MyOrganizer1, orgAptSelected)
bIdenticalDate is boolean = False

//1: This appointment only
//2: All the appointments of the set
//3: All the forthcoming appointments
//4: Cancel the deletion
IF gMyOrganizer..WithRepetition = True AND ...
gMyOrganizer..Repetition..Type = orgEveryDay THEN
SWITCH Dialog("Do you want to delete this appointment only", ...
" all the appointment in the series, or this appointment " + ...
" all the later appointments of the series?")
CASE 1
// Delete all the appointments
OrganizerDeleteAppointment(ORG_Organizer1)
FOR EACH gMyAptList OF arrApt
// Create a recurring task
// for the appointments after the selected one
dtStartDateTimeSelectedApt = gMyAptList..StartDate
IF dtDateFirstOccurrence =  ...
dtStartDateTimeSelectedApt THEN
bIdenticalDate = True
END
dtStartDateTimeSelectedApt..Day += 1
dtEndDateTimeSelectedApt = gMyAptList..EndDate
dtEndDateTimeSelectedApt..Day += 1
gMyAptList..StartDate = dtStartDateTimeSelectedApt
gMyAptList..EndDate = dtEndDateTimeSelectedApt
OrganizerAddAppointment(ORG_Organizer1, gMyAptList)
// If the selected appointment is not
// the first day of the recurring task
// Create a recurring task
// for the appointments before the selected one
// Otherwise, no action
IF bIdenticalDate = False
gMyAptList..StartDate = dtDateFirstOccurrence
gMyAptList..EndDate =  ...
dtDateFirstOccurrence..Date + ...
dtEndDateTimeSelectedApt..Time
dtStartDateTimeSelectedApt..Day -= 2
gMyAptList..Repetition..EndDate =  ...
dtStartDateTimeSelectedApt..Date
OrganizerAddAppointment(ORG_Organizer1, gMyAptList)
END
END
CASE 2
// This appointment only
OrganizerDeleteAppointment(ORG_Organizer1)
CASE 3
OrganizerDeleteAppointment(ORG_Organizer1)
FOR EACH gMyAptList OF arrApt
// Create a recurring task
// for the appointments before the selected one
// If the selected appointment is equal
// to the first day of the recurring task,
// it means deleting the recurring appointment entirely
dtEndDateTimeSelectedApt = gMyAptList..EndDate
dtStartDateTimeSelectedApt = gMyAptList..StartDate
IF dtDateFirstOccurrence <> dtStartDateTimeSelectedApt
gMyAptList..StartDate = dtDateFirstOccurrence
gMyAptList..EndDate =  ...
dtDateFirstOccurrence..Date + ...
dtEndDateTimeSelectedApt..Time
dtStartDateTimeSelectedApt..Day -= 1
gMyAptList..Repetition..EndDate =  ...
dtStartDateTimeSelectedApt..Date
OrganizerAddAppointment(ORG_Organizer1, gMyAptList)
END

END
// Cancel the deletion
CASE 4

END
ELSE
OrganizerDeleteAppointment(ORG_Organizer1)
END
Minimum version required
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment