protected DataSet gridComments_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        string whereCondition     = String.Empty;
        string blogWhereCondition = String.Empty;

        if (ShowFilter)
        {
            whereCondition     = filterElem.CommentWhereCondition;
            blogWhereCondition = filterElem.BlogWhereCondition;
        }
        else
        {
            whereCondition     = CommentWhereCondition;
            blogWhereCondition = BlogWhereCondition;
        }

        // All sites
        if (SiteName == "-1")
        {
            SiteName = TreeProvider.ALL_SITES;
        }

        // Set the current site if the siteName is not defined
        if (String.IsNullOrEmpty(SiteName))
        {
            SiteName = SiteContext.CurrentSiteName;
        }
        return(BlogCommentInfoProvider.GetComments(0, null, whereCondition, blogWhereCondition, columns, currentTopN, currentOrder, currentOffset, currentPageSize, ref totalRecords, SiteName));
    }
Exemple #2
0
    /// <summary>
    /// Gets and bulk updates blog comments. Called when the "Get and bulk update comments" button is pressed.
    /// Expects the CreateBlogComment method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateBlogComments()
    {
        // Prepare the parameters
        string where = "CommentText LIKE 'My new%'";
        string blogWhere = "NodeName LIKE 'MyNewBlog%'";

        // Get the data
        DataSet comments = BlogCommentInfoProvider.GetComments(where, blogWhere);
        if (!DataHelper.DataSourceIsEmpty(comments))
        {
            // Loop through the individual items
            foreach (DataRow commentDr in comments.Tables[0].Rows)
            {
                // Create object from DataRow
                BlogCommentInfo modifyComment = new BlogCommentInfo(commentDr);

                // Update the properties
                modifyComment.CommentText = modifyComment.CommentText.ToUpper();

                // Update the blog comment
                BlogCommentInfoProvider.SetBlogCommentInfo(modifyComment);
            }

            return true;
        }

        return false;
    }
Exemple #3
0
    /// <summary>
    /// Gets and updates blog comment. Called when the "Get and update comment" button is pressed.
    /// Expects the CreateBlogComment method to be run first.
    /// </summary>
    private bool GetAndUpdateBlogComment()
    {
        // Prepare the parameters
        string where = "CommentText LIKE 'My New%'";
        string blogWhere = "BlogName LIKE 'MyNewBlog%'";

        // Get the blog comment
        DataSet comments = BlogCommentInfoProvider.GetComments(where, blogWhere);

        if (!DataHelper.DataSourceIsEmpty(comments))
        {
            // Create object from DataRow
            BlogCommentInfo modifyComment = new BlogCommentInfo(comments.Tables[0].Rows[0]);

            // Update the property
            modifyComment.CommentText = modifyComment.CommentText.ToUpper();

            // Update the blog comment
            BlogCommentInfoProvider.SetBlogCommentInfo(modifyComment);

            return(true);
        }

        return(false);
    }
    protected DataSet gridComments_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        string whereCondition;
        string blogWhereCondition;

        if (ShowFilter)
        {
            whereCondition     = filterElem.CommentWhereCondition;
            blogWhereCondition = filterElem.BlogWhereCondition;
        }
        else
        {
            whereCondition     = CommentWhereCondition;
            blogWhereCondition = BlogWhereCondition;
        }

        var siteName = GetValidSiteName();

        return(BlogCommentInfoProvider.GetComments(0, null, whereCondition, blogWhereCondition, columns, currentTopN, currentOrder, currentOffset, currentPageSize, ref totalRecords, siteName));
    }
Exemple #5
0
    /// <summary>
    /// Deletes blog comment. Called when the "Delete comment" button is pressed.
    /// Expects the CreateBlogComment method to be run first.
    /// </summary>
    private bool DeleteBlogComment()
    {
        // Prepare the parameters
        string where = "CommentText LIKE 'My new%'";
        string blogWhere = "NodeName LIKE 'MyNewBlog%'";

        // Get the data
        DataSet comments = BlogCommentInfoProvider.GetComments(where, blogWhere);
        if (!DataHelper.DataSourceIsEmpty(comments))
        {
            // Create object from DataRow
            BlogCommentInfo modifyComment = new BlogCommentInfo(comments.Tables[0].Rows[0]);

            // Delete the blog comment
            BlogCommentInfoProvider.DeleteBlogCommentInfo(modifyComment);

            return true;
        }

        return false;
    }