/// <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); }
public int ClearUser(string roleId) { int returnValue = 0; returnValue = this.SetProperty( new KeyValuePair<string, object>(BaseUserEntity.FieldRoleId, roleId) , 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.FieldRoleId, roleId)); return returnValue; }