Beispiel #1
0
            public override void Execute(IOperation operation, IOperationLogger logger)
            {
                logger.Debug($"[Operation: {operation.ComplexOperationId}, note: {NoteId}] Sending notifications for users").Wait();

                var note = noteFolderStore.GetNoteById(operation, NoteId).Result;

                var(_, users) = userDataStore.GetUsers(operation, new UserPagingRequest
                {
                    PageNo   = 0,
                    PageSize = UserIds.Count(),
                    Filter   = new UserPagingFilter
                    {
                        Ids = UserIds
                    }
                }).Result;

                foreach (var user in users)
                {
                    var message = $"[Operation: {operation.ComplexOperationId}, note: {NoteId}] Note \"{note.FolderName}\" -> \"{note.Title}\":";
                    message += $"\n- The following user: {user.FirstName}{(!string.IsNullOrWhiteSpace(user.LastName) ? $" {user.LastName}" : "")} <{user.Email}>";
                    message += $"\n- The text:\n{note.Text}";
                    logger.Info(message).Wait();
                }

                logger.Debug($"[Operation: {operation.ComplexOperationId}, note: {NoteId}] Sent notifications for users").Wait();
            }
Beispiel #2
0
        public async Task <NoteExtendedEntity> GetNoteById(IOperation operation, int folderId, int noteId)
        {
            if (!await noteFolderStore.IsFolderExist(operation, folderId))
            {
                throw CommonExceptions.FolderWasNotFound(operation, folderId);
            }

            if (!await noteFolderStore.IsNoteExist(operation, folderId, noteId))
            {
                throw CommonExceptions.NoteWasNotFound(operation, noteId);
            }

            var note = await noteFolderStore.GetNoteById(operation, noteId);

            note.Projects = await noteFolderStore.GetNotesProjects(operation, new[] { note.Id });

            return(note);
        }