Example #1
0
 public void initRicetta(Ricetta ricetta)
 {
     this.ricetta = ricetta;
     this.passo = 0;
 }
Example #2
0
        //Load ricette from DataBase
        private List<Ricetta> ReadRicette()
        {
            OleDbDataReader reader = null;
            List<Ricetta> ricette = new List<Ricetta>();
            try
            {
                OleDbCommand cmd =
                    new OleDbCommand("Select * FROM Ricette", conn);
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Ricetta newItem = new Ricetta();
                    newItem.id = (int)reader["ID"];
                    newItem.nome = reader["Nome"].ToString();
                    string allergia = reader["Allergia"].ToString();
                    newItem.immagine = reader["Immagine"].ToString();
                    newItem.passi = new List<Passo>();

                    foreach (var item in allergie)
                    {
                        if (item.nome.Equals(allergia)){
                            newItem.allergia = item;
                        }
                    }
                    ricette.Add(newItem);
                }

            }
            finally
            {
                if (reader != null) reader.Close();
            }
            return ricette;
        }
Example #3
0
 /// <summary>
 /// Method that should modify the interface in order to change the shown Recipe.
 /// </summary>
 /// <param name="ricetta"></param>
 private void showRecipe(Ricetta ricetta)
 {
     this.ricetta = ricetta;
     this.eventAggregator.PublishOnUIThread(new RecipeMessage(this.ricetta));
 }
Example #4
0
 public RecipeMessage(Ricetta recipe)
 {
     this.recipe = recipe;
 }