public JsonResult GetNotifications(SimplePagerModel pager) { var currentUser = HttpContext.User as CustomUser; var id = currentUser?.UserId ?? default(int); var notifications = _customerService.GetPagedNotifications(id); var model = new NotificationListModel { Notifications = notifications.Select(x => new NotificationVewModel { IsPositive = x.IsPositive, Text = x.Text }).ToList(), Pager = Extensions.Extensions.ToSimplePagerModel(notifications) }; foreach (var item in notifications) { var updateItem = _customerService.GetNotificationById(item.Id); updateItem.IsOpened = true; _customerService.UpdateNotification(updateItem); } return(CreateJsonResult(true, data: model)); }
public ActionResult Notifications(SimplePagerModel pager) { var currentUser = HttpContext.User as CustomUser; var id = currentUser?.UserId ?? default(int); var notifications = _customerService.GetPagedNotifications(id); var model = new NotificationListModel { Notifications = notifications.Select(x => new NotificationVewModel { IsPositive = x.IsPositive, Text = x.Text, IsOpened = x.IsOpened, CreatedOnUtc = x.CreatedOnUtc.ToString(Constants.DateFormat.ShortDateString), }).ToList(), Pager = Extensions.Extensions.ToSimplePagerModel(notifications) }; foreach (var item in notifications) { var updateItem = _customerService.GetNotificationById(item.Id); updateItem.IsOpened = true; _customerService.UpdateNotification(updateItem); } return(View(model)); }
public IActionResult Notifications() { if (!_workContext.CurrentCustomer.IsRegistered()) { return(Redirect("/Login")); } var currentUser = _workContext.CurrentCustomer; var Notifications = _notificationsService.GetUserNotifications(currentUser.Id); _notificationsService.SetUserNotificationsSeen(currentUser.Id); var notificationsModels = Notifications.Select(m => new NotificationModel { CustomerId = (int)(m.CustomerId == null? 0: m.CustomerId), CustomerName = (m.Customer == null ? "" : m?.Customer.GetFullName()), Type = (NotificationType)m.NotificationType, Note = m.NotificationContent, OwnerId = (int)m.OwnerId, OwnerName = m.Owner == null ?"": m?.Owner.GetFullName(), PostId = (m.PostId == null ?0:(int)m.PostId), PostTitle = (m.Z_Harag_Post == null ? "" : m?.Z_Harag_Post.Title), Time = (DateTime)m.NotificationTime, Username = (m.Customer == null?"":m?.Customer?.Username) }).ToList(); var outputModel = new NotificationListModel { Notifications = notificationsModels }; return(View("~/Themes/Pavilion/Views/Harag/Notification/Notifications.cshtml", outputModel)); }
private void UpdateReceiverStatusAndFireEvent(NotificationListModel receiver) { this.unitOfWork.NotificationListRepository.Update(receiver); this.unitOfWork.Save(); this.eventAggregator.Publish <NotificationListChangedEvent>(); }
public NotificationListControl(NotificationListModel model) { InitializeComponent(); _presenter = new NotificationListPresenter(this, model); gvPendingSPK.FocusedRowChanged += gvPendingSPK_FocusedRowChanged; gvPendingSPK.PopupMenuShowing += gvPendingSPK_PopupMenuShowing; // init editor control accessibility approveToolStripItem.Enabled = AllowEdit; this.Load += NotificationListControl_Load; }
public ActionResult List(NotificationListModel model) { IList <Notification> notificationList = _notificationService.GetNotifications(this._contextProvider.UserId, MaxNotificationCount); model.Notifications = Map <IList <NotificationModel> >(notificationList); IEnumerable <int> unseenIdList = notificationList.Where(n => !n.IsSeen).Select(n => n.Id); if (unseenIdList != null && unseenIdList.Any()) { _notificationService.UpdateAsSeen(unseenIdList); } return(View(model)); }
public ViewResult Index() { NotificationServices.DisableNotifications(CurrentCedUser.CurrentUser.Email); var notifications = GetNotificationListItems(null, 1); var model = new NotificationListModel { NotificationTypes = GetAllNotificationTypes(), DayRange = 1, Notifications = notifications }; return(View(model)); }
private void AddSelectedReceivers() { var receiversToAdd = this.ListModel.Where(a => a.IsSelected).ToList(); foreach (var receiver in receiversToAdd) { var receiverToAdd = this.notifications.FirstOrDefault(a => a.PatientId == receiver.Id); if (receiverToAdd == null) { var listItem = new NotificationListModel { GroupId = this.Id, PatientId = receiver.Id }; this.unitOfWork.NotificationListRepository.Add(listItem); } } }
private void SetErrorStatusForReceiver(NotificationListModel receiver, string exceptionMessage) { receiver.SendDate = DateTime.Now; receiver.Status = (int)NotificationListStatus.Fail; receiver.ErrorDescription = exceptionMessage; }
private void LogSuccessfulResult(NotificationListModel receiver) { var resultMessage = this.resourceHandler.GetValue("NotificationEmailSuccessfulResult"); Log.Debug(resultMessage, Log.Args(receiver.PatientName, receiver.PatientEmail, DateTime.Now)); }
private void SetSuccessStatusForReceiver(NotificationListModel receiver) { receiver.SendDate = DateTime.Now; receiver.Status = (int)NotificationListStatus.Success; }