/// <summary>
    /// Gets and bulk updates forum posts. Called when the "Get and bulk update posts" button is pressed.
    /// Expects the CreateForumPost method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateForumPosts()
    {
        // Prepare the parameters
        string where = "PostSubject LIKE N'My new post%'";
        string orderBy = "";
        string columns = "";
        int    topN    = 10;

        // Get the data
        DataSet posts = ForumPostInfoProvider.GetForumPosts(where, orderBy, topN, columns);

        if (!DataHelper.DataSourceIsEmpty(posts))
        {
            // Loop through the individual items
            foreach (DataRow postDr in posts.Tables[0].Rows)
            {
                // Create object from DataRow
                ForumPostInfo modifyPost = new ForumPostInfo(postDr);

                // Update the properties
                modifyPost.PostSubject = modifyPost.PostSubject.ToUpper();

                // Save the changes
                ForumPostInfoProvider.SetForumPostInfo(modifyPost);
            }

            return(true);
        }

        return(false);
    }
    /// <summary>
    /// Gets and updates forum post. Called when the "Get and update post" button is pressed.
    /// Expects the CreateForumPost method to be run first.
    /// </summary>
    private bool GetAndUpdateForumPost()
    {
        // Prepare the parameters
        string where = "PostSubject LIKE N'My new post%'";
        string orderBy = "";
        string columns = "";
        int    topN    = 10;

        // Get the data
        DataSet posts = ForumPostInfoProvider.GetForumPosts(where, orderBy, topN, columns);

        if (!DataHelper.DataSourceIsEmpty(posts))
        {
            ForumPostInfo updatePost = new ForumPostInfo(posts.Tables[0].Rows[0]);

            // Update the properties
            updatePost.PostSubject = updatePost.PostSubject.ToLower();

            // Save the changes
            ForumPostInfoProvider.SetForumPostInfo(updatePost);

            return(true);
        }

        return(false);
    }
Esempio n. 3
0
    DataSet postSubscription_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        string where = "PostId IN (SELECT SubscriptionPostID FROM Forums_ForumSubscription WHERE (SubscriptionUserID = " + UserID + ") AND (ISNULL(SubscriptionApproved, 1) = 1)) AND (PostApproved = 1)";
        if (!String.IsNullOrEmpty(completeWhere))
        {
            where += " AND (" + completeWhere + ")";
        }

        DataSet ds = ForumPostInfoProvider.GetForumPosts(where, "PostSubject", 0, "PostID, PostForumID, PostSubject");

        totalRecords = DataHelper.GetItemsCount(ds);
        return(ds);
    }
    /// <summary>
    /// Deletes forum post. Called when the "Delete post" button is pressed.
    /// Expects the CreateForumPost method to be run first.
    /// </summary>
    private bool DeleteForumPost()
    {
        // Prepare the parameters
        string where = "PostSubject LIKE N'My new post%'";
        string orderBy = "";
        string columns = "";
        int    topN    = 10;

        // Get the data
        DataSet posts = ForumPostInfoProvider.GetForumPosts(where, orderBy, topN, columns);

        if (!DataHelper.DataSourceIsEmpty(posts))
        {
            // Get the forum post
            ForumPostInfo deletePost = new ForumPostInfo(posts.Tables[0].Rows[0]);

            // Delete the forum post
            ForumPostInfoProvider.DeleteForumPostInfo(deletePost);

            return(true);
        }

        return(false);
    }