Esempio n. 1
0
        /// <summary>
        /// 批量创建At用户
        /// </summary>
        /// <param name="userNames">用户Id集合</param>
        /// <param name="associateId">关联项Id</param>
        /// <param name="userId">添加at的用户Id</param>
        /// <param name="tenantTypeId">租户类型Id</param>
        /// <param name="associateSubject">关联项标题</param>
        /// <returns></returns>
        public bool BatchCreateAtUser(List <long> userIds, long associateId, long userId, string associateSubject = "")
        {
            EventBus <long, AtUserEventArgs> .Instance().OnBatchBefore(userIds, new AtUserEventArgs(userId, tenantTypeId, associateId));

            bool isSuccess = atUserRepository.BatchCreateAtUser(userIds, associateId, tenantTypeId);

            EventBus <long, AtUserEventArgs> .Instance().OnBatchAfter(userIds, new AtUserEventArgs(userId, tenantTypeId, associateId));

            return(isSuccess);
        }
Esempio n. 2
0
        /// <summary>
        /// 批量创建At用户
        /// </summary>
        /// <param name="userIds">用户Id集合</param>
        /// <param name="associateId">关联项Id</param>
        /// <param name="userId">添加at的用户Id</param>
        /// <param name="associateSubject">关联项标题</param>
        /// <returns></returns>
        public bool BatchCreateAtUser(List <long> userIds, long associateId, long userId, string associateSubject = "")
        {
            List <long> current_UserIds = atUserRepository.GetAtUserIds(associateId, tenantTypeId);
            List <long> insertUserIds   = userIds.Except(current_UserIds).ToList();

            EventBus <long, AtUserEventArgs> .Instance().OnBatchBefore(insertUserIds, new AtUserEventArgs(userId, tenantTypeId, associateId));

            bool isSuccess = atUserRepository.BatchCreateAtUser(userIds, associateId, tenantTypeId);

            //更新最后联系时间
            new FollowRepository().UpdateLastContactDate(userId, userIds);
            EventBus <long, AtUserEventArgs> .Instance().OnBatchAfter(insertUserIds, new AtUserEventArgs(userId, tenantTypeId, associateId));

            return(isSuccess);
        }