Beispiel #1
0
 public static PersistenciaPeriodista GetInstancia()
 {
     if (_instancia == null)
     {
         _instancia = new PersistenciaPeriodista();
     }
     return(_instancia);
 }
Beispiel #2
0
        private static Fuente BuscarFuente(int idF)
        {
            Fuente f = PersistenciaPeriodista.BuscarPeriodista(idF);

            if (f == null)
            {
                f = PersistenciaAgencia.BuscarAgencia(idF);
            }
            return(f);
        }
        public List <Noticias> ListadoNoticiasPeriodistaXML(Periodista P)
        {
            SqlConnection _cnn     = new SqlConnection(Conexion.Cnn);
            SqlCommand    _comando = new SqlCommand("ListadoNoticiasPeriodistaXML", _cnn);

            _comando.Parameters.AddWithValue("@NomPeriodista", P.NomPeriodista);
            _comando.CommandType = CommandType.StoredProcedure;
            List <Noticias> _Lista    = new List <Noticias>();
            Noticias        noticiass = null;

            try
            {
                _cnn.Open();


                SqlDataReader _lector = _comando.ExecuteReader();


                if (_lector.HasRows)
                {
                    while (_lector.Read())
                    {
                        int        id            = (int)_lector["IdNoticia"];
                        string     titulo        = (string)_lector["Titulo"];
                        string     resumen       = (string)_lector["Resumen"];
                        string     cuerponoticia = (string)_lector["CuerpoNoticia"];
                        bool       relevante     = (bool)_lector["Relevante"];
                        string     categoria     = (string)_lector["Categoria"];
                        string     nomperiodista = (string)_lector["NomPeriodista"];
                        DateTime   fechacreacion = (DateTime)_lector["FechaHoraCreacion"];
                        Periodista objPeriodista = PersistenciaPeriodista.GetInstancia().BuscoSBAJA(nomperiodista);
                        noticiass = new Noticias(id, titulo, resumen, cuerponoticia, relevante, fechacreacion, objPeriodista, categoria, ComentariosdeNoticia(id));
                        _Lista.Add(noticiass);
                    }
                }

                _lector.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _cnn.Close();
            }


            return(_Lista);
        }
 public static IPersistenciaPeriodista getPPeriodista()
 {
     return(PersistenciaPeriodista.GetInstancia());
 }