Good afternoon, requesting your help as I have this situation, from two different databases I have to get the working days in one month (L to V) and another get the holidays of the year, which I get for half of a cycle foreach
, the problem is that I can not find the way to pass the value of the holiday as a business date.
That is, from November 1 to November 14 business days should look like this 01, 03, 04, 07, 08, 09, 10, 11, 14, removing from the list on Saturdays and Sundays and 02, which is considered festive in some places to achieve it I am doing the following:
foreach (string DiasHabilesCG in listHabiles)
{
foreach (string DiasFestivos in listFestivos)
{
fechahabil1 = Convert.ToDateTime(fechahabil);
fechafestivo1 = Convert.ToDateTime(fechafestivo);
if (fechafestivo1 != fechahabil1)
{
if (fechafestivo1 == fechahabil1)
{
fechahabil1.AddDays(1);
Result = fechafestivo1.AddDays(1);
if (diafestivo1 == 6)
{
Result = fechafestivo1.AddDays(3);
break;
}
}
}
ResultA = fechahabil1.AddDays(1);
fechahabilant = ResultA.ToString();
}
listHabiles.ToString();
}
It should be mentioned that for this if the holiday falls from Monday to Thursday must add one day to the holiday, that is, if 02 falls from Monday to Thursday it should be seen as 03 and if it falls on Friday it should add 3 days, that is, if 02 / 11/2016 outside Friday should be shown as 05/11/2016 which in that case would be Monday.