public static IList GetUnitConversionsStatic(MySql.Data.MySqlClient.MySqlCommand cmd, int partID) { cmd.CommandText = UnitConversion.GetAllByPartSQL(partID); MySql.Data.MySqlClient.MySqlDataReader aReader = cmd.ExecuteReader(); IList a = UnitConversion.GetAllStatic(aReader); aReader.Close(); return(a); }
public IList GetAllUnit(int partID, int unitID) { try { OpenConnection(); MySql.Data.MySqlClient.MySqlCommand aCommand = new MySql.Data.MySqlClient.MySqlCommand(UnitConversion.GetAllByPartSQL(partID), m_connection); MySql.Data.MySqlClient.MySqlDataReader aReader = aCommand.ExecuteReader(); IList a = UnitConversion.GetAllStatic(aReader); aReader.Close(); IList result = new ArrayList(); foreach (UnitConversion uc in a) { aCommand.CommandText = Unit.GetByIDSQLstatic(uc.CONVERSION_UNIT.ID); aReader = aCommand.ExecuteReader(); Unit u = Unit.GetUnit(aReader); aReader.Close(); result.Add(u); } if (!result.Contains(new Unit(unitID))) { aCommand.CommandText = Unit.GetByIDSQLstatic(unitID); aReader = aCommand.ExecuteReader(); Unit up = Unit.GetUnit(aReader); aReader.Close(); result.Add(up); } return(result); } catch (Exception x) { throw new Exception(getErrorMessage(x)); } finally { m_connection.Close(); } }
public virtual IList GetUnitConversions(int partID) { try { OpenConnection(); MySql.Data.MySqlClient.MySqlCommand aCommand = new MySql.Data.MySqlClient.MySqlCommand(UnitConversion.GetAllByPartSQL(partID), m_connection); MySql.Data.MySqlClient.MySqlDataReader aReader = aCommand.ExecuteReader(); IList a = UnitConversion.GetAllStatic(aReader); //if(a.Contains( return(a); } catch (Exception x) { throw new Exception(getErrorMessage(x)); } finally { m_connection.Close(); } }