Cooling and heating methods of water dispenser