Sorry you are here, but like FF said, there are alot of people here that are very knowledgable in this and can give lots of advice. Have you obtained the Sex Starved Marriage book? I would suggest getting that and reading it for a start.
I wish I had some magical words of wisdom for you that would fix it all, but unfortunately your sitch, just as mine and alot of others on here, was not created in a day and it will take time, patience, and understanding to fix it.
About the affair.............. DON'T do it. Its not worth it. You will just create more problems on top of the ones you already have. I'm sure others will chime in here. Good luck, take your time, map out a plan.