The key to fighting these is to eliminate the breeding ground and fix the plumbing.......
the thick sludge in the inside of your pipes provides their home.........use one of the foaming drain cleaners or hire a roto cleaning.....
Fix any cracked pipes......check for abandoned fixtures......the floor drain you complained about should have a water filled trap that stops most flies.......if the vents aren't working properly on the roof then the water gets sucked from the drains and allow gases and the flies to enter......and of course the water evaporates and the trap is dry again..........
You can also find a "birth control" available for serious infestations...........