예제 #1
0
        public async Task SetNotificationAsRead(EntityDto <Guid> input)
        {
            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);
        }
예제 #2
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);
        }
예제 #3
0
        public async Task SetNotificationAsRead(IdInput <Guid> input)
        {
            var userNotification = await _userNotificationManager.GetUserNotificationAsync(InfrastructureSession.TenantId, input.Id);

            if (userNotification.UserId != InfrastructureSession.GetUserId())
            {
                throw new ApplicationException(string.Format("Given user notification id ({0}) is not belong to the current user ({1})", input.Id, InfrastructureSession.GetUserId()));
            }
            await _userNotificationManager.UpdateUserNotificationStateAsync(InfrastructureSession.TenantId, input.Id, UserNotificationState.Read);
        }
예제 #4
0
        /// <summary>
        /// 将通知置为已读
        /// </summary>
        /// <param name="id">通知Id</param>
        public async Task SetNotificationAsRead(Guid id)
        {
            var userNotification = await _userNotificationManager.GetUserNotificationAsync(AbpSession.TenantId, id);

            if (userNotification.UserId != AbpSession.GetUserId())
            {
                throw new ApplicationException($"Given user notification id [{id}] is not belong to the current user [{AbpSession.GetUserId()}]");
            }

            await _userNotificationManager.UpdateUserNotificationStateAsync(AbpSession.TenantId, id, UserNotificationState.Read);
        }
예제 #5
0
        /// <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);
        }
예제 #6
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>
 /// Gets a user notification by given id.
 /// </summary>
 /// <param name="userNotificationManager">User notificaiton manager</param>
 /// <param name="tenantId">Tenant Id</param>
 /// <param name="userNotificationId">The user notification id.</param>
 public static UserNotification GetUserNotification(this IUserNotificationManager userNotificationManager, int?tenantId, Guid userNotificationId)
 {
     return(AsyncHelper.RunSync(() => userNotificationManager.GetUserNotificationAsync(tenantId, userNotificationId)));
 }
 /// <summary>
 /// Gets a user notification by given id.
 /// </summary>
 /// <param name="userNotificationManager">User notificaiton manager</param>
 /// <param name="tenantId">Tenant Id</param>
 /// <param name="userNotificationId">The user notification id.</param>
 public static UserNotificationDto GetUserNotification(this IUserNotificationManager userNotificationManager, Guid userNotificationId)
 {
     return(AsyncHelper.RunSync(() => userNotificationManager.GetUserNotificationAsync(userNotificationId)));
 }