GetOldArticleId() public static méthode

public static GetOldArticleId ( int itemId ) : int
itemId int
Résultat int
Exemple #1
0
 private void Page_Load(object sender, EventArgs e)
 {
     try
     {
         LocalizeControls();
         if (_itemType != null)
         {
             //TODO: we need to figure out PortalID so we can get the folloing items from Cache
             if (_itemType.Equals(ItemType.Category.Name, StringComparison.OrdinalIgnoreCase))
             {
                 //TODO: where can we get portalid from? NEED NEW METHOD - HK
                 Category category = Category.GetCategory(_itemId);
                 DisplayItem(category);
             }
             else if (_itemType.Equals(ItemType.Article.Name, StringComparison.OrdinalIgnoreCase))
             {
                 Article article = Article.GetArticle(_itemId);
                 DisplayItem(article);
             }
             else if (_itemType.Equals("OLDARTICLE", StringComparison.OrdinalIgnoreCase))
             {
                 int     newId   = Article.GetOldArticleId(_itemId);
                 Article article = Article.GetArticle(newId);
                 DisplayItem(article);
             }
         }
     }
     catch (Exception ec)
     {
         DotNetNuke.Services.Exceptions.Exceptions.ProcessPageLoadException(ec);
     }
 }
Exemple #2
0
        public int ResolveId()
        {
            //TODO: Need to test this method with a database (children's) that has all the scenarios.
            //NOTE: At this point I'm not sure of the presedence here. The other issue is that within the
            //presedence issue there may be "exit" situations which is hard to control/debug. Need valid
            //test cases to further refactor.hk

            int id = -1;

            //there is an oldArticleId and displayOption is "Article"
            //NOTE: TO make these work you must verify that the mapping tables exists.
            //Publish_CategoryMapping
            //Columns:  NewItemId and OldArticleID
            //Publish_ArticleMapping
            //Columns: NewItemId and OldCateogryID

            if (PreviousArticleId != -1 && string.Compare(DisplayOption, "texthtml", StringComparison.OrdinalIgnoreCase) == 0)
            {
                id = ItemId;
            }

            //Verify that these tables have been populated correctly! hk
            if (PreviousArticleId != -1 && string.Compare(DisplayOption, "article", StringComparison.OrdinalIgnoreCase) == 0)
            {
                id = Article.GetOldArticleId(PreviousArticleId);
            }

            //there is an oldArticleID and displayOption is either "Title" or "Abstract"
            if (PreviousCategoryId != -1 && (string.Compare(DisplayOption, "title", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(DisplayOption, "abstract", StringComparison.OrdinalIgnoreCase) == 0))
            {
                id = Category.GetOldCategoryId(PreviousCategoryId);
            }

            //Old article ID passed in (aid).
            object oAid = HttpContext.Current.Request.QueryString["aid"];

            if (oAid != null)
            {
                id = Article.GetOldArticleId(Convert.ToInt32(oAid, CultureInfo.InvariantCulture));
            }

            //There is an ArticleId
            if (AdArticleId != -1 && DisplayType == "ArticleDisplay")
            {
                if (!IsOverrideable || (IsOverrideable && id == -1))
                {
                    id = AdArticleId;
                }
            }
            else if (AdArticleId != -1 && String.IsNullOrEmpty(DisplayType))
            {
                id = AdArticleId;
            }

            //There is a CategoryId
            if (CategoryId != -1 && (DisplayType == "CategoryDisplay" || DisplayType == "ItemListing" || DisplayType == "CategoryFeatureDisplay" || DisplayType == "CategorySearch" || DisplayType == "CategoryNLevels" || DisplayType == "CustomDisplay"))
            {
                if (!IsOverrideable || (IsOverrideable && id == -1))
                {
                    id = CategoryId;
                }
            }

            if (CategoryId != -1 && String.IsNullOrEmpty(DisplayType))
            {
                id = CategoryId;
            }

            return(id);
        }