Exemple #1
0
        public IList <Settings> GetSettingsByType(SettingTypeEnum settingType)
        {
            var settings = (from c in _settingRepository.Table
                            orderby c.Id
                            where c.SettingType == (int)settingType
                            select c).ToList();

            return(settings);
        }
Exemple #2
0
 public Setting(string name, string description, bool isActive, string watchPathAbsolut, string pluginPath, string downloadServerUrl,
                string creator, SettingTypeEnum type) :
     base(name, description)
 {
     IsActive          = isActive;
     WatchPathAbsolut  = watchPathAbsolut;
     PluginPath        = pluginPath;
     IsDefault         = type == SettingTypeEnum.Default;
     DownloadServerUrl = downloadServerUrl;
     CreatorName       = creator;
     Type = type;
 }
        private SettingEntity GetSetting(SettingTypeEnum settingType)
        {
            var setting = _databaseService.Find <SettingEntity>(settingType);

            if (setting == null)
            {
                setting = new SettingEntity
                {
                    Setting = settingType,
                    Value   = GetSettingDefaultValue(settingType)
                };

                _databaseService.InsertOrReplace(setting);
            }

            return(setting);
        }
        private string GetSettingDefaultValue(SettingTypeEnum settingType)
        {
            switch (settingType)
            {
            case SettingTypeEnum.MinTime:
                return(DefaultMinTime.ToString());

            case SettingTypeEnum.MinDistance:
                return(DefaultMinDistance.ToString());

            case SettingTypeEnum.IsTelegramUploadEnabled:
            case SettingTypeEnum.IsEmailSendingEnabled:
            case SettingTypeEnum.UploadOnMobileNetwork:
            case SettingTypeEnum.DisableTrackingOnWifi:
                return(false.ToString());

            case SettingTypeEnum.UploadUrl:
            case SettingTypeEnum.TelegramBotToken:
            case SettingTypeEnum.TelegramChatId:
            case SettingTypeEnum.SmtpUsername:
            case SettingTypeEnum.SmtpPassword:
            case SettingTypeEnum.EmailRecipient:
                return(string.Empty);

            case SettingTypeEnum.SmtpPort:
                return("587");

            case SettingTypeEnum.SmtpHost:
                return("smtp.gmail.com");

            case SettingTypeEnum.EmailSendingInterval:
                return("30");

            case SettingTypeEnum.EmailSubject:
                return("GPS tracker");

            case SettingTypeEnum.KeepLocationsForDays:
                return(30.ToString());

            default:
                throw new ArgumentOutOfRangeException(nameof(settingType));
            }
        }
Exemple #5
0
 public TLCGenCustomSettingAttribute()
 {
     SettingType = SettingTypeEnum.Application;
 }
Exemple #6
0
 /// <summary>
 /// Property Attribute to indicate a property is meant as setting for a
 /// class that implements IGenerator.
 /// </summary>
 /// <param name="type">The type of setting. Can be "application" for an application wide setting
 /// of "controller" for a setting per controller</param>
 public TLCGenCustomSettingAttribute(SettingTypeEnum type)
 {
     SettingType = type;
 }