Пример #1
0
        private bool BuscarAsiento(Asiento asiento)
        {
            int filasAsientos    = this.Sala.Asientos.GetLength(0);
            int columnasAsientos = this.Sala.Asientos.GetLength(1);

            for (int i = 0; i < filasAsientos; i++)
            {
                for (int j = 0; j < columnasAsientos; j++)
                {
                    if (asiento == this.Sala.Asientos[i, j])
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #2
0
        public Entrada(Funcion func, Asiento seat, Cine cine)
        {
            this.Funcion      = func;
            this.Asiento      = seat;
            this.FechaEmision = DateTime.Now;

            if (this.Asiento.EsVip)
            {
                this.Precio = cine.PrecioEntradaVip;
            }
            else
            {
                this.Precio = cine.PrecioEntrada;
            }

            if (this.Funcion.FechaYHora.DayOfWeek == DayOfWeek.Wednesday || this.Funcion.FechaYHora.DayOfWeek == DayOfWeek.Thursday)
            {
                this.Precio /= 2;
            }
        }
Пример #3
0
        public bool IntentarOcuparAsiento(Asiento asiento)
        {
            if (asiento == null)
            {
                throw new ArgumentNullException("El asiento no puede ser nulo.");
            }

            if (!BuscarAsiento(asiento))
            {
                throw new ArgumentException("El asiento no corresponde a la sala de esta funcion.");
            }
            else
            {
                if (this.EstadoDeAsientos[asiento] == EstadoAsiento.Ocupado)
                {
                    return(false);
                }
                else
                {
                    this.EstadoDeAsientos[asiento] = EstadoAsiento.Ocupado;
                    return(true);
                }
            }
        }