Theoretical study of X-ray photoelectron spectra of mono- and polycrystalline samples