Esempio n. 1
0
 public bool UPDATE()
 {
     CommentsCAD u = new CommentsCAD();
     return u.UPDATE(this);
 }
Esempio n. 2
0
 public CommentEN READ(long cod)
 {
     CommentsCAD u = new CommentsCAD();
     return u.READ(cod);
 }
Esempio n. 3
0
 public bool DELETE()
 {
     CommentsCAD u = new CommentsCAD();
     return u.DELETE(this.code);
 }
Esempio n. 4
0
 public bool INSERT()
 {
     CommentsCAD u = new CommentsCAD();
     return u.INSERT(this);
 }
Esempio n. 5
0
        /*public bool updateRecipe(RecipeEN recipe, long id)
        {
            bool updated = false;
            SqlConnection c = new SqlConnection(db);
            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("", c);
                com.ExecuteNonQuery();
                updated = true;
            }
            catch (Exception ex) { updated=false;}
            finally
            {
                c.Close();
            }
            return updated;
        }*/
        public List<CommentEN> getComments(RecipeEN reci)
        {
            List<CommentEN> lista = new List<CommentEN>();
            CommentsCAD recipeCad = new CommentsCAD();
            CommentEN recipe;
            SqlConnection c = new SqlConnection(db);
            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("SELECT Code FROM Ternary WHERE Id = " + reci.Id, c);
                SqlDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    recipe = recipeCad.READ(long.Parse(dr["Id"].ToString()));

                    lista.Add(recipe);
                }
                dr.Close();
            }
            catch (Exception ex) { }
            finally
            {
                c.Close();
            }
            return lista;
        }