// Token: 0x06000701 RID: 1793 RVA: 0x0002C904 File Offset: 0x0002AB04 internal static void Show(Dictionary <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> moduleExpirations) { bool flag = moduleExpirations.Any((KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> m) => m.Value.DaysToExpire <= 0); int daysToExpire = moduleExpirations.Min((KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> x) => x.Value.DaysToExpire); string url = "javascript:SW.Core.SalesTrigger.ShowMaintenancePopupAsync();"; Guid typeId = flag ? MaintenanceExpirationNotificationItemDAL.MaintenanceExpiredNotificationTypeGuid : MaintenanceExpirationNotificationItemDAL.MaintenanceExpirationWarningNotificationTypeGuid; int maintenanceExpiredShowAgainAtDays = BusinessLayerSettings.Instance.MaintenanceExpiredShowAgainAtDays; MaintenanceExpirationNotificationItemDAL item = MaintenanceExpirationNotificationItemDAL.GetItem(); if (item == null) { string description = MaintenanceExpirationNotificationItemDAL.Serialize(moduleExpirations); NotificationItemDAL.Insert(MaintenanceExpirationNotificationItemDAL.MaintenanceExpirationNotificationItemId, typeId, MaintenanceExpirationNotificationItemDAL.GetNotificationMessage(flag, daysToExpire), description, false, url, null, null); return; } Dictionary <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> previousExpirations = MaintenanceExpirationNotificationItemDAL.Deserialize(item.Description); IEnumerable <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> > previousExpirations2 = previousExpirations; Func <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo>, bool> < > 9__2; Func <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo>, bool> predicate; if ((predicate = < > 9__2) == null) { predicate = (< > 9__2 = ((KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> previousExpiration) => moduleExpirations.ContainsKey(previousExpiration.Key))); } foreach (KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> keyValuePair in previousExpirations2.Where(predicate)) { moduleExpirations[keyValuePair.Key].LastRemindMeLaterDate = keyValuePair.Value.LastRemindMeLaterDate; } DateTime utcNow = DateTime.UtcNow; int num = (int)utcNow.Subtract(item.AcknowledgedAt ?? DateTime.UtcNow).TotalDays; DateTime?acknowledgedAt = item.AcknowledgedAt; foreach (KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> keyValuePair2 in moduleExpirations) { if ((previousExpirations.ContainsKey(keyValuePair2.Key) || num != maintenanceExpiredShowAgainAtDays) && (!previousExpirations.ContainsKey(keyValuePair2.Key) || keyValuePair2.Value.DaysToExpire <= 0 || num != maintenanceExpiredShowAgainAtDays) && (!previousExpirations.ContainsKey(keyValuePair2.Key) || previousExpirations[keyValuePair2.Key].DaysToExpire <= 0 || keyValuePair2.Value.DaysToExpire > 0)) { utcNow = DateTime.UtcNow; if ((int)utcNow.Subtract(keyValuePair2.Value.LastRemindMeLaterDate ?? DateTime.UtcNow).TotalDays != maintenanceExpiredShowAgainAtDays) { continue; } } item.SetNotAcknowledged(); break; } if (acknowledgedAt != null) { IEnumerable <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> > moduleExpirations2 = moduleExpirations; Func <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo>, bool> < > 9__3; Func <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo>, bool> predicate2; if ((predicate2 = < > 9__3) == null) { predicate2 = (< > 9__3 = ((KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> m) => m.Value.DaysToExpire <= 0 && m.Value.LastRemindMeLaterDate == null && previousExpirations.ContainsKey(m.Key) && previousExpirations[m.Key].DaysToExpire <= 0)); } foreach (KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> keyValuePair3 in moduleExpirations2.Where(predicate2)) { keyValuePair3.Value.LastRemindMeLaterDate = acknowledgedAt; } } item.TypeId = typeId; item.Description = MaintenanceExpirationNotificationItemDAL.Serialize(moduleExpirations); item.Url = url; item.Title = MaintenanceExpirationNotificationItemDAL.GetNotificationMessage(flag, daysToExpire); item.Update(); }
internal static void Show( Dictionary <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> moduleExpirations) { bool expired = moduleExpirations.Any <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> >((Func <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo>, bool>)(m => m.Value.DaysToExpire <= 0)); int daysToExpire = moduleExpirations.Min <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> >((Func <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo>, int>)(x => x.Value.DaysToExpire)); string url = "javascript:SW.Core.SalesTrigger.ShowMaintenancePopupAsync();"; Guid typeId = expired ? MaintenanceExpirationNotificationItemDAL.MaintenanceExpiredNotificationTypeGuid : MaintenanceExpirationNotificationItemDAL.MaintenanceExpirationWarningNotificationTypeGuid; int expiredShowAgainAtDays = BusinessLayerSettings.Instance.MaintenanceExpiredShowAgainAtDays; MaintenanceExpirationNotificationItemDAL notificationItemDal = MaintenanceExpirationNotificationItemDAL.GetItem(); if (notificationItemDal == null) { string description = MaintenanceExpirationNotificationItemDAL.Serialize(moduleExpirations); NotificationItemDAL.Insert(MaintenanceExpirationNotificationItemDAL.MaintenanceExpirationNotificationItemId, typeId, MaintenanceExpirationNotificationItemDAL.GetNotificationMessage(expired, daysToExpire), description, false, url, new DateTime?(), (string)null); } else { Dictionary <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> previousExpirations = MaintenanceExpirationNotificationItemDAL.Deserialize(notificationItemDal.Description); foreach (KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> keyValuePair in previousExpirations.Where <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> >((Func <KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo>, bool>)(previousExpiration => moduleExpirations.ContainsKey(previousExpiration.Key)))) { moduleExpirations[keyValuePair.Key].LastRemindMeLaterDate = keyValuePair.Value.LastRemindMeLaterDate; } DateTime utcNow1 = DateTime.UtcNow; ref DateTime local1 = ref utcNow1; DateTime? nullable = notificationItemDal.AcknowledgedAt; DateTime dateTime1 = nullable ?? DateTime.UtcNow; int totalDays = (int)local1.Subtract(dateTime1).TotalDays; DateTime? acknowledgedAt = notificationItemDal.AcknowledgedAt; foreach (KeyValuePair <string, MaintenanceExpirationNotificationItemDAL.ExpirationInfo> moduleExpiration in moduleExpirations) { if ((previousExpirations.ContainsKey(moduleExpiration.Key) || totalDays != expiredShowAgainAtDays) && (!previousExpirations.ContainsKey(moduleExpiration.Key) || moduleExpiration.Value.DaysToExpire <= 0 || totalDays != expiredShowAgainAtDays) && (!previousExpirations.ContainsKey(moduleExpiration.Key) || previousExpirations[moduleExpiration.Key].DaysToExpire <= 0 || moduleExpiration.Value.DaysToExpire > 0)) { DateTime utcNow2 = DateTime.UtcNow; ref DateTime local2 = ref utcNow2; nullable = moduleExpiration.Value.LastRemindMeLaterDate; DateTime dateTime2 = nullable ?? DateTime.UtcNow; if ((int)local2.Subtract(dateTime2).TotalDays != expiredShowAgainAtDays) { continue; } } notificationItemDal.SetNotAcknowledged(); break; }