banner ad
We are excited to announce that the ASP.NET Forums are moving to the new Microsoft Q&A experience. Learn more >
ASP.NET Forums/Retired Forums/Community Starter Kit (RETIRED)/HOWTO: Create webboxes that display new or popular items based on the...

HOWTO: Create webboxes that display new or popular items based on the current section RSS

1 reply

Last post Aug 26, 2003 10:49 AM by kanati

  • kanati kanati

    None

    0 Points

    141 Posts

    Re: HOWTO: Create webboxes that display new or popular items based on the current section

    Aug 26, 2003 10:49 AM|kanati|LINK

    To help make things even easier... STEP 2 for popular content CREATEPROCEDURE Community_GetPopularSectionContent ( @communityID int, @pageTypeName NVarchar(50), @sectionID int ) AS DECLARE @pageType INT SET @pageType = dbo.Community_GetPageTypeFromName(@pageTypeName) DECLARE @currentDate DateTime SET @currentDate = GetUtcDate() SELECT TOP 3 Content.* FROM dbo.Community_GetContentItem(@communityID, 0, @currentDate) Content JOIN Community_ContentPages CP ON Content.ContentPage_ID = CP.ContentPage_ID WHERE CP.ContentPage_PageType = @pageType AND CP.ContentPage_SectionID = @sectionID AND dbo.Community_IsContentVisible(CP.ContentPage_ModerationStatus, CP.ContentPage_DateVisible, GetUtcDate() ) = 1 AND dbo.Community_IsContentPublic(@communityID, @sectionID) = 1 ORDER BY Content.ContentPage_ViewCount DESC Step3 for popular content //********************************************************************* // // GetPopularSectionContent Method // // Retrieves the most viewed content added to this community // of a particular type within the specified section. // //********************************************************************* public static ArrayList GetPopularSectionContent(string pageTypeName,int sectionID) { ArrayList colContent = new ArrayList(); SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString); SqlCommand cmdGet = new SqlCommand("Community_GetPopularSectionContent", conPortal); cmdGet.CommandType = CommandType.StoredProcedure; cmdGet.Parameters.Add("@communityID", CommunityGlobals.CommunityID); cmdGet.Parameters.Add("@pageTypeName", pageTypeName); cmdGet.Parameters.Add("@sectionID", sectionID); conPortal.Open(); SqlDataReader dr = cmdGet.ExecuteReader(); while (dr.Read()) colContent.Add(new ContentInfo(dr)); conPortal.Close(); return colContent; }
  • ‹ Previous Thread|Next Thread ›