Esempio n. 1
0
        //Trae reservas de ida
        public void GetFlightValidateIDaoTest()
        {
            int a = dao.AddReservationFlight(entity);

            var result = dao.GetFlightValidateI(1, 2, "2019-7-6 23:00", 1);

            Assert.IsInstanceOf <List <Entity> >(result);
        }
        public void Execute()
        {
            //try
            //{

            //Obtiene el DAO correspondiente por medio de las factories
            DAOFactory           factory      = DAOFactory.GetFactory(DAOFactory.Type.Postgres);
            ReservationFlightDAO ResFlightDao = factory.GetReservationFlightDAO();


            bool ida = ResFlightDao.FindLocation(this.Departure);
            bool idb = ResFlightDao.FindLocation(this.Arrival);

            if (!ida || !idb)
            {
                throw new ValidationErrorException("Una de las locaciones no existe");
            }

            //Valida que el número a reservar sea válido
            if (this.NumPas < 1)
            {
                throw new ValidationErrorException("El número de acientos a reservar es inválido");
            }


            ListFlight = ResFlightDao.GetFlightValidateI(this.Departure, this.Arrival, this.DepartureDate, this.NumPas);


            /* }
             * catch (ValidationErrorException ex)
             * {
             * throw new Exception(ex.Message);
             * }
             * catch(Exception ex)
             * {
             *  throw new Exception(ex.Message);
             * }*/
        }