Beispiel #1
0
        //REMOVE VALUE
        public static void Remove(string key)
        {
            DBFrontEnd db = new DBFrontEnd();
            Setting    _v = db.Settings.SingleOrDefault(o => o.Key == key);

            if (_v != null)
            {
                db.Settings.Remove(_v);
                db.SaveChanges();
            }
        }
Beispiel #2
0
        //GET KEY = bla bla bla
        public static string Get(string key)
        {
            DBFrontEnd db = new DBFrontEnd();
            Setting    _v = db.Settings.SingleOrDefault(o => o.Key == key);

            if (_v != null)
            {
                if (_v.Value == null)
                {
                    return("");
                }
                else
                {
                    return(_v.Value);
                }
            }
            return("");
        }
Beispiel #3
0
        //SET KEY = bla bla...
        public static void Set(string key, string value)
        {
            DBFrontEnd db = new DBFrontEnd();
            Setting    _v = db.Settings.SingleOrDefault(o => o.Key == key);

            if (_v != null)
            {
                //UPDATE VALUE
                _v.Value = value;
            }
            else
            {
                //CREAT VALUE
                Setting _n = new Setting();
                _n.Key   = key;
                _n.Value = value;
                db.Settings.Add(_n);
            }
            db.SaveChanges();
        }