I use the Calendar List for some room orders, everything is in order, but only struggles with Overlapp or double booking the room on the same day and time.
I am trying to figure out by passing the data entered by the user in the form to CAML Query and check if this record exists or not.
If the entry already exists, cancel the reservation or if it will not continue.
For example: if From: 10:00 AM to 11:00 AM already ordered.
overlap scenarios can be:
if the user enters the form From: 10:00 AM to 10:30 AM
From: 9:00 AM to 11:00. I guess the date is the same, and only time matters to me.
How to get a CAML request if the date is the same and only the time changes and checks the user input “From” and “B” when there are already reserved elements in the range.
using the request below but not checking for all scenarios
<Where><And><Geq><FieldRef Name='EventDate' /><Value IncludeTimeValue='TRUE' Type='DateTime'>" + strSPEventDateFormat + "</Value></Geq><And><Leq><FieldRef Name='EndDate' /><Value IncludeTimeValue='TRUE' Type='DateTime'>" + strSPEndDateFormat + "</Value></Leq><Eq><FieldRef Name='Room' /><Value Type='Lookup'>" + strCheckRoomAvail + "</Value></Eq></And></And></Where>
Please help me with this.
Thanks in advance
source
share