public static DateTime
AddWorkdays(DateTime originalDate, int workDays, bool
transtype, bool daysSkip)
{
DateTime
tmpDate = originalDate;
if
(transtype && !daysSkip) // Check Days
Condition Checking for Saturdays and Sundays
{
while
(workDays > 0)
{
tmpDate =
tmpDate.AddDays(1);
if
(tmpDate.DayOfWeek < DayOfWeek.Saturday
&&
tmpDate.DayOfWeek > DayOfWeek.Sunday)
workDays--;
}
}
if
(!transtype && daysSkip) // Card Days
Condition Checking for only Sundays
{
while
(workDays > 0)
{
tmpDate = tmpDate.AddDays(1);
if
(tmpDate.DayOfWeek > DayOfWeek.Sunday)
workDays--;
}
}
if
(!transtype && !daysSkip) // Card
{
tmpDate = AddWorkdays(tmpDate,
workDays, false, true);
}
return
tmpDate;
}
No comments:
Post a Comment