Example #1
0
        public static string GetSystemDefault(string key)
        {
            var     db      = new SettingsDataContext();
            Setting setting = db.Settings.FirstOrDefault(s => s.Username == SystemUsername && s.Key == key);

            return(setting == null ? null : setting.Value);
        }
Example #2
0
        private static string GetUsersDefault(string key)
        {
            var     db      = new SettingsDataContext();
            var     user    = GetUserName();
            Setting setting = db.Settings.FirstOrDefault(s => s.Username == user && s.Key == key);

            return(setting == null ? null : setting.Value);
        }
Example #3
0
        private static void SetUsersDefault(string key, string value)
        {
            var db = new SettingsDataContext();

            try
            {
                db.Settings_Update(key, value);
            }
            catch (Exception ex)
            {
                Debug.Print("Unable to save settings (u:{0},k:{1},v:{2}, exception:{3}", GetUserName(), key, value,
                            ex.Message);
            }
        }
Example #4
0
        public static bool PiWantsEmails(string address)
        {
            var database = new AnimalMovementDataContext();
            var pi       = database.ProjectInvestigators.FirstOrDefault(p => p.Email == address);

            if (pi == null)
            {
                return(false);
            }
            var db      = new SettingsDataContext();
            var setting = db.Settings.FirstOrDefault(s => s.Username == pi.Login && s.Key == WantsEmailKey);

            //default is to get email, unless explicitly and correctly denied
            return(setting == null || setting.Value != false.ToString(CultureInfo.InvariantCulture));
        }