Example #1
0
 public void saveSupplier(Supplier sup)
 {
     cmd.CommandText = "INSERT INTO supplier(name, address, email, phone, birthday, ingredient_id)" +
                 " values(@name, @address, @email, @phone, @birthday, @ingredient_id)";
     cmd.Parameters.AddWithValue("@name", sup.getName());
     cmd.Parameters.AddWithValue("@address", sup.getAddress());
     cmd.Parameters.AddWithValue("@email", sup.getEmail());
     cmd.Parameters.AddWithValue("@phone", sup.getPhone());
     cmd.Parameters.AddWithValue("@birthday", sup.getBirthday());
     cmd.Parameters.AddWithValue("@ingredient_id", sup.getIngredientid());
     cmd.ExecuteNonQuery();
     conn.Close();
 }
Example #2
0
 public void updateSupplier(Supplier sup)
 {
     cmd.CommandText = " UPDATE supplier SET name = @name, address=@address, " +
                       " email = @email, phone = @phone, birthday=@birthday, ingredient_id = @ingredient_id " +
                       " where id = @id ";
     cmd.Parameters.AddWithValue("@name", sup.getName());
     cmd.Parameters.AddWithValue("@address", sup.getAddress());
     cmd.Parameters.AddWithValue("@email", sup.getEmail());
     cmd.Parameters.AddWithValue("@phone", sup.getPhone());
     cmd.Parameters.AddWithValue("@birthday", sup.getBirthday());
     cmd.Parameters.AddWithValue("@ingredient_id", sup.getIngredientid());
     cmd.Parameters.AddWithValue("@id", sup.getId());
     cmd.ExecuteNonQuery();
     conn.Close();
 }