Beispiel #1
0
        public EditFood(Food FoodToEdit)
        {
            InitializeComponent();
            if (FoodToEdit == null)
            {
                Close();
            }

            FoodCategory.Items.AddRange(FoodDB.GetFoodCategories());

            this.FoodToEdit = FoodToEdit;
            FoodName.Text   = FoodToEdit.Name;

            FoodCategory.Text = FoodToEdit.Category;

            FoodSelfService.Checked = FoodToEdit.isSelfService;
            FoodDetails.Text        = FoodToEdit.Details;

            RecipeString = FoodToEdit.RecipeString;
            List <RecipeIngredient> ingredients = Converter.ToRecipeList(RecipeString);

            foreach (RecipeIngredient Ing in ingredients)
            {
                listIngredients.Items.Add(FoodDB.GetIngredient(Ing.IngId).name + " - " + Ing.IngAmount);
            }
        }
Beispiel #2
0
 private void AddFood_Load(object sender, EventArgs e)
 {
     FoodCategory.Items.AddRange(FoodDB.GetFoodCategories());
 }