日期:2014-05-17 浏览次数:21785 次
Entities data=new Entities();
var list = from p in data.Record
where p.CreateTime >= d && p.CreateTime < DateTime.Today
select new
{
ID = p.ID,
Name = p.Name,
UserID=p.UserID
};
foreach (var item in list)
{
var record = data.Record.FirstOrDefault(a => a.ID == item.ID);
if (record != null)
{
record.RankTime = record.CreateTime.AddDays(3);
data.SaveChanges();
BusinessModel.KeywordRank mod = new KeywordRank();
mod.RecordID = item.ID;
mod.UserID = item.UserID;
mod.Name = item.Name;
mod.Rank = 0;
mod.CreateTime = DateTime.Now;
data.KeywordRank.Add(mod);
data.SaveChanges(); &nbs