internal Queue <Comentarios> ComentariosdeNoticia(int cid) { SqlConnection _cnn = new SqlConnection(Conexion.Cnn); Comentarios objcom = null; Queue <Comentarios> _lista = new Queue <Comentarios>(); SqlCommand _comando = new SqlCommand("ListarComentariosNoticia", _cnn); _comando.CommandType = System.Data.CommandType.StoredProcedure; _comando.Parameters.AddWithValue("@id", cid); try { _cnn.Open(); SqlDataReader _lector = _comando.ExecuteReader(); if (_lector.HasRows) { while (_lector.Read()) { int idcom = (int)_lector["IdComentario"]; long Ndoc = (long)_lector["Ndoc"]; string textocomentario = (string)_lector["Comentario"]; Lector L = PersistenciaLector.GetInstancia().Buscar(Ndoc); objcom = new Comentarios(idcom, L, textocomentario); _lista.Enqueue(objcom); } } _lector.Close(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { _cnn.Close(); } return(_lista); }
public static IPersistenciaLector getPLector() { return(PersistenciaLector.GetInstancia()); }