All of the examples are right, if you can understand them then maybe you can understand your book example. Also, if you want to post the way your book does its example, then I can figure out the discrepancy.
Your way isn't quite right. If we have a "period," I would prefer to look at it as a physical length because it really isn't a period, of 2L then we would get a general solution
u(x,t) = \sum_{n=1}^\infty B_n sin(\frac{n \pi}{2L})exp[-(\frac{n \pi}{2L})^2 t]
and with an initial condition defined as f(x) such that
u(x,0)=\sum_{n=1}^\infty B_n sin(\frac{n \pi}{2L}) = f(x)
then to exploit orthogonality we will want to multiply both sides by an the integral of sin with m indices
\int_0^{2L} f(x) sin(\frac{m \pi}{2L}) dx = \int_0^{2L}\sum_{n=1}^\infty B_n sin(\frac{n \pi}{2L}) sin(\frac{m \pi}{2L}) dx
So the right side, from orthogonality, is going to be a kronecker delta times L (the same is if you had integral 0 to L multiplied by two, since you could easily just redefine the length of 2L to be L), which gives:
\frac{1}{L} \int_0^{2L} f(x) sin(\frac{n \pi}{2L}) dx = B_n