Algebraic classification of the gravitational field in Weyl-Cartan spacetimes