private void operationIsSeenCheck(ArticalOverview[] articalOverviews) { if (db == null) { throw new InvalidOperationException("Database is not created yet."); } lock (articalOverviews) { foreach (var overview in articalOverviews) { if (!overview.IsDatabaseConfirmed_SeenOn) { try { var data = db.Get <BrowserHistoryTable>(BrowserHistoryTable.GetPrimaryKey(overview)); overview.IsDatabaseConfirmed_SeenOn = true; if (data != null) { overview.SeenOn = data.LastSeenOn; } else { overview.SeenOn = null; } } catch (Exception ex) { Log.Error("operationIsSeenCheck", ex.Message); } } } } }
private void operationUpdateIsSeen(ArticalOverview[] articalOverviews) { if (db == null) { throw new InvalidOperationException("Database is not created yet."); } lock (articalOverviews) { foreach (var overview in articalOverviews) { overview.SeenOn = DateTime.Today.ToString("yyyyMMdd"); overview.IsDatabaseConfirmed_SeenOn = true; var obj = BrowserHistoryTable.New(overview); try { if (db.Insert(obj) != 0) { db.Update(obj); } } catch (Exception ex) { try { db.Update(obj); } catch (Exception ex1) { Log.Error("operationUpdateIsSeen -- update", ex1.Message); } Log.Error("operationUpdateIsSeen -- edit", ex.Message); } } } }