Пример #1
0
 public void MoveItemsToHistory(DateTime endTime)
 {
     endTime = endTime.Date;
     try
     {
         trans.BeginTransaction();
         var items = repoTi.Query(o => o.ActionTime < endTime);
         foreach (var item in items)
         {
             var obj = new TimelineItemHistory()
             {
                 ItemId     = item.ItemId,
                 ClientId   = item.ClientId,
                 EventType  = item.EventType,
                 EventName  = item.EventName,
                 UserId     = item.UserId,
                 UserName   = item.UserName,
                 UserType   = item.UserType,
                 Title      = item.Title,
                 Decription = item.Decription,
                 ImageUrl   = item.ImageUrl,
                 DetailUrl  = item.DetailUrl,
                 LinkUrl    = item.LinkUrl,
                 UserUrl    = item.UserUrl,
                 SiteName   = item.SiteName,
                 SiteUrl    = item.SiteUrl,
                 ActionTime = item.ActionTime,
                 Keywords   = item.Keywords
             };
             repoTih.Insert(obj);
             repoTi.Delete(item);
         }
         trans.Commit();
     }
     catch (Exception ex)
     {
         trans.Rollback();
     }
 }
Пример #2
0
 public void MoveItemsToHistory(DateTime endTime)
 {
     endTime = endTime.Date;
     try
     {
         trans.BeginTransaction();
         var items = repoTi.Query(o => o.ActionTime < endTime);
         foreach (var item in items)
         {
             var obj = new TimelineItemHistory()
             {
                 ItemId = item.ItemId,
                 ClientId = item.ClientId,
                 EventType = item.EventType,
                 EventName = item.EventName,
                 UserId = item.UserId,
                 UserName = item.UserName,
                 UserType = item.UserType,
                 Title = item.Title,
                 Decription = item.Decription,
                 ImageUrl = item.ImageUrl,
                 DetailUrl = item.DetailUrl,
                 LinkUrl = item.LinkUrl,
                 UserUrl = item.UserUrl,
                 SiteName = item.SiteName,
                 SiteUrl = item.SiteUrl,
                 ActionTime = item.ActionTime,
                 Keywords = item.Keywords
             };
             repoTih.Insert(obj);
             repoTi.Delete(item);
         }
         trans.Commit();
     }
     catch (Exception ex)
     {
         trans.Rollback();
     }
 }