private void LoadProperties() { using (IDataReader reader = DBUser.GetProperties(m_UserID)) { if (reader != null) { while (reader.Read()) { string name = (string)reader["Key"]; if (!m_properties.ContainsKey(name)) { m_properties[name] = new UserLightProperty((int)reader["SettingId"], name, (string)reader["Value"]); } } } } }
public void Add(string Name, string Value) { using (DbTransaction tran = DbTransaction.Begin()) { int id = DBUser.SetProperty(m_UserID, Name, Value); UserLightProperty prop = (UserLightProperty)m_properties[Name]; if (prop != null && prop.PropertyID == id) { prop.Value = Value; } else { m_properties[Name] = new UserLightProperty(id, Name, Value); } tran.Commit(); } }
public string this[string Name] { get { string ret = null; UserLightProperty prop = (UserLightProperty)m_properties[Name]; if (prop != null) { ret = prop.Value; } return(ret); } set { if (value != null) { this.Add(Name, value); } else { this.Remove(Name); } } }
private void LoadProperties() { using(IDataReader reader = DBUser.GetProperties(m_UserID)) { if(reader != null) { while(reader.Read()) { string name = (string)reader["Key"]; if(!m_properties.ContainsKey(name)) m_properties[name] = new UserLightProperty((int)reader["SettingId"], name, (string)reader["Value"]); } } } }
public void Add(string Name, string Value) { using(DbTransaction tran = DbTransaction.Begin()) { int id = DBUser.SetProperty(m_UserID, Name, Value); UserLightProperty prop = (UserLightProperty)m_properties[Name]; if(prop != null && prop.PropertyID == id) prop.Value = Value; else m_properties[Name] = new UserLightProperty(id, Name, Value); tran.Commit(); } }