Try changing these to lines:
if (count($case) > 0) {
foreach( $case as $cliente2 ):
to
if (count($case->posts) > 0) {
foreach( $case->posts as $cliente2 ):
I don’t understand what you’re trying to do here
<a href="<?php echo get_permalink( $case->ID ); ?>">
$case in your code is a WP_Query object, so $case->ID has no value.
To get a better idea of what $case holds you can do this so that you can see everything that’s in it.
echo '<pre>'; print_r($case); echo '</pre>';