Rather than be discouraged, use both wrecks as learning experiences- it's probably safe to say that those are two accidents that you'll never have again.
To spell it out though, you might have avoided the first wreck by riding your brakes at the beginning of the ride, well before you needed to use them. Also, like someone else mentioned, speed may have been a factor, especially descending a parking garage with (presumably) wet, slick floors.
For the second wreck...probably the main reason seasoned cyclists don't get into the same wreck as you is that they avoid metal surfaces in the rain- taking it slow, steady, and maintaining perfect balance is the effectively cautious way to do it, but abstinence is the only fool-proof way to ensure your upright integrity.
Expect to be overly cautious and easily spooked for your next several rides, but as you realize that you're (hopefully) not having any accidents, you'll get comfortable and confident, with the previous mishaps simply keeping any cockiness in check