private List <AcrossDateEntity> GetAcrossDate(DateTime sDate, DateTime eDate, CoetAnalyseAddPart part, int addNum) { List <AcrossDateEntity> acrossDateList = new List <AcrossDateEntity>(); DateTime acrossDate = sDate; if (eDate > sDate) { if (sDate.AddDate(addNum, part) > eDate) { acrossDateList.Add(new AcrossDateEntity { StartDate = acrossDate, EndDate = eDate }); } else { while (true) { if (acrossDate < eDate) { AcrossDateEntity ad = new AcrossDateEntity(); ad.StartDate = acrossDate; acrossDate = acrossDate.AddDate(addNum, part); if (acrossDate > eDate) { ad.EndDate = eDate; } else { ad.EndDate = acrossDate; } acrossDateList.Add(ad); } else { break; } } } } return(acrossDateList); }