Пример #1
0
        public void PublishNotification(string message, PublishType publishType = PublishType.Both, NotificationType notificationType = NotificationType.All)
        {
            if (CurrentRequestData.CurrentContext.AreNotificationsDisabled())
                return;

            var notification = new Notification
                                   {
                                       Message = message,
                                       User = _getCurrentUser.Get(),
                                       NotificationType = notificationType
                                   };
            switch (publishType)
            {
                case PublishType.Transient:
                    PushNotification(notification);
                    break;
                case PublishType.Persistent:
                    SaveNotification(notification);
                    break;
                case PublishType.Both:
                    SaveNotification(notification);
                    PushNotification(notification);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("publishType");
            }
        }
 public OnPersistentNotificationPublishedEventArgs(Notification notification)
 {
     Notification = notification;
 }
 public OnTransientNotificationPublishedEventArgs(Notification notification)
 {
     Notification = notification;
 }
Пример #4
0
 private void SaveNotification(Notification notification)
 {
     _session.Transact(session => session.Save(notification));
     EventContext.Instance.Publish<IOnPersistentNotificationPublished, OnPersistentNotificationPublishedEventArgs>(
                     new OnPersistentNotificationPublishedEventArgs(notification));
 }
Пример #5
0
 private void PushNotification(Notification notification)
 {
     EventContext.Instance.Publish<IOnTransientNotificationPublished, OnTransientNotificationPublishedEventArgs>(
                     new OnTransientNotificationPublishedEventArgs(notification));
 }
Пример #6
0
 public void Delete(Notification notification)
 {
     _session.Transact(session => session.Delete(notification));
 }
Пример #7
0
 public RedirectToRouteResult Delete_POST(Notification notification)
 {
     _service.Delete(notification);
     return RedirectToAction("Index");
 }
Пример #8
0
 public ViewResult Delete(Notification notification)
 {
     return View(notification);
 }