public void addIngredient(IngredientInterface ingredient) { string query = string.Format("INSERT INTO Ingredient (Name, Price, Type) VALUES ('{0}','{1}','{2}')", ingredient.Name, ingredient.Price.ToString(), ingredient.IngredientType); Ingredients.Add(ingredient); My_Execute_Non_Query(query); }
public void removeIngredient(IngredientInterface item) { Ingredients.Remove(item); string query = string.Format("DELETE * from Ingredient where Name = '{0}'", item.Name); My_Execute_Non_Query(query); }
public CoffeeCup(string label, IngredientInterface coffeeIngredient, BindingList <IngredientInterface> ingredients) { this.label = label; this.coffeeIngredient = coffeeIngredient; this.ingredients = ingredients; makeDescription(); }
private void AddIngredientButton_Click(object sender, EventArgs e) { var form = new IngredientForm(); IngredientInterface ingredientInterface = null; DialogResult dr = form.ShowDialog(this); if (dr == DialogResult.OK) { ingredientInterface = form.GetIngredient(); } if (ingredientInterface.Name.Length > 0 && ingredientInterface.Price > 0) { ingredientsService.addIngredient(ingredientInterface); } form.Close(); }
public static IngredientInterface parseIngredient(string Name, string Price, string Type) { IngredientInterface ingredient = null; double price; if (Double.TryParse(Price, out price)) { if (Type == "Ингредиент") { ingredient = new Ingredient(Name, price); } else if (Type == "Кофе") { ingredient = new CoffeeIngredient(Name, price); } } else { ingredient = new Ingredient("StockName", 10); } return(ingredient); }
public void addIngredient(IngredientInterface ingredient) { ingredients.Add(ingredient); makeDescription(); }
public CoffeeCup(string label, IngredientInterface coffeeIngredient) { this.label = label; this.coffeeIngredient = coffeeIngredient; makeDescription(); }