public void selectPrice(DevicesStore devicesStore) { connection.open(); command = new SqlCommand("select price from EquipsStore where name='" + devicesStore.getName() + "'", connection.getConnection()); devicesStore.setPrice(double.Parse(command.ExecuteScalar().ToString())); connection.close(); }
public void update(DevicesStore devicesStore) { connection.open(); command = new SqlCommand("update EquipsStore set name='" + devicesStore.getName() + "',price='" + devicesStore.getPrice() + "',quantity='" + devicesStore.getQuantity() + "' ,total='" + devicesStore.getTotal() + "' where ID='" + devicesStore.getID() + "'", connection.getConnection()); command.ExecuteNonQuery(); connection.close(); }
public void delete(DevicesStore devicesStore) { connection.open(); command = new SqlCommand("delete from EquipsStore where name='" + devicesStore.getName() + "'", connection.getConnection()); command.ExecuteNonQuery(); connection.close(); }
public void insert(DevicesStore devicesStore) { connection.open(); command = new SqlCommand("insert into EquipsStore values('" + devicesStore.getName() + "' , '" + devicesStore.getPrice() + "' , '" + devicesStore.getQuantity() + "','" + devicesStore.getTotal() + "')", connection.getConnection()); command.ExecuteNonQuery(); connection.close(); }
public int selectDeviceId(DevicesStore devicesStore) { connection.open(); command = new SqlCommand("select ID from EquipsStore where name='" + devicesStore.getName() + "'", connection.getConnection()); int ID = (int)command.ExecuteScalar(); connection.close(); return(ID); }
public Boolean checkDevice(DevicesStore devicesStore) { connection.open(); command = new SqlCommand("select count(*) from EquipsStore where name='" + devicesStore.getName() + "'", connection.getConnection()); int check = (int)command.ExecuteScalar(); connection.close(); if (check > 0) { return(true); } else { return(false); } }
public void updateQuantityMinus(DevicesStore devicesStore) { connection.open(); command = new SqlCommand("update EquipsStore set quantity=quantity-'" + devicesStore.getQuantity() + "' where name='" + devicesStore.getName() + "'", connection.getConnection()); command.ExecuteNonQuery(); connection.close(); }