ASSchedulerUtils.API.SQL.BeginTransaction
Try
Dim StartDate As Long = DateTime.Now - (DateTime.TicksPerDay * 10)
For i = 0 To 5800 -1 'Inserts on 5800 days appointments
Dim ThisDate As Long = StartDate + (DateTime.TicksPerDay * i)
For z = 0 To 4 -1 '4 appointments for 5800 day = 19.200 appointments
Dim StartHour As Int = Rnd(7,22)
Dim EndHour As Int = StartHour + Rnd(1,3)
Dim Appointment1 As ASScheduler_Appointment = ASSchedulerUtils.CreateASScheduler_Appointment(0,"Test " & (z+1),"",xui.Color_ARGB(255,Rnd(0,256),Rnd(0,256),Rnd(0,256)),False,DateUtils.SetDateAndTime(DateTime.GetYear(ThisDate),DateTime.GetMonth(ThisDate),DateTime.GetDayOfMonth(ThisDate),StartHour,0,0),DateUtils.SetDateAndTime(DateTime.GetYear(ThisDate),DateTime.GetMonth(ThisDate),DateTime.GetDayOfMonth(ThisDate),EndHour,0,0))
ASSchedulerUtils.API.CreateAppointment(Appointment1)
Next
Next
Dim Appointment1 As ASScheduler_Appointment = ASSchedulerUtils.CreateASScheduler_AppointmentRecurring(0,"Recurring","",xui.Color_ARGB(255,Rnd(0,256),Rnd(0,256),Rnd(0,256)),False,DateUtils.SetDateAndTime(2022,8,17,14,0,0),DateUtils.SetDateAndTime(2022,8,17,16,0,0),True,ASSchedulerUtils.Recurring_Day,7)
ASSchedulerUtils.API.CreateAppointment(Appointment1)'insert appointment
ASSchedulerUtils.API.SQL.TransactionSuccessful
Catch
Log(LastException.Message)
#If B4I or B4J
ASSchedulerUtils.API.SQL.RollBack 'no changes will be made
#End If
End Try
#If B4A
ASSchedulerUtils.API.SQL.EndTransaction
#End If