Charging problem:
Replace battery
Replace dock connector
Try logic board in a known good housing
Troubleshoot logic board repair--battery connector, charging coil--there are solutions out there to determine which logic board components control the charging component---these occur after some sort of damage--if you haven't dropped or water damaged your phone then I'd look at the battery connector socket--in addition to supplying power and serving as ground, the middle pins serve as the battery gas gauge --it sounds like this may have been the problem initially. Also, you may have damaged the charging coil with a third party charger.