Exemple #1
0
            ///<summary>Returns true if the time length requested will fit in the time slot and there are no other appointments in the slot.</summary>
            public bool IsApptSlotAvailable(int minutes, long opNum, DateTime slotStart, DateTime slotEnd)
            {
                if (!_listDateOps.Any(x => x.Item1 == slotStart.Date && x.Item2 == opNum))
                {
                    _listAppts.AddRange(Appointments.GetApptsForDatesOps(new List <ODTuple <DateTime, long> > {
                        new ODTuple <DateTime, long>(slotStart.Date, opNum)
                    }));
                    _listDateOps.Add(new Tuple <DateTime, long>(slotStart.Date, opNum));
                }
                DateTime newSlotEnd = ODMathLib.Min(slotStart.AddMinutes(minutes), slotEnd);

                if (_listAppts.Where(x => x.Op == opNum)
                    .Any(x => MiscUtils.DoSlotsOverlap(x.AptDateTime, x.AptDateTime.AddMinutes(x.Length), slotStart, newSlotEnd)))
                {
                    return(false);
                }
                return(true);
            }