private static void SyncLonghu(DateTime from, DateTime to) { var date = from.Date; while (date < to) { var list = SinaBiz.GetLonghuList(date); if (!list.IsNullOrEmpty()) { for (var index = list.Count() - 1; index > 0; index--) { for (var j = 0; j < index; j++) { if (list[index].IsEqual(list[j])) { list.RemoveAt(index); break; } } } var dbList = LonghuDAL.GetLonghu(list.First().InDate.Value.AddDays(-5)); list.RemoveAll(item => dbList.Exists(dbitem => dbitem.IsEqual(item))); } if (!list.IsNullOrEmpty()) { LonghuDAL.Insert(list); } date = date.AddDays(1); } }
public static void SyncLonghu() { var date = LonghuDAL.GetMaxDate().GetValueOrDefault(DateTime.Now.AddDays(-3).Date); SyncLonghu(date, DateTime.Now.AddDays(1)); }