Ejemplo n.º 1
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);
        }