/// <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); }
/// <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")); }
/// <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); }
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); }
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); }
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); }
public EsnPostMessageResponse PostMessage(EsnWriteMessageDTO message) { var result = new EsnPostMessageResponse(); try { result.Id = EsnCenter.PostMessage(message); } catch (Exception e) { result = new EsnPostMessageResponse(e); } return(result); }
/// <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")); }
/// <inheritdoc /> public Guid PostMessage(EsnWriteMessageDTO messageData) { var comment = CreateMessageEntity(messageData); return(InnerMessageSave(comment) ? comment.PrimaryColumnValue : Guid.Empty); }
/// <inheritdoc /> public Guid PostComment(Guid messageId, EsnWriteMessageDTO commentData) { var comment = CreateCommentEntity(commentData, messageId); return(InnerMessageSave(comment) ? comment.PrimaryColumnValue : Guid.Empty); }