/// <summary> /// I check the overlapping in this method. (Two appointments cant cover each other.) /// </summary> /// <param name="appointment"></param> /// <returns></returns> private static bool CheckForOverlapping(SchedulerReservations appointment) { AppointmentBL appBL = new AppointmentBL(); List <BOL.APPOINTMENTS> newappointments = appBL.GetAll().Where(x => x.StartDate > DateTime.Now).ToList(); foreach (var item in newappointments) { if (item.StartDate <= appointment.End && appointment.Start <= item.EndDate) { return(false); } } return(true); }
/// <summary> /// In this method I use the classconverter class, which can convert a APPOINTMENTS (DbSet) object to SchedulerReservations object. /// This SchedulerReservations object is implemented the ISchedulerEvent interface, which is needed to the Kendo Scheduler. /// </summary> /// <param name="request"></param> /// <returns></returns> public virtual JsonResult Read([DataSourceRequest] DataSourceRequest request) { reservations = ClassConverter.ClassConverter.ConvertToSchedulerReservation(appBL.GetAll().ToList()); return(Json(reservations.ToDataSourceResult(request))); }
/// <summary> /// This method calculate the next appointment ID /// </summary> /// <returns></returns> private static int CalculateAppointmentID() { AppointmentBL bl = new AppointmentBL(); return(bl.GetAll().Last().ID + 1); }