Exemplo n.º 1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Links = new List <Link>();
            LinkHelper LinkHelper = HelperFactory.GetHelper <LinkHelper>();

            if (tag.Contains(","))
            {
                tag = tag.Substring(0, tag.IndexOf(","));
            }
            if (DesignHelper.IsDesigning)
            {
                List <Link> links;
                DesignHelper.FillItems <Link>(out links, PageSize);
                foreach (Link link in links)
                {
                    link.Thumbnail = DesignHelper.GetTagThumbnail("small");
                }
                Links = links;
            }
            else
            {
                Links = LinkHelper.GetPagedAllLinks(0, PageSize, "", tag);
            }
            if (ColumnCount <= 0)
            {
                columnCount = PageSize;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 取得当前的文章
        /// </summary>
        /// <returns>文章实体</returns>
        protected virtual Article GetThisArticle()
        {
            Article article = null;

            Attachments = new List <Attachment>();
            if (DesignHelper.IsDesigning)
            {
                DesignHelper.FillItems <Article>(out article, PageSize);
                Attachments.Add(new Attachment()
                {
                    ArticleID = article.ID, FilePath = DesignHelper.GetAttachment()
                });
                Attachments.Add(new Attachment()
                {
                    ArticleID = article.ID, FilePath = DesignHelper.GetAttachment()
                });
                Attachments.Add(new Attachment()
                {
                    ArticleID = article.ID, FilePath = DesignHelper.GetAttachment()
                });
                Attachments.Add(new Attachment()
                {
                    ArticleID = article.ID, FilePath = DesignHelper.GetAttachment()
                });
            }
            else
            {
                if (We7Helper.IsEmptyID(BindColumnID) && !We7Helper.IsEmptyID(ArticleID))
                {
                    article = ArticleHelper.GetArticle(ArticleID, null);
                }
                else
                {
                    List <Article> articles = GetArticleListFromDB();
                    if (articles.Count > 0)
                    {
                        article = articles[0];
                    }
                }
            }

            if (article != null)
            {
                List <Article> list = new List <Article>();
                list.Add(article);
                FormatArticlesData(list);
                article = list[0];
                if (AttachmentNum > 0)
                {
                    Attachments = AttachmentHelper.GetAttachments(article.ID);
                }
            }
            else
            {
                article = new Article();
            }

            return(article);
        }
Exemplo n.º 3
0
 protected override void OnLoad(EventArgs e)
 {
     //0为显示全部
     base.OnLoad(e);
     Articles = new List <Article>();
     if (DesignHelper.IsDesigning)
     {
         List <Article> result;
         RecordCount = DesignHelper.FillItems(out result, PageSize);
         Articles    = result;
     } //if (DesignHelper.IsDesigning) true
     else
     {
         if (!string.IsNullOrEmpty(RssUrl))
         {
             Articles = ProcessRSSItem(RssUrl);
         }
     } //if (DesignHelper.IsDesigning) false
 }
Exemplo n.º 4
0
        /// <summary>
        /// 取得数据列表
        /// </summary>
        /// <returns>文章列表</returns>
        List <Article> GetArticleList(Channel ch)
        {
            ArticleQuery   query = new ArticleQuery();
            List <Article> list  = new List <Article>();

            if (DesignHelper.IsDesigning)
            {
                RecordCount = DesignHelper.FillItems(out list, PageSize);
            }
            else
            {
                query.ChannelID      = ch.ID;
                query.ChannelFullUrl = ch.FullUrl;
                query.IncludeAllSons = true;

                query.State      = ArticleStates.Started;
                query.IsShowHome = ShowAtHome ? "1" : "";

                if (!String.IsNullOrEmpty(ArticleOrderFields))
                {
                    query.OrderKeys = ArticleOrderFields;
                }
                else
                {
                    query.OrderKeys = "Updated|Desc";
                }

                query.Overdue = true;
                if (ArticleTag != null && ArticleTag.Length > 0)
                {
                    query.Tag = ArticleTag;
                }

                list = ArticleHelper.QueryArtilcesByAll(query, 0, PageSize, null);
            }
            return(list);
        }