Beispiel #1
0
        public int AfterDeleted(object[] ids, bool enabled = false, bool modifiedUser = false)
        {
            int result = 0;

            for (int i = 0; i < ids.Length; i++)
            {
                string         id     = ids[i].ToString();
                BaseUserEntity entity = GetObjectByCache(id);

                // 2016-02-19 宋彪 PooledRedisHelper.GetClient() 改为 PooledRedisHelper.GetSpellingClient()
                using (var redisClient = PooledRedisHelper.GetSpellingClient())
                {
                    // 2016-02-02 吉日嘎拉,修改数据后重新设置缓存。
                    BaseUserManager.CachePreheatingSpelling(redisClient, entity);
                }
            }

            if (ids != null && ids.Length > 0)
            {
                // 删除后把已经删除的数据搬迁到被删除表里去。

                /*
                 * string where = BaseUserEntity.FieldId + " IN (" + StringUtil.ArrayToList((string[])ids, "") + ") ";
                 *
                 * string commandText = @"INSERT INTO BASEUSER_DELETED SELECT * FROM " + BaseUserEntity.TableName + " WHERE " + where;
                 * IDbHelper dbHelper1 = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType, BaseSystemInfo.UserCenterDbConnection);
                 * dbHelper1.ExecuteNonQuery(commandText);
                 */

                // 进行删除操作
                this.Delete(ids);
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 编辑之后,需要重新刷新缓存,否则其他读取数据的地方会乱了,或者不及时了
        /// </summary>
        /// <param name="entity">用户实体</param>
        /// <returns>影响行数</returns>
        public int AfterUpdate(BaseUserEntity entity)
        {
            int result = 0;

            // 用户的缓存需要更新
            BaseUserManager.SetCache(entity);
            // 用户的联系方式需要更新
            BaseUserContactManager.SetCache(entity.Id);
            // 2016-02-02 吉日嘎拉,修改数据后重新设置缓存。
            BaseUserManager.CachePreheatingSpelling(entity);
            // AfterUpdateSynchronous(entity);

            return(result);
        }
        /// <summary>
        /// 添加之后,需要重新刷新缓存,否则其他读取数据的地方会乱了,或者不及时了
        /// </summary>
        /// <param name="entity">用户实体</param>
        /// <returns></returns>
        public int AfterAdd(BaseUserEntity entity)
        {
            int result = 0;

            // 2016-01-28 更新用户缓存
            BaseUserManager.SetCache(entity);

            // 2016-02-19 宋彪 PooledRedisHelper.GetClient() 改为 PooledRedisHelper.GetSpellingClient()
            using (var redisClient = PooledRedisHelper.GetSpellingClient())
            {
                BaseUserManager.CachePreheatingSpelling(redisClient, entity);
            }
            // AfterAddSynchronous(entity);

            return(result);
        }