Ejemplo n.º 1
0
        public FortressSettings GetSettingsFromDatabase()
        {
            var db = ApplicationContext.Current.DatabaseContext.Database;

            var results = db.Fetch <FortressSettingEntry>("SELECT * FROM FortressSettings");
            var model   = new FortressSettings(results);

            return(model);
        }
Ejemplo n.º 2
0
        public FortressSettings GetSettingsFromDatabase()
        {
            var db    = ApplicationContext.Current.DatabaseContext.Database;
            var query = new Sql().Select("*").From <FortressSettingEntry>(SqlSyntaxProvider);

            var results = db.Fetch <FortressSettingEntry>(query);
            var model   = new FortressSettings(results);

            return(model);
        }
Ejemplo n.º 3
0
        public static IEnumerable <FortressSettingEntry> GetDefaultSettings()
        {
            var model = new FortressSettings(new List <FortressSettingEntry>());

            model.GoogleAuthenticator_Enabled = true;
            model.GoogleAuthenticator_Name    = "My Umbraco Site";

            var data = model.GetRawData().Select(x => x.Value);

            return(data);
        }
Ejemplo n.º 4
0
        public static IEnumerable <FortressSettingEntry> GetDefaultSettings()
        {
            var model = new FortressSettings(new List <FortressSettingEntry>());

            model.BackofficeFirewallMode      = FirewallMode.Disabled;
            model.FrontEndFirewallMode        = FirewallMode.Disabled;
            model.GoogleAuthenticator_Enabled = true;
            model.GoogleAuthenticator_Name    = "My Umbraco Site";
            model.SMS_Enabled            = false;
            model.SMS_MessageFormat      = "Your auth key is {0}";
            model.SMS_CurrentSMSProvider = "";
            var data = model.GetRawData().Select(x => x.Value);

            return(data);
        }
Ejemplo n.º 5
0
        public void SaveSettings(FortressSettings settings)
        {
            var db   = ApplicationContext.Current.DatabaseContext.Database;
            var data = settings.GetRawData().Select(x => x.Value);
            var currentDatabaseSettings = GetSettingsFromDatabase();
            var currentData             = currentDatabaseSettings.GetRawData();

            foreach (var fortressSettingEntry in data)
            {
                if (currentData.ContainsKey(fortressSettingEntry.Key))
                {
                    db.Update(fortressSettingEntry);
                }
                else
                {
                    db.Insert(fortressSettingEntry);
                }
            }
        }