//Nastaví výchozí hodnoty z hodnot jídla public void setDefaultValues(Model.Food food) { //path is necessary this.Values[0] = food.Path; this.EntryName.Text = food.Name; this.EntryGram.Text = food.Gram.ToString(); this.EntryPrice.Text = food.Price.ToString(); this.EntryComposition.Text = food.Composition; //přeskočím 5 protože to je kategorie this.EntryEnergyKj.Text = food.EnergyKj.ToString(); this.EntryEnergyKcal.Text = food.EnergyKcal.ToString(); this.EntryProtein.Text = food.Protein.ToString(); this.EntryCarbs.Text = food.Carbohydrates.ToString(); this.EntrySugar.Text = food.Sugar.ToString(); this.EntryTotalFat.Text = food.TotalFat.ToString(); this.EntrySaturatedFat.Text = food.SaturatedFat.ToString(); this.EntryFiber.Text = food.Fiber.ToString(); this.EntrySalt.Text = food.Salt.ToString(); }
//Přetížený konstruktor public AddFoodDialog(Model.Food food) { this.Initialize(); setDefaultValues(food); this.SetAllergenes(food.GetAllergenIds()); }