public ICollection<object> FindCapableEquipment(ICollection<Tuple<string, object, string>> attributes, string uuid = null)
{
List<object> instrumentIds = new List<object>();
List<string> names = new List<string>();
List<object> values = new List<object>();
List<string> qualifiers = new List<string>();
foreach (Tuple<string, object, string> attribute in attributes)
{
names.Add( attribute.Item1 );
values.Add( attribute.Item2 );
qualifiers.Add(attribute.Item3);
}
string sql = BuildCapabilityQuery( names.ToArray() );
if (uuid != null)
sql += " AND instrument_uuid=? ";
List<OleDbParameter> dbParams = new List<OleDbParameter>();
foreach (Tuple<string, object, string> attribute in attributes)
{
names.Add(attribute.Item1);
values.Add(attribute.Item2);
string name = attribute.Item1;
object value = attribute.Item2;
object valueHi;
object valueLo;
string qualifier = attribute.Item3;
DetermineHoLoValues( qualifier, value, out valueHi, out valueLo );
dbParams.Add(CreateParameter(string.Format("{0}_low", name), valueLo));
dbParams.Add(CreateParameter(string.Format("{0}_high", name), valueHi));
}
if (uuid != null)
dbParams.Add(CreateParameter("instrument_uuid", uuid));
using (OleDbDataReader rs = ExecuteSqlQuery( sql, dbParams.ToArray() ))
{
if (rs != null)
{
try
{
while (rs.Read())
{
instrumentIds.Add( rs[InstrumentCapabilitiesBean._INSTRUMENT_UUID] );
}
}
finally
{
rs.Close();
rs.Dispose();
}
}
}
return instrumentIds;
}