Esempio n. 1
0
        private void EditAppSetting(AppSettingEnum type, string value)
        {
            AppSetting setting = AppSettingsRepository.GetSingle(x => x.Type == type);

            if (setting == null)
            {
                throw new BussinesException(3058, ErrorResource.NoData);
            }

            setting.Value = value;
            AppSettingsRepository.Edit(setting);
        }
Esempio n. 2
0
        private T GetSetting <T>(AppSettingEnum type)
        {
            if (_appSettings == null)
            {
                _appSettings = AppSettingsRepository.GetAll();
            }
            AppSetting element = _appSettings.FirstOrDefault(x => x.Type == type);

            if (element == null || element.Value == null)
            {
                throw new Exception(string.Format(ErrorResource.NoSetting, type.ToString()));
            }

            return((T)Convert.ChangeType(element.Value, typeof(T), CultureInfo.InvariantCulture));
        }
        public T GetAppSetting <T>(AppSettingEnum appenum)
        {
            var value = _AppSettingRepository.GetById((int)appenum).Value;

            return((T)Convert.ChangeType(value, typeof(T)));
        }