I can understand your problem. First of all you need to consider the following points to be out of pain and out of the whole situation.
1. Drink lots of water.
2. Have a high fiber diet.
3. Avoid oily and spicy foods.
4. Lose weight if you are overweight.
5. Don't sit for long durations.
6. Have small meals frequently rather than having huge amount of foods at one time.
7. Inculcate the habit of walking around for time time after dinner.
8. Avoid smoking and alcohol.
9. Have a bowl of curd everyday.
10. You could sit in a tub of hot water to which a antiseptic like dettol is added when you get pain.
If you do as per the above mentioned advice, you will be avoiding the whole situation of piles. But if it still persists, consult a surgeon in person for further help.