Probably so, although I think Barney would still have his job. And also, Barney would probably find less public way to meet his needs... and so less likely to encounter the situation to begin with.
A reminder: Senator Craig could easily have found "less public" ways to find a sex partner. He's a Senator fercryinoutloud! Also, let's not forget, Senator Frank was indeed involved in a sex scandal, years ago, when he was living with another man. The Right Wing Noisemakers invented a tale about his lover running a homosexual prostitution ring out of Frank's Washington apartment. Remember?
And what about that recent case of the Dem Governor of NJ who was caught having a homosexual affair with an aide? What happened to him?