Flat battery is cause of the shutdown on removal of mains connection.
If your battery is not charging causes are :-
Bad battery - renew
Bad mains power adaptor - renew (you have done)
Bad contacts between battery and laptop - clean with a electrical cleaner (AC90) or try leaning the contacts on both the battery and the laptop with an ink rubber (eraser).
Static on the motherboard - Laptop Battery not showing Charging
- Turn off the computer,
- Take the battery out
- Take out the power supply
- Push the power button down for 30 seconds.
- Reconnect power supply
- Then the battery.
Bad motherboard charging circuit - fraid there is little you can do about this but change the board a new laptop may even be cheaper.