Ejemplo n.º 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);
            }
Ejemplo n.º 2
0
 ///<summary>This constructor will store the appointments for the passed in dates and operatories.</summary>
 ///<param name="listDateOps">DateTime is the AptDate, long is the OperatoryNum.</param>
 public ApptAvailabilityChecker(List <ODTuple <DateTime, long> > listDateOps)
 {
     _listDateOps = listDateOps;
     _listAppts   = Appointments.GetApptsForDatesOps(listDateOps);
 }