Hello
I would like make this code can insert it in sql.
So if i want add new date holy, i would like get dates from sql server.
Any guide please.
private List<DateTime> Holiday()
{
List<DateTime> dates = new List<DateTime>();
dates.Add(new DateTime(2023, 01, 21));
dates.Add(new DateTime(2023, 01, 25));
dates.Add(new DateTime(2023, 01, 26));
return dates;
}
private void cal_vaca()
{
DateTime d1 = Convert.ToDateTime(txtBoxDate8.Text);
DateTime d2 = Convert.ToDateTime(txtBoxDate10.Text);
var totalDays = (d2 - d1).Days;
int wd = 0;
for (int x = 0; x <= totalDays; x++)
{
DateTime currendDate = d1.AddDays(x);
if (currendDate.DayOfWeek != DayOfWeek.Friday)
{
if (!Holiday().Contains(d1.AddDays(x)))
{
wd += 1;
}
}
}
lblLabel2.Text = wd.ToString();
}