Пример #1
0
        public void NotifyClients(NotifyClientRequest request)
        {
            var transaction = new NotifyClientsTransaction();

            transactionHelper.ExecuteComplexTransactionalOperation(()
                                                                   => transaction.ExecuteNotifyClientsTransaction(request), transaction.InstanceRepositories);
        }
        private void RegisterNotification(NotifyClientRequest request, out Notification notification)
        {
            notification = new Notification(request.Title,
                                            request.Message,
                                            request.Owner,
                                            request.ApplicationId,
                                            request.UserContextId);

            notification = _notificationRepository.Add(notification);
        }
        private void RegisterClient(NotifyClientRequest request, Notification notification)
        {
            foreach (var userId in request.UsersId)
            {
                var client = new Client(userId,
                                        request.UserContextId);
                _clientRepository.Add(client);

                RegisterClientNotification(client.Id, notification.Id, request.UserContextId);
            }
        }
 public void ExecuteNotifyClientsTransaction(NotifyClientRequest request)
 {
     RegisterNotification(request, out Notification notification);
     RegisterClient(request, notification);
     Notify(request.UsersId, request.ApplicationId);
 }