Stochastic Control of a Class of Networked Control Systems with Time Delays and Packet Dropouts