public void Insert(Setting setting) { #region Checking prerequisities if (setting == null) throw new ArgumentNullException("setting"); if (setting.Name == null) throw new ArgumentException("setting.Name"); if (setting.Value == null) throw new ArgumentException("setting.Name"); #endregion EXterm.DbConnection.Lock(); EXterm.DbConnection.ExecuteNonQuery( "INSERT INTO Setting (" + "'Name', 'Value'" + ") VALUES (" + "'" + setting.Name + "', " + "'" + setting.Value + "' " + ")" ); setting.Dirty = false; EXterm.DbConnection.Unlock(); }
public void Update(Setting setting) { #region Checking prerequisities if (setting == null) throw new ArgumentNullException("setting"); if (setting.Name == null) throw new ArgumentException("setting.Name"); if (setting.Value == null) throw new ArgumentException("setting.Name"); #endregion if (!setting.Dirty) return; EXterm.DbConnection.Lock(); EXterm.DbConnection.ExecuteNonQuery( "UPDATE Setting SET " + "Value = '" + setting.Value + "' " + "WHERE Name = '" + setting.Name + "' " ); EXterm.DbConnection.Unlock(); setting.Dirty = false; }