// Token: 0x060006CB RID: 1739 RVA: 0x0002B2A0 File Offset: 0x000294A0
        private void Show(IDictionary <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> expirations)
        {
            EvaluationExpirationNotificationItemDAL item = EvaluationExpirationNotificationItemDAL.GetItem();

            if (item == null)
            {
                string description = EvaluationExpirationNotificationItemDAL.Serialize(expirations);
                NotificationItemDAL.Insert(EvaluationExpirationNotificationItemDAL.EvaluationExpirationNotificationItemId, EvaluationExpirationNotificationItemDAL.EvaluationExpirationNotificationTypeGuid, Resources.LIBCODE_LC0_1, description, false, "javascript:SW.Core.SalesTrigger.ShowEvalPopupAsync();", null, null);
                return;
            }
            Dictionary <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> previousExpirations = EvaluationExpirationNotificationItemDAL.Deserialize(item.Description);
            int showExpiredAgainAt = BusinessLayerSettings.Instance.EvaluationExpirationShowAgainAtDays;
            IEnumerable <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> > previousExpirations2 = previousExpirations;

            Func <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo>, bool> < > 9__1;
            Func <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo>, bool> predicate;

            if ((predicate = < > 9__1) == null)
            {
                predicate = (< > 9__1 = ((KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> previousExpiration) => expirations.ContainsKey(previousExpiration.Key)));
            }
            foreach (KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> keyValuePair in previousExpirations2.Where(predicate))
            {
                expirations[keyValuePair.Key].LastRemindMeLater = keyValuePair.Value.LastRemindMeLater;
            }
            int      daysFromLastRemindMeLater = (int)DateTime.UtcNow.Subtract(item.AcknowledgedAt ?? DateTime.UtcNow).TotalDays;
            DateTime?acknowledgedAt            = item.AcknowledgedAt;

            if (expirations.Any((KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> module) => !previousExpirations.ContainsKey(module.Key) || (previousExpirations.ContainsKey(module.Key) && module.Value.DaysToExpire > 0 && daysFromLastRemindMeLater == showExpiredAgainAt) || (previousExpirations.ContainsKey(module.Key) && previousExpirations[module.Key].DaysToExpire > 0 && module.Value.DaysToExpire <= 0) || (int)DateTime.UtcNow.Subtract(module.Value.LastRemindMeLater ?? DateTime.UtcNow).TotalDays == showExpiredAgainAt))
            {
                item.SetNotAcknowledged();
            }
            if (acknowledgedAt != null)
            {
                IEnumerable <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> > expirations2 = expirations;
                Func <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo>, bool> < > 9__2;
                Func <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo>, bool> predicate2;
                if ((predicate2 = < > 9__2) == null)
                {
                    predicate2 = (< > 9__2 = ((KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> m) => m.Value.DaysToExpire <= 0 && m.Value.LastRemindMeLater == null && previousExpirations.ContainsKey(m.Key) && previousExpirations[m.Key].DaysToExpire <= 0));
                }
                foreach (KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> keyValuePair2 in expirations2.Where(predicate2))
                {
                    keyValuePair2.Value.LastRemindMeLater = acknowledgedAt;
                }
            }
            item.TypeId      = EvaluationExpirationNotificationItemDAL.EvaluationExpirationNotificationTypeGuid;
            item.Description = EvaluationExpirationNotificationItemDAL.Serialize(expirations);
            item.Url         = "javascript:SW.Core.SalesTrigger.ShowEvalPopupAsync();";
            item.Title       = Resources.LIBCODE_LC0_1;
            item.Update();
        }
Beispiel #2
0
        private void Show(
            IDictionary <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> expirations)
        {
            EvaluationExpirationNotificationItemDAL notificationItemDal = EvaluationExpirationNotificationItemDAL.GetItem();

            if (notificationItemDal == null)
            {
                string description = EvaluationExpirationNotificationItemDAL.Serialize(expirations);
                NotificationItemDAL.Insert(EvaluationExpirationNotificationItemDAL.EvaluationExpirationNotificationItemId, EvaluationExpirationNotificationItemDAL.EvaluationExpirationNotificationTypeGuid, Resources.get_LIBCODE_LC0_1(), description, false, "javascript:SW.Core.SalesTrigger.ShowEvalPopupAsync();", new DateTime?(), (string)null);
            }
            else
            {
                Dictionary <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> previousExpirations = EvaluationExpirationNotificationItemDAL.Deserialize(notificationItemDal.Description);
                int showExpiredAgainAt = BusinessLayerSettings.Instance.EvaluationExpirationShowAgainAtDays;
                foreach (KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> keyValuePair in previousExpirations.Where <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> >((Func <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo>, bool>)(previousExpiration => expirations.ContainsKey(previousExpiration.Key))))
                {
                    expirations[keyValuePair.Key].LastRemindMeLater = keyValuePair.Value.LastRemindMeLater;
                }
                int      daysFromLastRemindMeLater = (int)DateTime.UtcNow.Subtract(notificationItemDal.AcknowledgedAt ?? DateTime.UtcNow).TotalDays;
                DateTime?acknowledgedAt            = notificationItemDal.AcknowledgedAt;
                if (expirations.Any <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> >((Func <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo>, bool>)(module => !previousExpirations.ContainsKey(module.Key) || previousExpirations.ContainsKey(module.Key) && module.Value.DaysToExpire > 0 && daysFromLastRemindMeLater == showExpiredAgainAt || previousExpirations.ContainsKey(module.Key) && previousExpirations[module.Key].DaysToExpire > 0 && module.Value.DaysToExpire <= 0 || (int)DateTime.UtcNow.Subtract(module.Value.LastRemindMeLater ?? DateTime.UtcNow).TotalDays == showExpiredAgainAt)))
                {
                    notificationItemDal.SetNotAcknowledged();
                }
                if (acknowledgedAt.HasValue)
                {
                    foreach (KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> keyValuePair in expirations.Where <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo> >((Func <KeyValuePair <string, EvaluationExpirationNotificationItemDAL.ExpirationInfo>, bool>)(m => m.Value.DaysToExpire <= 0 && (!m.Value.LastRemindMeLater.HasValue && previousExpirations.ContainsKey(m.Key)) && previousExpirations[m.Key].DaysToExpire <= 0)))
                    {
                        keyValuePair.Value.LastRemindMeLater = acknowledgedAt;
                    }
                }
                notificationItemDal.TypeId      = EvaluationExpirationNotificationItemDAL.EvaluationExpirationNotificationTypeGuid;
                notificationItemDal.Description = EvaluationExpirationNotificationItemDAL.Serialize(expirations);
                notificationItemDal.Url         = "javascript:SW.Core.SalesTrigger.ShowEvalPopupAsync();";
                notificationItemDal.Title       = Resources.get_LIBCODE_LC0_1();
                notificationItemDal.Update();
            }
        }