Exemple #1
0
        public async Task SetNotificationAsRead(IdInput <Guid> input)
        {
            var userNotification = await _userNotificationManager.GetUserNotificationAsync(AbpSession.TenantId, input.Id);

            if (userNotification.UserId != AbpSession.GetUserId())
            {
                throw new ApplicationException(string.Format("Given user notification id ({0}) is not belong to the current user ({1})", input.Id, AbpSession.GetUserId()));
            }

            await _userNotificationManager.UpdateUserNotificationStateAsync(AbpSession.TenantId, input.Id, UserNotificationState.Read);
        }
        /// <summary>
        ///
        /// </summary>
        public async Task SetNotificationAsRead(EntityDto <Guid> input)
        {
            var userNotification = await _userNotificationManager.GetUserNotificationAsync(AbpSession.TenantId, input.Id);

            if (userNotification.UserId != AbpSession.GetUserId())
            {
                throw new ApplicationException(
                          $"给定的消息{input.Id}不属于当前用户{AbpSession.GetUserId()}");
            }

            await _userNotificationManager.UpdateUserNotificationStateAsync(AbpSession.TenantId, input.Id, UserNotificationState.Read);
        }
Exemple #3
0
        public async Task MakeNotificationAsRead(EntityDto <Guid> input)
        {
            var userNotification =
                await _userNotificationManager.GetUserNotificationAsync(AbpSession.TenantId, input.Id);

            if (userNotification.UserId != AbpSession.GetUserId())
            {
                throw new ApplicationException($"消息Id为{input.Id}的信息,不属于当前的用户,用户id:{AbpSession.UserId}");
            }

            await _userNotificationManager.UpdateUserNotificationStateAsync(AbpSession.TenantId, input.Id,
                                                                            UserNotificationState.Read);
        }
Exemple #4
0
        public async Task SetNotificationAsRead(EntityDto <Guid> input)
        {
            var _user = await UserManager.FindByIdAsync("2");

            if (AbpSession.UserId.HasValue)
            {
                _user = await UserManager.FindByIdAsync(AbpSession.UserId.ToString());
            }
            await _notificationPublisher.PublishAsync(
                "Ali Essa",
                new MessageNotificationData("Has registered on site test"),
                userIds : new[] { _user.ToUserIdentifier() }
                );

            var userNotification = await _userNotificationManager.GetUserNotificationAsync(AbpSession.TenantId, input.Id);

            if (userNotification.UserId != AbpSession.GetUserId())
            {
                throw new Exception(string.Format("Given user notification id ({0}) is not belong to the current user ({1})", input.Id, AbpSession.GetUserId()));
            }

            await _userNotificationManager.UpdateUserNotificationStateAsync(AbpSession.TenantId, input.Id, UserNotificationState.Read);
        }
 /// <summary>
 /// Updates a user notification state.
 /// </summary>
 /// <param name="userNotificationManager">User notificaiton manager</param>
 /// <param name="tenantId">Tenant Id</param>
 /// <param name="userNotificationId">The user notification id.</param>
 /// <param name="state">New state.</param>
 public static void UpdateUserNotificationState(this IUserNotificationManager userNotificationManager, int?tenantId, Guid userNotificationId, UserNotificationState state)
 {
     AsyncHelper.RunSync(() => userNotificationManager.UpdateUserNotificationStateAsync(tenantId, userNotificationId, state));
 }
Exemple #6
0
 public async Task UpdateStateAsync([NotNull] Guid notificationId, [NotNull] UserNotificationState state)
 {
     await _userNotificationManager.UpdateUserNotificationStateAsync(CurrentUser.Id.Value, notificationId, state);
 }
 public async Task ReadNotificationAsync(Guid id)
 {
     await _userNotificationManager.UpdateUserNotificationStateAsync(AbpSession.TenantId, id, UserNotificationState.Read);
 }