public int getLastID() { locationEquips = new LocationEquips(); locationEquipsDB = new LocationEquipsDB(); locationEquipsDB.selectLastID(locationEquips); return(locationEquips.getID()); }
public int getID(string locationName) { locationControl = new LocationControl(); locationEquips = new LocationEquips(); locationEquipsDB = new LocationEquipsDB(); int ID = locationControl.getID(locationName); locationEquips.setLocationID(ID); locationEquipsDB.selectID(locationEquips); return(locationEquips.getID()); }
public bool checkIfLocationHasDevices(LocationEquips locationEquips) { connection.open(); command = new SqlCommand("select count(*) from LocationEquips where locationID='" + locationEquips.getID() + "'", connection.getConnection()); int count = (int)command.ExecuteScalar(); connection.close(); if (count > 0) { return(true); // has devices. } else { return(false); // don't has. } }