public static ApiResult GetSendDate(DateTime dt, int days)
{
List<Sys_T_Holiday> list = provider.Query<Sys_T_Holiday>().Where(item=>item.iYear==dt.Year).ToList();
if (list != null && list.Count > 0)
{
int iDay = 0;
while (iDay < days)
{
dt = dt.AddDays(1);
if (IsHoliday(list,dt) == false)
{
iDay += 1;
}
}
}
return new ApiResult(true) { result = dt };
}
private static bool IsHoliday(List<Sys_T_Holiday> list,DateTime start)
{
string str = start.ToString("yyyy-MM-dd");
var list1=list.Where(item => item.sDate == str).ToList();
if (list1 != null && list1.Count > 0)
{
if (list1[0].sType == "1")//节假日休息
{
return true;
}
else
{
return false;
}
}
else
{
if ((int)start.DayOfWeek == 0 || (int)start.DayOfWeek == 6)//周末
{
return true;
}
else
{
return false;
}
}
}