コード例 #1
0
        public int ClearRole(string systemCode, string userId)
        {
            int result = 0;

            if (string.IsNullOrEmpty(systemCode))
            {
                systemCode = "Base";
            }
            string tableName            = systemCode + "UserRole";
            BaseUserRoleManager manager = new BaseUserRoleManager(this.DbHelper, this.UserInfo, tableName);

            result += manager.Delete(new KeyValuePair <string, object>(BaseUserRoleEntity.FieldUserId, userId));

            return(result);
        }
コード例 #2
0
        //
        //  从角色中删除员工
        //

        #region public int RemoveFormRole(string userId, string roleId) 撤销角色权限
        /// <summary>
        /// 从角色中删除员工
        /// </summary>
        /// <param name="userId">员工主键</param>
        /// <param name="roleId">角色主键</param>
        /// <returns>影响行数</returns>
        public int RemoveFormRole(string userId, string roleId)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseUserRoleEntity.FieldUserId, userId));
            parameters.Add(new KeyValuePair <string, object>(BaseUserRoleEntity.FieldRoleId, roleId));
            string tableName = BaseUserRoleEntity.TableName;

            if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
            {
                tableName = BaseSystemInfo.SystemCode + "UserRole";
            }
            BaseUserRoleManager userRoleManager = new BaseUserRoleManager(this.DbHelper, this.UserInfo, tableName);

            return(userRoleManager.Delete(parameters));
        }
コード例 #3
0
        public int ClearRole(string userId)
        {
            int returnValue = 0;

            returnValue += this.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldId, userId), new KeyValuePair <string, object>(BaseUserEntity.FieldRoleId, null));

            string tableName = BaseUserRoleEntity.TableName;

            if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
            {
                tableName = BaseSystemInfo.SystemCode + "UserRole";
            }

            BaseUserRoleManager userRoleManager = new BaseUserRoleManager(this.DbHelper, this.UserInfo, tableName);

            returnValue += userRoleManager.Delete(new KeyValuePair <string, object>(BaseUserRoleEntity.FieldUserId, userId));
            return(returnValue);
        }
コード例 #4
0
        /// <summary>
        /// 清空角色
        /// </summary>
        /// <param name="systemCode">系统编码</param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public int ClearRole(string systemCode, string userId)
        {
            var result = 0;

            if (string.IsNullOrEmpty(systemCode))
            {
                systemCode = "Base";
            }
            var tableName  = systemCode + "UserRole";
            var manager    = new BaseUserRoleManager(DbHelper, UserInfo, tableName);
            var parameters = new List <KeyValuePair <string, object> > {
                new KeyValuePair <string, object>(BaseUserRoleEntity.FieldUserId, userId),
                new KeyValuePair <string, object>(BaseUserRoleEntity.FieldEnabled, 1),
                new KeyValuePair <string, object>(BaseUserRoleEntity.FieldDeleted, 0)
            };

            result += manager.Delete(parameters);

            return(result);
        }