public string ResetRoleAction(string users, string roles) { if (this._.设置用户角色.Permit == 0) { return("您没有进行设置用户角色的权限!"); } string Result = string.Empty; List <SspUserRole> lst = new List <SspUserRole>(); string[] userList = users.Split('|'); string[] roleList = GetRequest("RoleID").Split('|'); foreach (string role in roleList) { if (string.IsNullOrWhiteSpace(role)) { continue; } int irole = 0; if (!int.TryParse(role, out irole)) { continue; } foreach (string user in userList) { if (string.IsNullOrWhiteSpace(user)) { continue; } var uid = Convert.ToInt32(user); SspUserRole m = new SspUserRole(); m.UserId = uid; m.RoleId = irole; m.RecordUserId = this.Data.User.UserId; sysUserRoleManager.Delete(m); sysUserRoleManager.Insert(m); } } sysUserRoleManager.BatchInsert(lst); return(Result); }