public override async Task <BaseNotificationInfo> ProcessInputMessageAndLoadAdditionalInfoForSingleNotification(JoinQueueNotification messageFromQueue) { var gift = await _giftRepository.GetBasicInfo(messageFromQueue.TargetGiftId); var wish = await _wishRepository.GetBasicInfo(messageFromQueue.TargetWishId); long ownerId = 0; BasicWishGiftDto target = null; string targetType = ""; if (messageFromQueue.CreatorId == messageFromQueue.OwnerWish) { //Инициатор владелец виша. Следовательно уведомляем гифтера ownerId = gift.Owner; target = gift; targetType = "gift"; } else { //Инициатор владелец гифта. Следовательно уведомляем вишера ownerId = wish.Owner; target = wish; targetType = "wish"; } var creator = await _profileRepository.GetTinyProfile(messageFromQueue.CreatorId); return(new CloseJoinInfo() { OwnerId = ownerId, User = creator, Target = target, TargetType = targetType }); }
public override async Task <BaseNotificationInfo> ProcessInputMessageAndLoadAdditionalInfoForSingleNotification(ReplyToCommentQueueNotification messageFromQueue) { BasicWishGiftDto wishGiftDto = null; switch (messageFromQueue.TargetType) { case "wish": wishGiftDto = await _wishRepository.GetBasicInfo(messageFromQueue.TargetId); break; case "gift": wishGiftDto = await _giftRepository.GetBasicInfo(messageFromQueue.TargetId); break; } var userCommentId = await _commentRepository.GetAutorUserIdByCommentId(messageFromQueue.ParentCommentId); var user = await _profileRepository.GetTinyProfile(messageFromQueue.CreatorId); return(new AddCommentInfo() { TargetType = messageFromQueue.TargetType, User = user, Target = wishGiftDto, OwnerId = userCommentId, CommentId = messageFromQueue.CommentId }); }
public override async Task <IEnumerable <BaseNotificationInfo> > ProcessInputMessageAndLoadAdditionalInfoForMultipleNotification(CloseItemQueueNotification messageFromQueue) { var list = new List <CloseJoinInfo>(); List <ParticipantDto> participants = null; BasicWishGiftDto wishOrGiftDto = null; if (messageFromQueue.TargetType == "wish") { participants = await _wishRepository.GetAllParticipants(messageFromQueue.ClosedItemId); wishOrGiftDto = await _wishRepository.GetBasicInfo(messageFromQueue.ClosedItemId); } if (messageFromQueue.TargetType == "gift") { participants = await _giftRepository.GetAllParticipants(messageFromQueue.ClosedItemId); wishOrGiftDto = await _giftRepository.GetBasicInfo(messageFromQueue.ClosedItemId); } var ownerWishOrGift = await _profileRepository.GetTinyProfile(wishOrGiftDto.Owner); foreach (var participant in participants) { list.Add(new CloseJoinInfo() { OwnerId = participant.Id, Target = wishOrGiftDto, User = ownerWishOrGift, TargetType = messageFromQueue.TargetType }); } return(list); }