Well, I know what you're going through. My son went through severe behavioral problems. Some of it was because of transitions in life and others may just have been growing up.
A book I read called 1-2-3-Magic helped me out quite a bit. When I need my child to do something, I give my child two options. For example, in your previously mentioned situation I might say, "You cannot have the donut. However, you can have either a "blank" or "blank" snack when we get home."
Children at this age are trying to assert independence and control. By giving them options, we are giving them some control over what happens but within reason with what we as parents can allow and then we can fulfill those requests.
To make our lives easier we give them only two options that WE choose. The child can pick one of our options or get nothing. If a fit ensues, state the whining, hitting, etc is not okay.
Begin by stating that the behavior is not appropriate. They need to use their words to express feelings. Otherwise, the chld needs to find something else to do to diffuse the hostile energy. The child might ride a bike, go outside to play, get out a favorite toy, play a game with parent or sibling, etc.
If they do not stop, then say you are going to start counting. When you get to 3, they get timeout (or some other sort of punishment that you can determine). Count slowly. The counting gives the child time to think about their actions and decide to make a better choice and weigh the consequences.
When you give a small child timeout, sometimes the thrashing around can hurt them. I used to sit on the floor away from furniture and toys and hold my son in my arms. I would make sure he had to sit in one place. He wasn't always still. He would cry and squirm and fight me. Once he reached a stage where he would sit without hurting himself or walking out of timeout, then I would sit him by himself somewhere away from activity and toys. The book suggests one minute per year of age, thus a 2 year old child receives 2 minutes of timeout.
The fit or whining may not stop during the timeout, but I let him out anyways. Often my sons would be crying, and I would give them hugs and revert their attention to some other activity to get them out of the crying and fitting zone. I always tell my boys that I love them very much and that it was only their actions or behavior that I didn't like. They need to make better decisions and listen.
After a couple week so of this, it gets better. It will be a lot of frustration for you. You really have to stick to the routine of two options, explanation of counting, and giving timeout even when you're tired and frustrated. This really helped me destress because I knew that I could follow this routine and it was getting better. I no longer felt like I would pull my hair out or want to swat his tail.
In the beginning I think I put my son into timeout like 30 times in a day. It seemed like he was in timeout all day. After a while, he changed though. It really takes consistency by you, partner, babysitters or other people that may watch your child. I encouraged my mother to follow my routine whether she agreed with me or not... and she didn't. She wanted to force my child into submission with spankin's and long talks. My child was confused and only listens to grandma because he's so scared. I don't want to scare my children into submission. I want them to learn, build respect and love and grow. The book really helped me.