static void Main(string[] args)
        {
            int k            = 1;                                                      //flour
            int rest         = 0;                                                      //rest cubicles on flour
            int count        = 16;                                                     // number cubicles on one flour
            int cubicle      = 4;                                                      //number of person of cubicle
            int personInTeam = 7;                                                      // number of person in Team

            int[] data  = { 2, 3, 6, 8, 5 };                                           // enter data of teams
            int[] flour = new int[3];                                                  // number of cubicles on each flour
            flour = Enumerable.Repeat(count, 3).ToArray();
            int[] cubicles = Enumerable.Range(4, 64).Where(c => c % 4 == 0).ToArray(); //number cubicles on flour
            var   dic      = new Dictionary <int, int>();

            var container = AutofacConfig.ConfigureContainer(dic, cubicles, cubicle, personInTeam);

            using (var scope = container.BeginLifetimeScope())
            {
                IFillingData sp = scope.Resolve <IFillingData>();
                sp.AddCubicleToDictionary(data, cubicles, cubicle, personInTeam);
                //sp.AddDataManually(cubicles,cubicle,personInTeam) // enter data manually

                IFindingSpace sp2 = scope.Resolve <IFindingSpace>();
                sp2.Method(flour, k, rest);
            }
        }
        private void ConstructorHelper(IFillingData fillingData, ITableData tableData, IEnumerable <Reservation> reservations)
        {
            List <TableOccupation> newOccupations = new List <TableOccupation>();

            foreach (Reservation reservation in reservations)
            {
                newOccupations.Add(new TableOccupation(fillingData, tableData, reservation));
            }
            Occupations = newOccupations;
        }
        public TableOccupation(IFillingData fillingData, ITableData tableData, Reservation reservation)
        {
            ReservationId = reservation.Id;
            TableId       = reservation.TableId;
            TableNumber   = tableData.Get(TableId).Number;
            StartTime     = reservation.StartTime;
            Filling filling = fillingData.Get(reservation.FillingId);

            Duration = filling.DurationMinutes + filling.BufferMinutes;
        }
        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));
        }
 private TableOccupations(IFillingData fillingData, ITableData tableData, IEnumerable <Reservation> reservations)
 {
     ConstructorHelper(fillingData, tableData, reservations);
 }
        public TableOccupations(IFillingData fillingData, IReservationData reservationData, ITableData tableData)
        {
            IEnumerable <Reservation> reservations = reservationData.GetAllButOld();

            ConstructorHelper(fillingData, tableData, reservations);
        }
        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);
        }