Esempio n. 1
0
        public async Task <StatusOutput> GetStatus(int todoId)
        {
            var status  = _todoManager.GetStatuses(todoId);
            var message = _localizationManager.GetString(SapConsts.LocalizationSourceName, "StatusChangedByUser");
            var list    = new List <StatusDto>();

            foreach (var historyStatus in status)
            {
                var user = new User();
                if (historyStatus.CreatorUserId != null)
                {
                    user = await _userManager.GetUserByIdAsync((long)historyStatus.CreatorUserId);
                }
                var resolvedStatus  = _statusResolver.ResolveIntToStatus(historyStatus.StatusType);
                var resolvedName    = _statusResolver.GetStatusName(resolvedStatus);
                var resolvedMessage = string.Format(message, user.FullName, resolvedName);

                list.Add(new StatusDto()
                {
                    Member     = user,
                    Message    = resolvedMessage,
                    StatusType = historyStatus.StatusType
                });
            }
            return(new StatusOutput()
            {
                StatusDtos = list
            });
        }
Esempio n. 2
0
 public async Task NotifyTodoStatusChange(Todo todo, Project project, StatusTypes.Status statusType)
 {
     var message          = _localizationManager.GetString(SapConsts.LocalizationSourceName, "StatusChanged");
     var formatedMessage  = string.Format(message, todo.TodoName, _statusResolver.GetStatusName(statusType));
     var entityIdentifier = new EntityIdentifier(typeof(Project), project.Id);
     await _notificationPublisher.PublishAsync(
         TodoNotificationTypes.TodoChangeStatusForAllInProject,
         new ChangedStatusNotificationMessage(todo.Id, todo.TodoList.Id, formatedMessage, statusType), entityIdentifier);
 }