NIAGARA FALLS – When the president of a Niagara Falls engine parts manufacturer opened his office door at about 1:30 a.m. March 26, he encountered two men who said they were delivering a pizza.

But Sandro Viola hadn’t ordered a pizza, and when he said so, one of the men pulled a handgun and fired three shots, one of which struck Viola in the right shoulder.

Thursday, the owner of another Falls company appeared in Niagara County Court, charged with shooting Viola in the culmination of a long dispute over a machinery sale.

Timothy C. DePetris, 44, of Crestview Drive, Town of Niagara, the owner of Electro-Dyn Choke Corp., pleaded not guilty to attempted murder and assault and weapons charges.

Prosecutors and even his own defense attorney say DePetris’ problems appear to go deeper than a business dispute.

At the time of his arrest, he had been living at the Seneca Niagara Casino & Hotel, where he had racked up huge losses, and he was driving around the city with two loaded guns.

“He’s probably lost over $1 million at the casino,” defense attorney E. Earl Key said.

Deputy District Attorney Doreen M. Hoffmann said DePetris was arrested four days after the shooting, riding in a car with a loaded handgun in a homemade holster around his neck and an automatic rifle beside him.

Hoffmann said that the rifle was loaded with 31 bullets and that DePetris allegedly had 16 other ammunition magazines, six of them taped together in pairs for faster reloading.

“He has the ability to cause some serious damage to the community. He was driving around Niagara Falls with a fully automatic rifle and 200 rounds of ammunition. With one pull of the trigger, he could have taken out a lot of people,” the prosecutor told County Judge Sara Sheldon Farkas, who ordered DePetris held without bail.

Viola, 56, was released from Erie County Medical Center on the day of the shooting. A receptionist at Viola’s company, Integrated Controls USA, said Viola would not comment on the case.

Hoffmann told Farkas that for more than two months, DePetris “sat and brewed some anger” over a business deal with Integrated Controls. Apparently, the prosecutor said, DePetris was convinced he had been underpaid in a sale of machinery.

She said that last Jan. 15, DePetris allegedly went to Viola’s home. Viola wasn’t there, but DePetris grilled an adult daughter with questions that so flustered the woman that she filed a police report. Integrated Controls, according to its website, makes parts such as thermostats, coolant temperature sensors and temperature switches for auto, boat, heavy equipment and industrial engines in its Hyde Park Boulevard plant.

Electro-Dyn, whose phones have been disconnected, made engine blowers and fans, electronic coils and transformers and was located on 19th Street.

Information disclosed in court showed that DePetris allegedly had serious financial problems.

Hoffmann said DePetris was a member of the Chairman’s Club, the high-rolling VIP club at Seneca Niagara Casino. According to the casino’s website, it takes $136,000 in wagers in six months to qualify, though that can vary.

Hoffmann said that before DePetris’ arrest, he was living at the casino-hotel. Because of the weapons charges from March 30, he couldn’t go home because to do so might cause his wife to lose her license to operate a day care center. “As for living at the casino, that’s why he has no money,” Key said. Key told Farkas that DePetris has no prior criminal record, but Hoffmann said he has been arrested and charged with passing bad checks in the Town of Niagara, and she said a felony bad-check case against him is about to be presented to a Niagara County grand jury.

DePetris was never arrested in the Viola shooting. After his arrest on the gun-possession charges, Hoffmann presented evidence in the shooting to a grand jury, which issued the indictment.

DePetris is charged with attempted murder, first-degree assault, first-degree criminal use of a firearm, three counts of second-degree criminal possession of a weapon, six counts of third-degree criminal possession of a weapon and one count of second-degree criminal trespass, the last charge stemming from the Jan. 15 visit to Viola’s home.

DePetris is to return to court June 4, when Key is to report whether the defendant can afford to hire him.

No charges have been filed against the man who allegedly accompanied DePetris to Integrated Controls, pretending to be a pizza deliveryman. Asked whether he had testified against DePetris before the grand jury, a move that could bring him immunity from prosecution, Hoffmann declined to answer.

Key said DePetris was a passenger, not the driver, of the car that police stopped March 30, yet the driver wasn’t charged with weapons possession. Hoffmann said that was because DePetris allegedly admitted the guns were his.