//遍历集合,把没有的天数加上
//相差的天数
double days = Math.Ceiling((detail.m_sEndDate - detail.m_sStartDate).TotalDays);
DateTime tempToday;
bool isExist = false;
CurveListItem tempCurveListItem=null;
for (int i = 0; i <= days; i++)
{
tempToday = detail.m_sStartDate.AddDays(i);
isExist = false;//开始默认为false,如果存在则赋值就跳出
foreach (var item in CurveListItemLists)
{
if (Convert.ToDateTime(item.m_sDate).ToString("yyyy-MM-dd") == tempToday.ToString("yyyy-MM-dd"))
{
isExist = true;
tempCurveListItem = item;
break;
}
}
//遍历完CurveListItemLists后,看看是否存在
if (isExist)
{
CurveListItemListsNew.Add(tempCurveListItem);
}
else
{
CurveListItem model = new CurveListItem();
model.m_sDate = tempToday.ToString("yyyy-MM-dd HH:mm:ss");
model.m_iCount = 0;
CurveListItemListsNew.Add(model);
}
}