Exemplo n.º 1
0
        private async Task SendNotifyRequestExhibit(RequestExhibitDto dto)
        {
            var notifyReceiver = new Notification
            {
                User = new User {
                    Id = dto.Receiver.Owner.UserId
                },
                Text =
                    $"У вас запросили экспонат {dto.Exhibit.Name} в подразделение {dto.Consumer.Name}. Вы согласны?",
                SubdivisionId = dto.Receiver.Id,
                ExhibitId     = dto.Exhibit.Id,
                IsRead        = false,
                Confirm       = Confirm.NeededConfirm,
                CreationTime  = DateTimeOffset.Now
            };
            await _notificationUseCases.Notify(notifyReceiver);

            var notifyConsumer = new Notification
            {
                User = new User {
                    Id = dto.Consumer.Owner.UserId
                },
                Text = $"Вы запросили экспонат {dto.Exhibit.Name} из подразделения {dto.Receiver.Name}." +
                       $" Ожидайте подтверждение представителя {dto.Receiver.Name}",
                SubdivisionId = dto.Consumer.Id,
                ExhibitId     = dto.Exhibit.Id,
                IsRead        = false,
                Confirm       = Confirm.SystemInformation,
                CreationTime  = DateTimeOffset.Now
            };
            await _notificationUseCases.Notify(notifyConsumer);
        }
Exemplo n.º 2
0
 private async Task SendRequestForExhibitNotify(Notification oldNotify, Exhibit exhibit)
 {
     var notify = new Notification
     {
         User = new User {
             Id = oldNotify.User.Id
         },
         Text =
             $"Экспонат {exhibit.Name} успешно перемещен.",
         SubdivisionId = oldNotify.SubdivisionId,
         ExhibitId     = oldNotify.ExhibitId,
         IsRead        = false,
         Confirm       = Confirm.SystemInformation,
         CreationTime  = DateTimeOffset.Now
     };
     await _notificationUseCases.Notify(notify);
 }