Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147276 | Sep 5,2019 04:10 AM UTC | Sep 6,2019 12:07 PM UTC | Xamarin.Forms | 1 |
![]() |
Tags: SfSchedule |
[C#]
private void Button_Clicked(object sender, EventArgs e)
{
ScheduleAppointment appointment = new ScheduleAppointment()
{
StartTime = new DateTime(2019, 09, 05, 10, 0, 0),
EndTime = new DateTime(2019, 09, 05, 12, 0, 0),
Subject = "Meeting",
};
var AppointmentAlreadyExist = (schedule.DataSource as ScheduleAppointmentCollection).Any(x => x.StartTime.Year == appointment.StartTime.Year
&& x.StartTime.Month == appointment.StartTime.Month
&& x.StartTime.Date == appointment.StartTime.Date && ((x.StartTime.Hour <= appointment.StartTime.Hour && x.EndTime.Hour >= appointment.StartTime.Hour) || (x.StartTime.Hour <= appointment.EndTime.Hour && x.EndTime.Hour >= appointment.EndTime.Hour)));
if (!AppointmentAlreadyExist)
(schedule.DataSource as ScheduleAppointmentCollection).Add(appointment);
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.