Пример #1
0
 public bool UPDATE()
 {
     CommentsCAD u = new CommentsCAD();
     return u.UPDATE(this);
 }
Пример #2
0
 public CommentEN READ(long cod)
 {
     CommentsCAD u = new CommentsCAD();
     return u.READ(cod);
 }
Пример #3
0
 public bool DELETE()
 {
     CommentsCAD u = new CommentsCAD();
     return u.DELETE(this.code);
 }
Пример #4
0
 public bool INSERT()
 {
     CommentsCAD u = new CommentsCAD();
     return u.INSERT(this);
 }
Пример #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;
        }