Let $\alpha=\frac{-b+\sqrt{-p}}a$ and $\bar\alpha=\frac{-b-\sqrt{-p}}a$. Now, $\alpha,\bar\alpha$ are the roots of the equation $at^2+2bt+c=0$, and $f(n)$ is the number of integer solutions $(x,y)$ to $a(x-\alpha y)(x-\bar\alpha y)=n\ (*)$.
Construct the lattice $\Delta_{\alpha}=\{u-\alpha v\ |\ u,v,\in\mathbb Z\}$ (we denote $u-\alpha v$ by $(u,v)$). This is a obviously a discrete set, so every circle contains finitely many points of $\Delta_{\alpha}$. In particular, the circle centered at the origin of radius $\sqrt{\frac na}$ contains finitely many points of our lattice, but these points $(x,y)$ are precisely those for which $(*)$ holds, so the finitude of $f(n)$ is proven.
The second part is equivalent to proving that for every positive integer $n$, we have $f(n)=f(pn)$. We define a map from the solutions of $(*)$ to those of $a(x-\alpha y)(x-\bar\alpha y)=pn\ (**)$, taking $(x,y)$ to $(bx+cy,-ax-by)$. It's easy to check that this function does indeed map solutions of $(*)$ onto solutions of $(**)$, and it's obviously injective. What we must prove now is that it's also surjective, i.e. given $u,v$ s.t. $au^2+2buv+cv^2=pn$, we can find integers $x$ and $y$ with $bx+cy=u,-ax-by=v$. This reduces to proving that whenever $p|au^2+2buv+cv^2$, we have $p|au+bv$ and $p|bu+cv$. In turn, since $p$ is square-free, we must prove that if $q$ is a prime divisor of $p$ and $q|au^2+2buv+cv^2$, then $q$ divides both $au+bv$ and $bu+cv$.
First of all, if $q|a$, then $q|b,q\not|c$, so $q|a,b,v$, and we’re done. Something similar happens if $q|c$, so we assume $q\not|a,b,c$.
In $\mathbb F_q$, the equation $at^2+2bt+c$ has the double root $-ba^{-1}$, since the discriminant of this equation is $0$ (in the field with $q$ elements). This means that if $u,v$ satisfy $au^2+2buv+cv^2=0$ in $\mathbb F_q$, then $u-(-ba^{-1})v=0$, i.e. $au+bv=0$, and $bu+cv=0$ follows from $au+bv=0$ and $ac-b^2=0$.