In thermodynamics work done = 1) $P\,dV$ or 2) $-P\,dV$ or both at certain situations. I'm confused what's right as in some sections the former is used and in some the latter.
Physics equations always have well-defined sign conventions, but it is not always easy to remember them. Hence, in practice, it is generally advisable to manually apply the signs that make sense. The difference between PdV and -PdV is simply that the first is the work done by the gas on its surroundings (you can imagine a piston, for example), and the second is the work done on the gas by the surroundings. The easy way to tell which is which is to simply ask yourself, if a gas expands and so V increases, does that remove energy from the gas or add energy to the gas? Think about the particles bouncing off a receding wall, that should be enough to get the sign right.
The sign depends on whether you are concerned about the system or the surroundings. The conventional approach in thermodynamics is that we speak everything with reference to the system. If the system do work, then energy has to be compensated from the system for the work and so the energy of the system decreases. Hence work done by the system is negative. Now, if the work is done on the system, then energy is added to the system. The energy of the system increases and hence the work done on the system is positive.
Whatever be the form of energy you supply (or extract) to (or from) the system, the above formalism is valid. For example, if the system liberates heat (as in the case of an exothermal reaction), then the heat is written as negative since the energy of the system decreases. If heat is supplied to the system, it is expressed as a positive quantity.
So, in general, if the nature of work increases the internal energy of the system, then work is done on the system and is hence positive. if the nature of the work is such that the internal energy of the system decreases, then the work done is negative, which means the work is done by the system.