Beispiel #1
0
        /// <summary>
        /// Loads and returns a record list of all Article objects.
        /// Parameters: itemsPerPage = max records to fetch; pageNum = one based page number if multiple pages (otherwise itemsPerPage is effectively TOP)
        /// eg LoadActive() = returns all records; LoadActive(10) = returns top 10 records by default sort order; LoadActive(10, 2) = returns second page of 10 records by default sort order
        /// ("Default sort order" can be defined for each record type by overriding in the partial model file. By default it looks for fields: SortPosition,SortOrder,Position, DateAdded,CreateDate,DateCreated and ArticleID desc.)
        /// </summary>
        public static ArticleList LoadAll()
        {
            var result = new ArticleList();

            result.LoadRecords(null);
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Returns a record list of Article objects, given a SQL statement.
        /// </summary>
        /// <param name="sql">A SQL statement constructed using the Beweb.Sql class</param>
        /// <returns>A list of Article records.</returns>
        public static ArticleList Load(Sql sql)
        {
            var result = new ArticleList();

            result.LoadRecords(sql);
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Loads all records which are active plus the one with the given ID. For situations where you want to only show active records except you also want to include the record that is already current.
        /// </summary>
        public static ArticleList LoadActivePlusExisting(object existingRecordID)
        {
            var result = new ArticleList();
            var sql    = (new Article()).GetSqlWhereActivePlusExisting(existingRecordID);

            result.LoadRecords(sql);
            return(result);
        }
Beispiel #4
0
        /// <summary>
        /// Loads and returns a record list of all the "active" Article objects.
        /// Parameters: itemsPerPage = max records to fetch; pageNum = one based page number if multiple pages (otherwise itemsPerPage is effectively TOP)
        /// eg LoadActive() = returns all active records; LoadActive(10) = returns top 10 active records by default sort order; LoadActive(10, 2) = returns second page of 10 active records by default sort order
        /// ("Active" can be defined for each record type by overriding in the partial model file. By default it looks for fields: PublishDate/ExpiryDate, IsActive,IsEnabled,IsPublished,Active,Enabled,Published,IsVisible,Visible.)
        /// </summary>
        public static ArticleList LoadActive()
        {
            var result = new ArticleList();
            var sql    = (new Article()).GetSqlWhereActive();

            result.LoadRecords(sql);
            return(result);
        }
Beispiel #5
0
        public static ArticleList LoadIDs(string[] ids, bool useDefaultOrderBy)
        {
            var sql    = new Sql("where ArticleID in (", ids.SqlizeNumberList(), ")");
            var result = new ArticleList();

            result.LoadRecords(sql, useDefaultOrderBy);
            return(result);
        }
Beispiel #6
0
        public static ArticleList LoadActive(int itemsPerPage, int pageNum)
        {
            var result = new ArticleList();
            var sql    = (new Article()).GetSqlWhereActive();

            sql.Paging(itemsPerPage, pageNum);
            result.LoadRecords(sql);
            return(result);
        }
Beispiel #7
0
        public static ArticleList LoadAll(int itemsPerPage, int pageNum)
        {
            var result = new ArticleList();
            var sql    = new Sql("where 1=1");

            sql.Paging(itemsPerPage, pageNum);
            result.LoadRecords(sql);
            return(result);
        }
Beispiel #8
0
        public ArticleList GetArticles()
        {
            var articles = new ArticleList();

            if (DisplayOrder == "Most Recent")
            {
                //articles = this.Articles.Active.OrderByDescending(a => a.PublishDate).ToList();
                articles = ArticleCache.Active.Where(a => a.PageID == PageID).OrderByDescending(a => a.PublishDate).ToList();
            }
            else if (DisplayOrder == "Sort Position")
            {
                //articles = this.Articles.Active.OrderBy(a => a.SortPosition).ToList();
                articles = ArticleCache.Active.Where(a => a.PageID == PageID).OrderBy(a => a.SortPosition).ToList();
            }
            return(articles);
        }