Thanks for your query.Based on the facts that you have posted you were getting hard erection earlier but you have problem of getting hard erection since last 2 weeks.This is called as Secondary Erectile Dysfunction
.In majority of the cases in absence of any organic cause it is mind related and mainly due to anxiety
.Following measure will help you to boost up your confidence and getting good erection.
1) Practice regular exercise fior 45 minutes followed by meditation
for 1/2 an hour in the morning.
2) Take high protein diet rich in vegetables and fruits and vit A,C,D,E.
3)Take anti oxidants like Almonds 5-6 everyday..
4) Avoid alcohol and smoking
5) Spend more time in foreplay
Please do not worry at all this problem will be over in a month or two.