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