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> listOfGearIds(int shaftIds, Database1DataSet1TableAdapters.GearsTableAdapter gta) { List<int> gearIds = new List<int>(); Database1DataSet1.GearsDataTable gearTable = new Database1DataSet1.GearsDataTable(); gearTable = gta.GetDataByShaftID(shaftIds); foreach (Database1DataSet1.GearsRow row in gearTable) { int id = row.ID; gearIds.Add(id); } return gearIds; }