public async Task <Topic> ToNewSpecialObject(IStandardInstance instance) { string projectId = await ProjectIdProvider.GetProjectId(instance.Identifiers, await _dbService.GetAllProjectMappings()); var author = instance.Author == null ? null : await _dbService.GetEasyAccessUserFrom(instance.Author.UserMap[_configSettings.UserColumnName]); var assignee = instance.Assignee == null ? null : await _dbService.GetEasyAccessUserFrom(instance.Assignee.UserMap[_configSettings.UserColumnName]); var newTopic = new Topic() { Status = instance.Status, Priority = instance.Priority, AuthorId = author?.Id, AuthorName = author?.Name, AuthorEmail = author?.Email, AssignedToId = assignee?.Id, AssignedToEmail = assignee?.Email, AssignedToName = assignee?.Name, CreationDate = instance.Created, Title = "[" + instance.MessageOrigin.Split('_')[0] + "] | " + instance.Summary, TopicType = instance.Type, ProjectId = projectId, Labels = instance.Labels }; return(newTopic); }
private async Task UpdateStatusAndPriority(IStandardInstance instance, Topic updatedTopic) { var modifiedUser = (instance.ModifiedUser == null) ? null : await _dbService.GetEasyAccessUserFrom(instance.ModifiedUser.UserMap[_settings.UserColumnName]); if (!(updatedTopic.Status?.ToLower() == instance.Status?.ToLower())) { await UpdateStatusOfTopic(updatedTopic, instance.Status, modifiedUser); } if (!(updatedTopic.Priority?.ToLower() == instance.Priority?.ToLower())) { await UpdatePriorityOfTopic(updatedTopic, instance.Priority, modifiedUser); } }
public async Task <Comment> ToNewSpecialComment(IStandardComment comment) { var author = comment.Author == null ? null : await _dbService.GetEasyAccessUserFrom(comment.Author.UserMap[_configSettings.UserColumnName]); var projectId = await ProjectIdProvider.GetProjectId(comment.Identifiers, await _dbService.GetAllProjectMappings()); return(new Comment() { Content = "[" + comment.MessageOrigin.Split('_')[0] + "] | " + comment.Content, AuthorId = author?.Id, AuthorEmail = author?.Email, AuthorName = author?.Name, ProjectId = projectId, TopicGuid = comment.Identifiers[InstanceKeyNames.EASY_ACCESS_TOPIC].Id, Date = comment.Created }); }