I see a mix of problems. Please help clarify: Was, Randomly turning off Now, will not turn off Now, will not charge Is this correct? Sounds like there are several possible problems. Could be only corrupt OS, or only failing motherboard, or failed charging port with broken power button. It's hard to tell without trial and error to find out what's actually working.
Did the whole phone suffer water damage? Did they also change the battery when they did your repair? Did the repair place conduct water damage repair or just replace the non-functional parts? There may be some corrosion that is (and may continue) causing the malfunctions.