Exemple #1
0
        public void SetUserPreference(int id, string pref, object value)
        {
            var u = Users.Single(uu => uu.UserId == id);
            var p = u.Preferences.SingleOrDefault(up => up.PreferenceX == pref);

            if (p != null)
            {
                if (p.ValueX == value.ToString())
                {
                    return;
                }
                p.ValueX = value.ToString();
            }
            else
            {
                p = new Preference {
                    UserId = id, PreferenceX = pref, ValueX = value.ToString()
                };
                Preferences.InsertOnSubmit(p);
            }
            SubmitChanges();
        }
Exemple #2
0
 private void detach_Preferences(Preference entity)
 {
     this.SendPropertyChanging();
     entity.User = null;
 }
Exemple #3
0
 private void attach_Preferences(Preference entity)
 {
     this.SendPropertyChanging();
     entity.User = this;
 }
Exemple #4
0
 private void detach_Preferences(Preference entity)
 {
     this.SendPropertyChanging();
     entity.User = null;
 }
Exemple #5
0
 private void attach_Preferences(Preference entity)
 {
     this.SendPropertyChanging();
     entity.User = this;
 }