Exemplo n.º 1
0
        public Comment SaveOrUpdateComment(ProjectEntity entity, Comment comment)
        {
            var isNew = comment.OldGuidId.Equals(Guid.Empty);

            if (isNew)
            {
                ProjectSecurity.DemandCreateComment(entity);
            }
            else
            {
                var message = entity as Message;
                if (message != null)
                {
                    ProjectSecurity.DemandEditComment(message, comment);
                }
                else
                {
                    ProjectSecurity.DemandEditComment(entity.Project, comment);
                }
            }

            SaveOrUpdate(comment);

            NotifyNewComment(entity, comment, isNew);

            GetProjectEntityEngine(comment).Subscribe(entity, SecurityContext.CurrentAccount.ID);

            return(comment);
        }
Exemplo n.º 2
0
        public Comment SaveOrUpdate(Comment comment)
        {
            if (comment == null)
            {
                throw new ArgumentNullException("comment");
            }

            ProjectSecurity.DemandCreateComment();

            if (comment.CreateBy == default(Guid))
            {
                comment.CreateBy = SecurityContext.CurrentAccount.ID;
            }

            var now = TenantUtil.DateTimeNow();

            if (comment.CreateOn == default(DateTime))
            {
                comment.CreateOn = now;
            }

            var newComment = _commentDao.Save(comment);

            //mark entity as jast readed

            return(newComment);
        }
Exemplo n.º 3
0
        public Comment SaveOrUpdateComment(ProjectEntity entity, Comment comment)
        {
            var isNew = comment.OldGuidId.Equals(Guid.Empty);

            ProjectSecurity.DemandCreateComment(entity);

            SaveOrUpdate(comment);

            NotifyNewComment(entity, comment, isNew);

            GetProjectEntityEngine(comment).Subscribe(entity, SecurityContext.CurrentAccount.ID);

            return(comment);
        }