⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contentpageutility.cs

📁 ASP开发网站的 关于网站的设计和说明 还有SQL的程序 数据库
💻 CS
📖 第 1 页 / 共 2 页
字号:
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add( "@communityID", CommunityGlobals.CommunityID);
            cmd.Parameters.Add( "@contentPageID", contentPageID );
            cmd.Parameters.Add( "@moderationStatus", (int)moderationStatus );
            cmd.Parameters.Add( "@sectionID", sectionID );
            
            conPortal.Open();
            cmd.ExecuteNonQuery();
            conPortal.Close();
        }


 
        //*********************************************************************
        //
        // CalculateMetaDescription Method
        //
        // Truncates description to 250 characters.
        //
        //*********************************************************************
 
        public static string CalculateMetaDescription(string description) {
            return CommunityGlobals.Truncate(HttpUtility.HtmlEncode(description), 250);
        }


        //*********************************************************************
        //
        // CalculateMetaKeys Method
        //
        // Truncates description to 200 characters and splits into separate
        // words.
        //
        //*********************************************************************
 
        public static string CalculateMetaKeys(string metaKeys) {
            string keys = CommunityGlobals.Truncate(HttpUtility.HtmlEncode(metaKeys), 200);
            MatchCollection words = Regex.Matches(keys, @"\w+" );
            
            string joinKeys = String.Empty;
            foreach (Match word in words)
                joinKeys += word.Value + ",";
            joinKeys.TrimEnd(',');
            return joinKeys;
        }



        //*********************************************************************
        //
        // CalculateContentPath Method
        //
        // This method returns the relative path of a content page 
        // (including the section path). This method is used, for example,
        // by the Topic page to generate the path to a content page.
        //
        //*********************************************************************
         
        public static string CalculateContentPath(int sectionID, int contentID) {
            string path = SectionUtility.GetSectionPath(sectionID);
            path = path.Remove( path.LastIndexOf("/"), path.Length - path.LastIndexOf( "/" ) );
            return String.Format("{0}/{1}.aspx", path, contentID );
        }
        

        //*********************************************************************
        //
        // CalculateFullContentPath Method
        //
        // This method generates the absolute path to a content page. It
        // includes the domain information for the path.
        //
        //*********************************************************************
         
        public static string CalculateFullContentPath(int sectionID, int contentID) {
            string path = CalculateContentPath(sectionID, contentID);
            return CommunityGlobals.ResolveAbsoluteUrl(path);
        
        }        
        

    
    
        //*********************************************************************
        //
        // GetNewContent Method
        //
        // Retrieves the latest content added to this community
        // of a particular type.
        //
        //*********************************************************************
 
		//rs mod : added userName

		public static ArrayList GetNewContent(string pageTypeName) 
		{
			return GetNewContent(pageTypeName,"");
		}

		public static ArrayList GetNewContent(string pageTypeName, string userName) 
		{
			ArrayList colContent = new ArrayList();
        
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand cmdGet = new SqlCommand("Community_GetNewContent", conPortal);
			cmdGet.CommandType = CommandType.StoredProcedure;
			cmdGet.Parameters.Add("@communityID", CommunityGlobals.CommunityID);
			cmdGet.Parameters.Add("@pageTypeName", pageTypeName);
			cmdGet.Parameters.Add("@userName", userName);
			conPortal.Open();

			SqlDataReader dr = cmdGet.ExecuteReader();
			while (dr.Read())
				colContent.Add(new ContentInfo(dr));                      
			conPortal.Close();
          
			return colContent;  
		}
		
		//end rs

        

        //*********************************************************************
        //
        // GetPopularContent Method
        //
        // Retrieves the most viewed content added to this community
        // of a particular type.
        //
        //*********************************************************************
         
		//rs mod : added userName

		public static ArrayList GetPopularContent(string pageTypeName) 
		{
			return GetPopularContent(pageTypeName, "");
		}
		
		public static ArrayList GetPopularContent(string pageTypeName, string userName) 
		{
			ArrayList colContent = new ArrayList();
        
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand cmdGet = new SqlCommand("Community_GetPopularContent", conPortal);
			cmdGet.CommandType = CommandType.StoredProcedure;
			cmdGet.Parameters.Add("@communityID", CommunityGlobals.CommunityID);
			cmdGet.Parameters.Add("@pageTypeName", pageTypeName);
			cmdGet.Parameters.Add("@userName", userName);
			conPortal.Open();

			SqlDataReader dr = cmdGet.ExecuteReader();
			while (dr.Read())
				colContent.Add(new ContentInfo(dr));                      
			conPortal.Close();
          
			return colContent;  
		}

		// end rs

        //*********************************************************************
        //
        // MoveContentUp Method
        //
        // Used when sorting content to move content up. 
        //
        //*********************************************************************

        public static void MoveContentUp(int contentPageID) {
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand cmd = new SqlCommand("Community_ContentPagesMoveContentUp", conPortal);
			cmd.CommandType = CommandType.StoredProcedure;

			cmd.Parameters.Add("@contentPageID", contentPageID);
			conPortal.Open();
			cmd.ExecuteNonQuery();
			conPortal.Close();
        }

        //*********************************************************************
        //
        // MoveContentDown Method
        //
        // Used when sorting content to move content down. 
        //
        //*********************************************************************

        public static void MoveContentDown(int contentPageID) {
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand cmd = new SqlCommand("Community_ContentPagesMoveContentDown", conPortal);
			cmd.CommandType = CommandType.StoredProcedure;

			cmd.Parameters.Add("@contentPageID", contentPageID);

			conPortal.Open();
			cmd.ExecuteNonQuery();
			conPortal.Close();
        }




    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -