// ---------------------------------------------------------------------------------------- public static IEnumerable<CompSubType> GetCompSubTypes() { // return all the comp sub types PetaPoco.Database db = new PetaPoco.Database("ElecLibConnString"); return db.Query<CompSubType> ("SELECT cst.CompSubTypeID, cst.CompTypeID, ct.CompTypeName, cst.CompSubTypeName, cst.CompSubTypeDesc " + "FROM CompType AS ct INNER JOIN CompSubType AS cst ON cst.CompTypeID = ct.CompTypeID " + "ORDER BY ct.CompTypeName, cst.CompSubTypeName"); }
// ---------------------------------------------------------------------------------------- public static IEnumerable<CompType> GetCompTypes() { // return all the comp types PetaPoco.Database db = new PetaPoco.Database("ElecLibConnString"); return db.Query<CompType>("SELECT * FROM CompType ORDER BY CompTypeName"); }
// ---------------------------------------------------------------------------------------- public static IEnumerable<CompSubType> GetCompSubTypesByType(int compTypeID) { PetaPoco.Database db = new PetaPoco.Database("ElecLibConnString"); return db.Query<CompSubType> ("SELECT cst.CompSubTypeID, cst.CompTypeID, ct.CompTypeName, cst.CompSubTypeName, cst.CompSubTypeDesc " + "FROM CompType AS ct INNER JOIN CompSubType AS cst ON cst.CompTypeID = ct.CompTypeID " + "WHERE cst.CompTypeID = " + compTypeID.ToString() + " " + "ORDER BY ct.CompTypeName, cst.CompSubTypeName"); }