async void RemoveRole(IEnumerable <Row> p_rows) { string prvID = _lvPrv.SelectedItem.To <Prv>().ID; List <RolePrv> ls = new List <RolePrv>(); foreach (var row in p_rows) { ls.Add(new RolePrv(row.Long("roleid"), prvID)); } if (ls.Count > 0 && await AtCm.BatchDelete(ls)) { RefreshRelation(prvID); await AtCm.DeleteDataVer(ls.Select(rm => rm.RoleID).ToList(), "privilege"); } }
async void RemovePrv(IEnumerable <Row> p_rows) { long roleID = _lvRole.SelectedRow.ID; List <RolePrv> ls = new List <RolePrv>(); foreach (var row in p_rows) { ls.Add(new RolePrv(roleID, row.Str("prvid"))); } if (ls.Count > 0 && await AtCm.BatchDelete(ls)) { _lvPrv.Data = await AtCm.Query("角色-关联的权限", new { roleid = roleID }); await AtCm.DeleteDataVer(ls.Select(rm => rm.RoleID).ToList(), "privilege"); } }
async void RemoveMenu(IEnumerable <Row> p_rows) { long roleID = _lvRole.SelectedRow.ID; List <RoleMenu> ls = new List <RoleMenu>(); foreach (var row in p_rows) { ls.Add(new RoleMenu(roleID, row.Long("menuid"))); } if (ls.Count > 0 && await AtCm.BatchDelete(ls)) { _lvMenu.Data = await AtCm.Query("角色-关联的菜单", new { roleid = roleID }); await AtCm.DeleteDataVer(ls.Select(rm => rm.RoleID).ToList(), "menu"); } }
async void RemoveRole(IEnumerable <Row> p_rows) { long menuID = _fv.Data.To <Menu>().ID; List <RoleMenu> ls = new List <RoleMenu>(); foreach (var row in p_rows) { ls.Add(new RoleMenu(row.Long("roleid"), menuID)); } if (ls.Count > 0 && await AtCm.BatchDelete(ls)) { _lvRole.Data = await AtCm.Query <RoleMenu>("菜单-关联的角色", new { menuid = menuID }); await AtCm.DeleteDataVer(ls.Select(rm => rm.RoleID).ToList(), "menu"); } }
public async Task<bool> Delete(IEnumerable<Row> p_rows) { var ls = new List<Pubfile>(); foreach (var row in p_rows) { if (row.Bool("IsFolder")) { int cnt = await AtCm.GetScalar<int>("文件-子项个数", new { parentid = row.ID }); if (cnt > 0) { Kit.Warn($"[{row.Str("name")}]含有下级文件或文件夹,无法删除!"); return false; } } ls.Add(new Pubfile(ID: row.ID)); } return await AtCm.BatchDelete(ls); }