Beispiel #1
0
        /// <summary>
        /// 批量设置邀请状态
        /// </summary>
        /// <param name="userId">请求接收人Id</param>
        /// <param name="status">需设置的请求状态</param>
        public void BatchSetStatus(long userId, InvitationStatus status)
        {
            //请求状态必须是接受或拒绝
            if (status == InvitationStatus.Unhandled)
            {
                return;
            }

            IEnumerable <Invitation> invitations = GetTops(userId, int.MaxValue);

            if (invitations == null || invitations.Count() == 0)
            {
                return;
            }

            //触发事件
            EventBus <Invitation> .Instance().OnBatchBefore(invitations, new CommonEventArgs(EventOperationType.Instance().Update()));

            invitationRepository.BatchSetStatus(userId, status);
            //触发事件
            EventBus <Invitation> .Instance().OnBatchAfter(invitations, new CommonEventArgs(EventOperationType.Instance().Update()));
        }