Esempio n. 1
0
        public static ForumThreadInfoCollection GetThreads(int forumID, int pageSize, int pageIndex)
        {
            SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["RiversideInternetForumsConnectionString"]);
            SqlCommand    cmd  = new SqlCommand("WS_GetThreads", conn);

            // Populate parameters
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ForumID", SqlDbType.Int, 4);
            cmd.Parameters.Add("@PageSize", SqlDbType.Int, 4);
            cmd.Parameters.Add("@PageIndex", SqlDbType.Int, 4);
            cmd.Parameters[0].Value = forumID;
            cmd.Parameters[1].Value = pageSize;
            cmd.Parameters[2].Value = pageIndex;

            conn.Open();

            ForumThreadInfoCollection forumThreadInfoCollection = new ForumThreadInfoCollection();

            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                ForumThreadInfo forumThreadInfo = PopulateForumThreadInfo(dr);
                forumThreadInfoCollection.Add(forumThreadInfo);
            }

            dr.Close();
            conn.Close();

            return(forumThreadInfoCollection);
        }
        public static ForumThreadInfoCollection GetThreads(int forumID, int pageSize, int pageIndex)
        {
            SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["RiversideInternetForumsConnectionString"]);
            SqlCommand cmd = new SqlCommand("WS_GetThreads", conn);

            // Populate parameters
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ForumID", SqlDbType.Int, 4);
            cmd.Parameters.Add("@PageSize", SqlDbType.Int, 4);
            cmd.Parameters.Add("@PageIndex", SqlDbType.Int, 4);
            cmd.Parameters[0].Value = forumID;
            cmd.Parameters[1].Value = pageSize;
            cmd.Parameters[2].Value = pageIndex;

            conn.Open();

            ForumThreadInfoCollection forumThreadInfoCollection = new ForumThreadInfoCollection();

            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                ForumThreadInfo forumThreadInfo = PopulateForumThreadInfo(dr);
                forumThreadInfoCollection.Add(forumThreadInfo);
            }

            dr.Close();
            conn.Close();

            return forumThreadInfoCollection;
        }
Esempio n. 3
0
 public override void OnPreRender()
 {
     // Get threads that will be rendered and the total number of forum threads
     _forumThreadInfoCollection = ForumDB.GetThreads(ForumID, _threadsPerPage, _threadsPage);
     _threadCount = ForumDB.GetThreadCount(ForumID);
 }
 public override void OnPreRender()
 {
     // Get threads that will be rendered and the total number of forum threads
     _forumThreadInfoCollection = ForumDB.GetThreads(ForumID, _threadsPerPage, _threadsPage);
     _threadCount = ForumDB.GetThreadCount(ForumID);
 }