Пример #1
0
    private void DisplaySideLinks()
    {
        if (!articleData.ParentId.HasValue)
        {
            return;
        }

        Guid parentId = articleData.ParentId.Value;

        if (articleData.ArticleLevelNo > 1)
        {
            // change to parentId of parent
            ArticleForFrontend parent = artPub.GetArticleDataForFrontend(parentId, c.qsCultureNameOfLangNo);

            if (parent != null)
            {
                parentId = parent.ParentId.Value;
            }
        }

        List <ArticleForFESideSection> sideLinks = artPub.GetArticleValidListForSideSection(parentId, c.qsCultureNameOfLangNo);

        if (sideLinks != null)
        {
            rptSideLinks.DataSource = sideLinks;
            rptSideLinks.DataBind();
        }
    }
Пример #2
0
        /// <summary>
        /// Retrieve article data by ArticleId
        /// </summary>
        protected bool RetrieveArticleData()
        {
            bool result = false;

            if (!articleData.ArticleId.HasValue)
            {
                return(result);
            }

            ArticleForFrontend article = artPub.GetArticleDataForFrontend(articleData.ArticleId.Value, qsCultureNameOfLangNo);

            if (article != null)
            {
                bool isValid = false;

                if (isPreviewMode)
                {
                    isValid = true;
                }
                else
                {
                    // check validation date, isHideSelf, isShowInLang
                    DateTime startDate    = article.StartDate.Value;
                    DateTime endDate      = article.EndDate.Value;
                    bool     isHideSelf   = article.IsHideSelf;
                    bool     isShowInLang = article.IsShowInLang;

                    if (startDate <= DateTime.Today && DateTime.Today <= endDate &&
                        !isHideSelf &&
                        isShowInLang)
                    {
                        isValid = true;
                    }
                    else
                    {
                        logger.DebugFormat("The article (id:[{0}]) that client requires is disabled.", articleData.ArticleId);
                    }
                }

                if (isValid)
                {
                    try
                    {
                        articleData.ImportDataFrom(article);
                        articleData.IsPreviewMode = isPreviewMode;

                        // get top level id's
                        ArticleTopLevelIds topLevelIds = artPub.GetArticleTopLevelIds(articleData.ArticleId.Value);

                        if (topLevelIds != null)
                        {
                            articleData.Lv1Id = topLevelIds.Lv1Id;
                            articleData.Lv2Id = topLevelIds.Lv2Id;
                            articleData.Lv3Id = topLevelIds.Lv3Id;
                        }
                        else
                        {
                            throw new Exception("dsTopLevelIds is empty");
                        }

                        result = true;
                    }
                    catch (Exception ex)
                    {
                        logger.Error(string.Format("Import data to ArticleData failed (id:[{0}]).", articleData.ArticleId), ex);
                    }
                }
            }
            else
            {
                logger.DebugFormat("Article data (id:[{0}]) is empty.", articleData.ArticleId);
            }

            return(result);
        }