Пример #1
0
        private void CreatePlaces()
        {
            ListOfPlacesInHalls placesList;
            ReadingFromDateBase reading = new ReadingFromDateBase();

            placesList = reading.ReadAllPlacesOfAllHalls();
            int placeId = 1;

            if (placesList.Places.Count != 0)
            {
                placeId = placesList.Places.Count + 1;
            }
            bool notEven         = false;
            int  leftPlaces      = SeatingCapacity % PlacesInRow;
            int  tempPlacesInRow = PlacesInRow;
            int  rows            = 0;

            if (leftPlaces != 0)
            {
                notEven = true;
                rows    = (SeatingCapacity / PlacesInRow) + 1;
            }
            else
            {
                rows = SeatingCapacity / PlacesInRow;
            }
            for (int i = 1; i <= rows; i++)
            {
                if (i == rows && notEven)
                {
                    tempPlacesInRow = leftPlaces;
                }
                for (int j = 1; j <= tempPlacesInRow; j++)
                {
                    PlaceInHall place = new PlaceInHall(placeId, HallId, i, j);
                    Places.Add(place);
                }
            }
        }
Пример #2
0
        public void AddPlacesInHall(int placeId, int hall, int row, int placeNumber)
        {
            PlaceInHall place = new PlaceInHall(placeId, hall, row, placeNumber);

            Places.Add(place);
        }