Exemplo n.º 1
0
        public override List <ArticleAttachment> GetAllArticleAttachments()
        {
            using (IDataReader dr = DataHelper.ExecuteReader(CommandType.StoredProcedure, "sp_ArticleAttachment_GetAll"))
            {
                List <ArticleAttachment> result = new List <ArticleAttachment>();
                for (; dr.Read();)
                {
                    ArticleAttachment article = ArticleReaderConverter.ParseArticleAttachment(dr);
                    result.Add(article);
                }

                return(result);
            }
        }
Exemplo n.º 2
0
        public override ArticleAttachment GetArticleAttachment(int id)
        {
            ELParameter idParam = new ELParameter("@AttachmentID", DbType.Int32);

            idParam.Value = id;

            using (IDataReader dr = DataHelper.ExecuteReader(CommandType.StoredProcedure, "sp_ArticleAttachment_Get", idParam))
            {
                ArticleAttachment result = null;
                if (dr.Read())
                {
                    result = ArticleReaderConverter.ParseArticleAttachment(dr);
                }

                return(result);
            }
        }
Exemplo n.º 3
0
        public override List <ArticleAttachment> GetAllArticleAttachments(AttachmentQuery query, out int totalRecord)
        {
            ELParameter[] elParameters = new ELParameter[] {
                new ELParameter("@PageIndex", DbType.Int32, DataHelper.GetSafeSqlInt(query.PageIndex)),
                new ELParameter("@PageSize", DbType.Int32, DataHelper.GetSafeSqlInt(query.PageSize)),
                new ELParameter("@SqlPopulate", DbType.String, QueryGenerator.BuildAttachmentQuery(query))
            };

            using (IDataReader dr = DataHelper.ExecuteReader(CommandType.StoredProcedure, "sp_ArticleAttachments_Get", elParameters))
            {
                List <ArticleAttachment> attachmentList = new List <ArticleAttachment>();
                while (dr.Read())
                {
                    attachmentList.Add(ArticleReaderConverter.ParseArticleAttachment(dr));
                }

                dr.NextResult();
                dr.Read();
                totalRecord = DataRecordHelper.GetInt32(dr, 0);

                return(attachmentList);
            }
        }