Exemplo n.º 1
0
        public static TableOccupations GetActiveOccupations(IFillingData fillingData, IReservationData reservationData, ITableData tableData)
        {
            DateTime now       = DateTime.Now;
            int      nowMinute = now.Hour * minutesInHour + now.Minute;

            Func <Filling, Reservation, bool> isActive = (Filling filling, Reservation reservation) =>
            {
                int reservationStartMinute = reservation.StartTime.Hour * minutesInHour + reservation.StartTime.Minute;
                return(reservationStartMinute <= nowMinute && reservationStartMinute + filling.DurationMinutes + filling.BufferMinutes >= nowMinute);
            };
            IEnumerable <Reservation> reservations = reservationData.GetAllOnDay(now.Year, now.Month, now.Day).Where(o => isActive(fillingData.Get(o.FillingId), o));

            return(new TableOccupations(fillingData, tableData, reservations));
        }
Exemplo n.º 2
0
        public ItemsPerTable(IReservationData reservationData, IReservationItemData reservationItemData, ITableData tableData, IItemData itemData, bool prepared, bool delivered, int?stationId = null)
        {
            DateTime today = DateTime.Now;
            IEnumerable <Reservation> reservations = reservationData.GetAllOnDay(today.Year, today.Month, today.Day);
            List <ItemsOfReservation> newItems     = new List <ItemsOfReservation>();

            foreach (Reservation reservation in reservations)
            {
                ItemsOfReservation newItemsOfReservation = new ItemsOfReservation(reservationItemData, tableData, itemData, reservation, prepared, delivered, stationId);
                if (newItemsOfReservation.Items.Count() > 0)
                {
                    newItems.Add(newItemsOfReservation);
                }
            }
            Items = newItems;
        }
Exemplo n.º 3
0
        public TableOccupations(IFillingData fillingData, IReservationData reservationData, ITableData tableData, int year, int month, int day)
        {
            IEnumerable <Reservation> reservations = reservationData.GetAllOnDay(year, month, day);

            ConstructorHelper(fillingData, tableData, reservations);
        }