An off-duty state trooper from Greensburg who works undercover is credited with foiling a convenience store heist and solving a Moose social club robbery allegedly committed by the same person.