Characterization of rings using direct-projective modules and direct-injective modules