コード例 #1
0
        /// <summary>
        /// Get new message to post.
        /// </summary>
        /// <param name="postData">Data for message post.</param>
        /// <returns></returns>
        protected Entity CreateMessageEntity(EsnWriteMessageDTO postData)
        {
            var message = CreateMessage(postData.Message);

            message.SetColumnValue(EsnEntityIdColumnName, postData.EntityId);
            message.SetColumnValue(EsnEntitySchemaUIdColumnName, postData.SchemaUId);
            return(message);
        }
コード例 #2
0
 /// <inheritdoc />
 public Guid PostComment(Guid messageId, EsnWriteMessageDTO commentData)
 {
     if (_esnSecurityEngine.CanCreateComment(commentData.SchemaUId, commentData.EntityId))
     {
         return(_messageRedactor.PostComment(messageId, commentData));
     }
     throw new SecurityException(string.Format(
                                     new LocalizableString("Terrasoft.Core",
                                                           "DBSecurityEngine.Exception.CurrentUserHasNotRightsForObject"), "SocialMessage"));
 }
コード例 #3
0
        /// <summary>
        /// Get new comment to message.
        /// </summary>
        /// <param name="postData">Data for comment message.</param>
        /// <param name="parentMessageId">Parent message Id.</param>
        /// <returns></returns>
        protected Entity CreateCommentEntity(EsnWriteMessageDTO postData, Guid parentMessageId)
        {
            var comment = CreateMessage(postData.Message);

            if (!Guid.Empty.Equals(parentMessageId))
            {
                comment.SetColumnValue(EsnParentIdColumnName, parentMessageId);
            }
            return(comment);
        }
コード例 #4
0
        public ConfigurationServiceResponse EditComment(Guid commentId, EsnWriteMessageDTO comment)
        {
            var result = new ConfigurationServiceResponse();

            try {
                EsnCenter.EditComment(commentId, comment);
            } catch (Exception e) {
                result = new ConfigurationServiceResponse(e);
            }
            return(result);
        }
コード例 #5
0
        public ConfigurationServiceResponse EditMessage(Guid messageId, EsnWriteMessageDTO message)
        {
            var result = new ConfigurationServiceResponse();

            try {
                EsnCenter.EditMessage(messageId, message);
            } catch (Exception e) {
                result = new ConfigurationServiceResponse(e);
            }
            return(result);
        }
コード例 #6
0
        public EsnPostMessageResponse PostComment(Guid messageId, EsnWriteMessageDTO comment)
        {
            var result = new EsnPostMessageResponse();

            try {
                result.Id = EsnCenter.PostComment(messageId, comment);
            } catch (Exception e) {
                result = new EsnPostMessageResponse(e);
            }
            return(result);
        }
コード例 #7
0
        public EsnPostMessageResponse PostMessage(EsnWriteMessageDTO message)
        {
            var result = new EsnPostMessageResponse();

            try {
                result.Id = EsnCenter.PostMessage(message);
            } catch (Exception e) {
                result = new EsnPostMessageResponse(e);
            }
            return(result);
        }
コード例 #8
0
        /// <inheritdoc />
        public bool EditComment(Guid commentId, EsnWriteMessageDTO commentData)
        {
            var commentEntity   = _messageReader.ReadMessageAllColumnsEntity(commentId);
            var commentAuthorId = commentEntity.GetTypedColumnValue <Guid>("CreatedById");

            if (_esnSecurityEngine.CanEditPost(commentData.SchemaUId, commentData.EntityId, commentAuthorId))
            {
                return(_messageRedactor.EditComment(commentEntity, commentData.Message));
            }
            throw new SecurityException(string.Format(
                                            new LocalizableString("Terrasoft.Core",
                                                                  "DBSecurityEngine.Exception.CurrentUserHasNotRightsForObject"), "SocialMessage"));
        }
コード例 #9
0
        /// <inheritdoc />
        public Guid PostMessage(EsnWriteMessageDTO messageData)
        {
            var comment = CreateMessageEntity(messageData);

            return(InnerMessageSave(comment) ? comment.PrimaryColumnValue : Guid.Empty);
        }
コード例 #10
0
        /// <inheritdoc />
        public Guid PostComment(Guid messageId, EsnWriteMessageDTO commentData)
        {
            var comment = CreateCommentEntity(commentData, messageId);

            return(InnerMessageSave(comment) ? comment.PrimaryColumnValue : Guid.Empty);
        }