コード例 #1
0
        /// <summary>
        /// Obtiene una lista de comentarios
        /// </summary>
        /// <returns>Comentario Lista</returns>
        public static ComentarioList Get()
        {
            ComentarioList lista = null;

            try
            {
                lista = ComentarioListDal.Get();
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(lista);
        }
コード例 #2
0
        public static ComentarioList Get()
        {
            ComentarioList res = new ComentarioList();

            SqlCommand    cmd = null;
            SqlDataReader dr  = null;

            string query = "SELECT * FROM Comentario";

            try
            {
                cmd = Methods.CreateBasicCommand(query);
                dr  = Methods.ExecuteDataReaderCommand(cmd);

                while (dr.Read())
                {
                    int        idComentario = dr.GetInt32(0);
                    Comentario comentario   = ComentarioDal.Get(idComentario);

                    res.Add(new Comentario()
                    {
                        ComentarioId   = idComentario,
                        UsuarioId      = comentario.UsuarioId,
                        Comentariotext = comentario.Comentariotext,
                    });
                }
            }
            catch (SqlException ex)
            {
                //Methods.GenerateLogsRelease("KeyValuePacienteListDal", "Obtener", ex.Message + " " + ex.StackTrace);
                throw ex;
            }
            catch (Exception ex)
            {
                //Methods.GenerateLogsRelease("KeyValuePacienteListDal", "Obtener", ex.Message + " " + ex.StackTrace);
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(res);
        }