public static List<int> listOfGearIds(int materialID, List<int> shaftIds, Database1DataSet1TableAdapters.GearsTableAdapter gta) { List<int> gearIds = new List<int>(); Database1DataSet1.GearsDataTable gearTable = new Database1DataSet1.GearsDataTable(); // beacause of the Material gearTable = gta.GetDataByMaterialID(materialID); foreach (Database1DataSet1.GearsRow row in gearTable) { int id = row.ID; gearIds.Add(id); } // because of the shaft foreach (int shaft in shaftIds) { gearTable = gta.GetDataByShaftID(shaft); foreach (Database1DataSet1.GearsRow row in gearTable) { int id = row.ID; gearIds.Add(id); } } return gearIds; }
public static List<int> listOfShaftIds(int materialID, Database1DataSet1TableAdapters.Shaft1TableAdapter sta) { List<int> shaftIds = new List<int>(); Database1DataSet1.Shaft1DataTable shaftTable = new Database1DataSet1.Shaft1DataTable(); shaftTable = sta.GetDataByMaterialID(materialID); foreach (Database1DataSet1.Shaft1Row row in shaftTable) { int id = row.ID; shaftIds.Add(id); } return shaftIds; }