Well I know speaking from personal experience that I prefer if someone asks before they give my dogs treats, and the employees at the stores here are good abou that. A lot of dogs are now on specialized diets and can't have certain types of treats because it might cause helath problems for them.
The majority of times my dogs are good about taking treats from strangers, Smudge will take it but spit it out either that or not take it until I tell him it's okay. Winter and Tama are the exact same way. There are a few people that are allowed to give my dogs treats with out asking and the dogs remember those people and mooch as much as possible. Otherwise however I prefer that people ask me because it might not be something that I particularly want the dogs to have or it might not be an appropriate time for the dog to get a treat from another person. It might be a time when the dogs full attention has to be on me and having another person give them treats takes that attention away.
I don't agree with the lady hitting the dog and telling it bad, after all it was just being a dog, but I also think that you could have handeled the situation a little bit better as well. You have to remember to look at peoples actions from all sides.
Bookmarks