public static List <Reserva> ListarReservasPorHabitacion(Habitacion hab)
        {
            SqlConnection cnn = new SqlConnection(Constantes.CONEXION);

            try
            {
                List <Reserva> ListaReservas = new List <Reserva>();
                SqlCommand     cmd           = new SqlCommand("ListarReservasPorHabitacion", cnn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@NombreHotel", hab.Hotel.NombreHotel);
                cmd.Parameters.AddWithValue("@NroHabitacion", hab.NroHabitacion);
                cnn.Open();
                SqlDataReader lector = cmd.ExecuteReader();
                while (lector.Read())
                {
                    //id, nom, nro, name, fi, ff, estado
                    Cliente cliente = PersistenciaClientes.Buscar((string)lector[3]);
                    Reserva res     = new Reserva(hab, cliente, (DateTime)lector[4], (DateTime)lector[5], (string)lector[6], (int)lector[0]);
                    ListaReservas.Add(res);
                }
                return(ListaReservas);
            }
            catch (Exception ex)
            { throw ex; }
            finally
            { cnn.Close(); }
        }
        public static List <Reserva> ListarReservasActivas()
        {
            List <Reserva> ListarReservas = new List <Reserva>();
            SqlConnection  cnn            = new SqlConnection(Constantes.CONEXION);

            try
            {
                SqlCommand cmd = new SqlCommand("ListarReservasActivas", cnn);
                cmd.CommandType = CommandType.StoredProcedure;
                cnn.Open();
                SqlDataReader lector = cmd.ExecuteReader();
                while (lector.Read())
                {
                    Hotel      hotel = PersistenciaHoteles.Buscar((string)lector[0]);
                    Habitacion hab   = PersistenciaHabitaciones.Buscar(hotel, (int)lector[1]);
                    Cliente    cli   = PersistenciaClientes.Buscar((string)lector[2]);
                    Reserva    res   = new Reserva(hab, cli, (DateTime)lector[3], (DateTime)lector[4], (string)lector[5], (int)lector[6]);
                    ListarReservas.Add(res);
                }
                return(ListarReservas);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            { cnn.Close(); }
        }
        public static Reserva Buscar(int id)
        {
            SqlConnection cnn = new SqlConnection(Constantes.CONEXION);
            Reserva       r   = null;

            try
            {
                SqlCommand cmd = new SqlCommand("BuscarReserva", cnn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@id", id);
                cnn.Open();
                SqlDataReader lector = cmd.ExecuteReader();
                if (lector.Read())
                {
                    Hotel      hotel = PersistenciaHoteles.Buscar((string)lector[1]);
                    Habitacion hab   = PersistenciaHabitaciones.Buscar(hotel, (int)lector[2]);
                    Cliente    cli   = PersistenciaClientes.Buscar((string)lector[3]);
                    r = new Reserva(hab, cli, (DateTime)lector[4], (DateTime)lector[5], (string)lector[6], (int)lector[0]);
                }
            }
            catch (Exception ex)
            { throw ex; }
            finally
            { cnn.Close(); }
            return(r);
        }