Example #1
0
    /// <summary>
    /// Gets and bulk updates message boards. Called when the "Get and bulk update boards" button is pressed.
    /// Expects the CreateMessageBoard method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateMessageBoards()
    {
        // Prepare the parameters
        string where = "BoardName LIKE N'MyNewBoard%'";

        // Get the data
        DataSet boards = BoardInfoProvider.GetMessageBoards(where, null);

        if (!DataHelper.DataSourceIsEmpty(boards))
        {
            // Loop through the individual items
            foreach (DataRow boardDr in boards.Tables[0].Rows)
            {
                // Create object from DataRow
                BoardInfo modifyBoard = new BoardInfo(boardDr);

                // Update the property
                modifyBoard.BoardDisplayName = modifyBoard.BoardDisplayName.ToUpper();

                // Update the message board
                BoardInfoProvider.SetBoardInfo(modifyBoard);
            }

            return(true);
        }

        return(false);
    }
Example #2
0
    protected DataSet gridBoards_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        // Prepare where condition
        completeWhere = SqlHelperClass.AddWhereCondition(completeWhere, "(BoardSiteID = " + CMSContext.CurrentSite.SiteID + ")");
        if (mGroupId != 0)
        {
            completeWhere = SqlHelperClass.AddWhereCondition(completeWhere, "(BoardGroupID =" + mGroupId + ")");
        }
        else
        {
            completeWhere = SqlHelperClass.AddWhereCondition(completeWhere, "(BoardGroupID IS NULL OR BoardGroupID = 0)");
        }

        // Get boards
        DataSet ds = BoardInfoProvider.GetMessageBoards(completeWhere, null, currentTopN, columns, true);

        totalRecords = DataHelper.GetItemsCount(ds);
        return(ds);
    }
    /// <summary>
    /// Populates the tree with the data.
    /// </summary>
    private void PopulateTree()
    {
        // Create root node
        TreeElemNode rootNode = new TreeElemNode();

        rootNode.Text     = "<span class=\"ContentTreeItem\" \"><span class=\"Name\">" + GetString("board.header.messageboards") + "</span></span>";
        rootNode.Expanded = true;
        treeElem.Nodes.Add(rootNode);

        // Populate the tree
        docId = QueryHelper.GetInteger("documentid", 0);
        if (docId > 0)
        {
            DataSet ds = BoardInfoProvider.GetMessageBoards("BoardDocumentID = " + docId, null);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    AddNode(Convert.ToString(dr["BoardDisplayName"]), ValidationHelper.GetInteger(dr["BoardId"], -1), ValidationHelper.GetInteger(dr["BoardGroupID"], 0) > 0);
                }
            }
        }
    }