/// <summary> /// Returns the count of messages in given message board. /// </summary> /// <param name="documentId">ID of the document.</param> /// <param name="boardWebpartName">Messageboard webpart name.</param> /// <param name="type">Type of messageboard: 'document', 'user' or 'group'.</param> public static int GetBoardMessagesCount(int documentId, string boardWebpartName, string type) { // Get board type BoardOwnerTypeEnum boardType = BoardInfoProvider.GetBoardOwnerTypeEnum(type); Guid identifier = Guid.Empty; // Get correct identifier by type switch (boardType) { case BoardOwnerTypeEnum.User: identifier = CMSContext.CurrentUser.UserGUID; break; case BoardOwnerTypeEnum.Group: identifier = GetCurrentGroupGuid(); break; } // Get board name string boardName = BoardInfoProvider.GetMessageBoardName(boardWebpartName, boardType, identifier.ToString()); // Get board info BoardInfo board = BoardInfoProvider.GetBoardInfo(boardName, documentId); if (board != null) { // Get messages count return(BoardMessageInfoProvider.GetMessagesCount(board.BoardID, true, true)); } return(0); }
/// <summary> /// Returns board name according board type. /// </summary> /// <param name="webPartName">Name of the web part</param> /// <param name="boardOwner">Owner of the board</param> private string GetBoardName(string webPartName, string boardOwner) { // Get type BoardOwnerTypeEnum type = BoardInfoProvider.GetBoardOwnerTypeEnum(boardOwner); // Get name switch (boardOwner.ToLowerCSafe()) { case "user": return(BoardInfoProvider.GetMessageBoardName(webPartName, type, CurrentUser.UserGUID.ToString())); default: return(BoardInfoProvider.GetMessageBoardName(webPartName, type, "")); } }
private string GetBoardName(string webPartName, BoardOwnerTypeEnum type) { return(type == BoardOwnerTypeEnum.User ? BoardInfoProvider.GetMessageBoardName(webPartName, type, CurrentUser.UserGUID.ToString()) : BoardInfoProvider.GetMessageBoardName(webPartName, type, CurrentPageInfo.DocumentGUID.ToString())); }
/// <summary> /// Returns board name according board type. /// </summary> /// <param name="webPartName">Name of the web part</param> private string GetBoardName(string webPartName) { return(BoardInfoProvider.GetMessageBoardName(webPartName, BoardOwnerTypeEnum.Group, CurrentGroup.GroupGUID.ToString())); }