private void detach_application_settings(application_setting entity) { this.SendPropertyChanging(); entity.person = null; }
partial void Deleteapplication_setting(application_setting instance);
partial void Updateapplication_setting(application_setting instance);
partial void Insertapplication_setting(application_setting instance);
private void attach_application_settings(application_setting entity) { this.SendPropertyChanging(); entity.application = this; }
public bool SetAppData(string personId, string key, string value, string appId) { if (string.IsNullOrEmpty(value)) { // empty key kind of became to mean "delete data" (was an old orkut hack that became part of the spec spec) var ret = new application_setting { application_id = int.Parse(appId), person_id = int.Parse(personId), name = key }; db.application_settings.DeleteOnSubmit(ret); db.SubmitChanges(); if (db.GetChangeSet().Deletes.Count != 0) return false; } else { var ret = db.application_settings .Where(x => x.application_id.ToString() == appId && x.person_id.ToString() == personId && x.name == key).SingleOrDefault(); if (ret == null) { ret = new application_setting { application_id = int.Parse(appId), person_id = int.Parse(personId), name = key, value = value }; db.application_settings.InsertOnSubmit(ret); db.SubmitChanges(); if (db.GetChangeSet().Inserts.Count != 0) return false; } else { ret.value = value; db.SubmitChanges(); if (db.GetChangeSet().Updates.Count != 0) return false; } } return true; }