protected string FindSettingsProperty(string propertyKey, string defaultValue = null)
        {
            var fullPropertyKey = GetFullPropertyKey(propertyKey);
            var settingProperty = _settingsRepository.FindSettingByKey(fullPropertyKey);

            if (settingProperty != null)
            {
                // property object exists - check if value column is not null
                return(settingProperty.Value ?? defaultValue);
            }
            return(defaultValue);
        }
예제 #2
0
        private DateTime GetLastCreationDateFromSettings(DateTime currentDate)
        {
            var      lastCreatedDateSetting = _settingRepository.FindSettingByKey(lastCreatedDateSettingKey);
            var      _14DaysAgo             = currentDate.Date.AddDays(-14);
            DateTime lastCreatedDate;

            if (lastCreatedDateSetting == null || !DateTime.TryParse(lastCreatedDateSetting.Value, out lastCreatedDate))
            {
                lastCreatedDate = currentDate.Date;
            }
            else
            {
                if (lastCreatedDate < _14DaysAgo)
                {
                    lastCreatedDate = _14DaysAgo;
                }
            }
            return(lastCreatedDate);
        }