Mesogenic and magnetic behavior in cobalt(II) and iron(II) compounds with long alkyl chains