Esempio n. 1
0
 public MovieTheater(int qtdRow, int qtdCol)
     : this()
 {
     QtdCol      = qtdCol;
     QtdRow      = qtdRow;
     _arrayChair = new Chair[qtdRow][];
     for (int i = 0; i < qtdRow; i++)
     {
         _arrayChair[i] = new Chair[qtdCol];
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Adiciona uma cadeira ao MovieTheater
        /// </summary>
        /// <param name="chair">Recebe UM Chair</param>
        /// <exception cref="ArgumentOutOfRangeException">Se a numeração da cadeira for maior do que o tamanho da sala essa exceção é lançada</exception>
        /// <exception cref="DbUpdateException">Caso a cadeira já exista no sistema a exceção é lançada.</exception>
        public void AddChair(Chair chair)
        {
            if (chair.Row >= QtdRow || chair.Col >= QtdCol)
            {
                throw new ArgumentOutOfRangeException("The chair numeration is bigger than the size of the MovieTheater");
            }

            if (_arrayChair[chair.Row][chair.Col] == null)
            {
                _arrayChair[chair.Row][chair.Col] = chair;
            }
            else
            {
                throw new DbUpdateException($"Chair ({chair.Row},{chair.Col}) already exist, Try another", new ArgumentException());
            }
        }