//################################################################################### public static void MarkReadFeedEntryAll() { if (_tableFeed == null) { return; } //Alle FeedEntries als gelesen markieren foreach (var key in new List <string>(_tableFeed.Keys.ToList())) { if (!_tableFeed.ContainsKey(key)) { return; } var item = _tableFeed[key]; item.MarkedRead = true; _tableFeed[key] = item; } //Die Einträge in der Datenbank ändern if (!DB_Object.Open()) { return; } DB_Object.MarkReadFeedEntryAll(); DB_Object.Close(); }
public static void MarkReadShiftsEntry(string key) { if (_tableShifts == null || !_tableShifts.ContainsKey(key)) { return; } //Einzelnes SchichtItem als gelesen markieren var item = _tableShifts[key]; item.MarkedRead = true; _tableShifts[key] = item; //Datenbank ändern if (!DB_Object.Open()) { return; } DB_Object.MarkReadShiftsEntry(item); DB_Object.Close(); }
public static void MarkReadFeedEntry(string key) { if (_tableFeed == null || !_tableFeed.ContainsKey(key)) { return; } //Einzelnes FeedItem als gelesen markieren var item = _tableFeed[key]; item.MarkedRead = true; _tableFeed[key] = item; //Einzelnes Item in der Datenbank ändern if (!DB_Object.Open()) { return; } DB_Object.MarkReadFeedEntry(item); DB_Object.Close(); }
public static void UpdateEntries(List <FeedEntry> list, bool reportNew = false) { if (!DB_Object.Open()) { return; } //Benachrichtungen bei neuen Sachen var notify = new Notification.NotifySettings(Notify_Object.NotificationContext, NotificationType); //Table erstellen if (_tableFeed == null) { _tableFeed = new Dictionary <string, FeedEntry>(); } if (_tableShifts == null) { _tableShifts = new Dictionary <string, ShiftsEntry>(); } //Rohentries verarbeiten DateTime oldOffset = DateTime.Now.AddMonths(-PREF_FEED_AUTOREMOVE); foreach (var item in list) { if (item.Date > oldOffset) { if (IsShiftsEntry(item, out ShiftsEntry shiftsItem)) { //ShiftsEntry if (!_tableShifts.ContainsKey(shiftsItem.Key)) { _tableShifts.Add(shiftsItem.Key, shiftsItem); notify.AddNewShifts(shiftsItem); DB_Object.SaveShiftsEntry(shiftsItem, false); } else { DateTime oldTime = _tableShifts[shiftsItem.Key].LastUpdate; if (oldTime < shiftsItem.LastUpdate) { int oldID = _tableShifts[shiftsItem.Key].ID; shiftsItem.ID = oldID; int oldAttachmentID = _tableShifts[shiftsItem.Key].ShiftAttachment.ID; shiftsItem.ShiftAttachment.ID = oldAttachmentID; _tableShifts[shiftsItem.Key] = shiftsItem; notify.AddNewShiftsVersion(shiftsItem); DB_Object.SaveShiftsEntry(shiftsItem, true); } } } else { //FeedEntry if (!_tableFeed.ContainsKey(item.Key)) { _tableFeed.Add(item.Key, item); notify.AddFeedEntry(item); DB_Object.SaveFeedEntry(item); } } } } //Listen sortieren if (reportNew && NotificationType != Notification.NotifySettings.NotifySettingsType.NO_NOTIFICATION) { Notify_Object.CreateNotification(notify); } LastTableRefresh = DateTime.Now; SaveSettings(cc); DB_Object.Close(); }