I believe the following resources will help you:
The while
or for
loop constructs (to loop over your days and periods): http://msdn.microsoft.com/en-us/library/2aeyhxcd.aspx and http://msdn.microsoft.com/en-us/library/ch45axte.aspx
The continue
keyword (to skip days you don't want to process): http://msdn.microsoft.com/en-us/library/923ahwt1.aspx
The DateTime
documentation on MSDN: http://msdn.microsoft.com/en-us/library/system.datetime.aspx
Specifically, the DayOfWeek
property (to find out what day you are currently looking at in order to skip over it): http://msdn.microsoft.com/en-us/library/system.datetime.dayofweek.aspx
And the AddDays
method (to get to the next day): http://msdn.microsoft.com/en-us/library/system.datetime.adddays.aspx
I don't believe what you actually want (maybe it is what you want but working with the correct data type for a problem is often half the battle of finding a solution, and if there's anything I've learned it is that there is almost always a better solution) is to just add one to an integer, which is why I have included the documentation for the DateTime
structure.
If you really need an integer representation, consider the text in the remarks section of the DayOfWeek
documentation page, specifically the following:
If cast to an integer, its value ranges from zero (which indicates DayOfWeek.Sunday) to six (which indicates DayOfWeek.Saturday).