/// <summary> /// Finds and returns all FactoryCylinders in the database. /// </summary> public IList <FactoryCylinder> FindAll(DataAccessTransaction trx) { IList <FactoryCylinder> list = new List <FactoryCylinder>(); using (IDbCommand cmd = GetCommand("SELECT * FROM FACTORYCYLINDER", trx)) { using (IDataReader reader = cmd.ExecuteReader()) { DataAccessOrdinals ordinals = new DataAccessOrdinals(reader); while (reader.Read()) { list.Add(CreateFromReader(reader, ordinals)); } } } // For each cylinder, load its gases FactoryCylinderGasDataAccess factoryCylinderGasDataAccess = new FactoryCylinderGasDataAccess(); foreach (FactoryCylinder cylinder in list) { LoadFactoryCylinderGases(cylinder, factoryCylinderGasDataAccess, trx); } return(list); }
/// <summary> /// Find all the FactoryCylinderGases for the specified FactoryCylinder /// </summary> /// <param name="factoryCylinder"></param> /// <param name="factoryCylinderGasDataAccess"></param> /// <param name="trx"></param> private void LoadFactoryCylinderGases(FactoryCylinder factoryCylinder, FactoryCylinderGasDataAccess factoryCylinderGasDataAccess, DataAccessTransaction trx) { factoryCylinder.GasConcentrations.Clear(); foreach (GasConcentration gasConcentration in factoryCylinderGasDataAccess.FindByFactoryCylinder(factoryCylinder, trx)) { factoryCylinder.GasConcentrations.Add(gasConcentration); } }