public string DeleteRole(string loginIdentifer, string roleId) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); LoginUser loginUser = GlobalAppModule.GetLoginUser(loginIdentifer); if (loginUser == null) { obj2["Message"] = "未登录"; return(JavaScriptConvert.SerializeObject(obj2)); } if (loginUser.LoginTimeout) { obj2["Message"] = "登录超时"; return(JavaScriptConvert.SerializeObject(obj2)); } loginUser.LastOperateTime = DateTime.Now; try { string str = "删除失败"; if (SysUserModule.GetUserListByRole(long.Parse(roleId)).Count > 0) { str = "无法删除有用户数量的角色"; } else { if (RoleModule.DeleteRole(long.Parse(roleId))) { str = "删除成功"; MenuModule.DeleteRoleMenuByRoleId(long.Parse(roleId)); obj2["Result"] = true; } } obj2["Message"] = str; } catch (Exception exception) { obj2["Message"] = exception.Message; } try { SysLog log = new SysLog(); log.LogUserId = loginUser.UserId; log.LogUserName = loginUser.LoginName; log.LogAddress = ToolsWeb.GetIP(context.Request); log.LogTime = DateTime.Now; log.LogType = "删除角色"; log.LogContent = obj2["Message"].ToString() + "|" + roleId; SysLogModule.Add(log); } catch { } return(JavaScriptConvert.SerializeObject(obj2)); }