public void updateTotal(LocationEquips locationEquips) { connection.open(); command = new SqlCommand("update LocationEquips set total='" + locationEquips.getTotal() + "' where locationID='" + locationEquips.getLocationID() + "'", connection.getConnection()); command.ExecuteNonQuery(); connection.close(); }
public void selectID(LocationEquips locationEquips) { connection.open(); command = new SqlCommand("select ID from LocationEquips where locationID='" + locationEquips.getLocationID() + "'", connection.getConnection()); locationEquips.setID((int)command.ExecuteScalar()); connection.close(); }
public void getTotal(LocationEquips locationEquips) { connection.open(); command = new SqlCommand("select total from LocationEquips where locationID = '" + locationEquips.getLocationID() + "'", connection.getConnection()); locationEquips.setTotal((double)command.ExecuteScalar()); connection.close(); }
public void insert(LocationEquips locationEquips) { connection.open(); command = new SqlCommand("insert into LocationEquips values('" + locationEquips.getTotal() + "' , '" + locationEquips.getLocationID() + "')", connection.getConnection()); command.ExecuteNonQuery(); connection.close(); }
public void selectLastID(LocationEquips locationEquips) { connection.open(); command = new SqlCommand("select TOP 1 ID from LocationEquips ORDER BY ID DESC", connection.getConnection()); locationEquips.setID((int)command.ExecuteScalar()); connection.close(); }
public int getLastID() { locationEquips = new LocationEquips(); locationEquipsDB = new LocationEquipsDB(); locationEquipsDB.selectLastID(locationEquips); return(locationEquips.getID()); }
public void update(double total, string locationName) { locationControl = new LocationControl(); locationEquips = new LocationEquips(); locationEquipsDB = new LocationEquipsDB(); int ID = locationControl.getID(locationName); locationEquips.setLocationID(ID); locationEquips.setTotal(total); locationEquipsDB.updateTotal(locationEquips); }
public double getTotal(string locationName) { locationControl = new LocationControl(); locationEquips = new LocationEquips(); locationEquipsDB = new LocationEquipsDB(); int ID = locationControl.getID(locationName); locationEquips.setLocationID(ID); locationEquipsDB.getTotal(locationEquips); return(locationEquips.getTotal()); }
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 checkIfLocationHasEquips(string locationName) { locationControl = new LocationControl(); locationEquips = new LocationEquips(); locationEquipsDB = new LocationEquipsDB(); int ID = locationControl.getID(locationName); locationEquips.setLocationID(ID); bool check = locationEquipsDB.checkIfLocationHasDevices(locationEquips); return(check); }
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. } }