示例#1
0
 // Редагувати ФРУКТОВУ ПОСТАВКУ
 public static void updateFruitSupply(FruitSupply x)
 {
     try
     {
         MySqlCommand command = new MySqlCommand("UPDATE fruitsvegetables.fruitsupply SET supplyDate = '" + x.getDate() + "', idProduct = '" + x.getIdProduct() + "', amount = '" + x.getAmount() + "', idShop = '" + x.getIdShop() + "', idCourier = '" + x.getIdCourier() + "' WHERE idSupply = " + x.getIdFruitSupply() + ";", connect);
         command.ExecuteNonQuery();
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#2
0
 // Додати ФРУКТОВУ ПОСТАВКУ
 public static void addFruitSupply(FruitSupply x)
 {
     try
     {
         MySqlCommand command = new MySqlCommand("INSERT INTO fruitsvegetables.fruitsupply (`idSupply`, `supplyDate`, `idProduct`, `amount`, `idShop`, `idCourier`) VALUES ( null, '" + x.getDate() + "', '" + x.getIdProduct() + "', '" + x.getAmount() + "', '" + x.getIdShop() + "', '" + x.getIdCourier() + "');", connect);
         command.ExecuteNonQuery();
         MySqlCommand command2 = new MySqlCommand("UPDATE fruitsvegetables.fruits SET amount = (amount - '" + x.getAmount() + "') WHERE idFruits = '" + x.getIdProduct() + "';", connect);
         command2.ExecuteNonQuery();
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }