public FieldPreValueSource GetPrevalueSource(Guid id) { //check for the default guid so we don't try to look for a provider which are not there.. //this could be considered a hack, but not everything can follow a generic model. FieldPreValueSource pv = new FieldPreValueSource(); if (id == FieldPreValueSource.GetDefaultProvider().Id) { pv = FieldPreValueSource.GetDefaultProvider(); } else { string sql = "SELECT * From UFPrevalueSources where id = @id"; IRecordsReader rr = sqlHelper.ExecuteReader(sql, sqlHelper.CreateParameter("@id", id)); if (rr.Read()) { pv = FieldPreValueSource.CreateFromDataReader(rr); pv.Settings = settings.GetSettings(pv.Id); rr.Dispose(); return(pv); } rr.Dispose(); } return(pv); }
public List <FieldPreValueSource> GetAllPrevalueSources() { List <FieldPreValueSource> l = new List <FieldPreValueSource>(); string sql = "SELECT * From UFPrevalueSources ORDER BY name ASC"; IRecordsReader rr = sqlHelper.ExecuteReader(sql); while (rr.Read()) { FieldPreValueSource pv = FieldPreValueSource.CreateFromDataReader(rr); pv.Settings = settings.GetSettings(pv.Id); l.Add(pv); } rr.Dispose(); return(l); }