Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public CoffeeCup(string label, IngredientInterface coffeeIngredient, BindingList <IngredientInterface> ingredients)
 {
     this.label            = label;
     this.coffeeIngredient = coffeeIngredient;
     this.ingredients      = ingredients;
     makeDescription();
 }
Beispiel #4
0
        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();
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
 public void addIngredient(IngredientInterface ingredient)
 {
     ingredients.Add(ingredient);
     makeDescription();
 }
Beispiel #7
0
 public CoffeeCup(string label, IngredientInterface coffeeIngredient)
 {
     this.label            = label;
     this.coffeeIngredient = coffeeIngredient;
     makeDescription();
 }