17,740
社区成员
发帖
与我相关
我的任务
分享
public Dictionary<long, DateTime> CheckedClientData(Dictionary<long, DateTime> dictionary)
{
var tempDic = dictionary.ToDictionary(keys=>keys.Key, values=>values.Value);
using (var db = new historyContext())
{
//修改
var queryResult = db.history.Select(x => x);
foreach (var id in dictionary.Keys)
{
var clientDataTimestamp = dictionary[id];
var result = queryResult.Select(x => x.id == id);
if (result.Count() > 0)
{
var data = queryResult.First();
if (data.lastRemoteUpdate < clientDataTimestamp)//
{
continue;
}
else
{
tempDic.Remove(id);
}
}
else
{
tempDic[id] = new DateTime(0);
}
}
}
return tempDic;
}