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)); }
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; }
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); }