Beispiel #1
0
        public CommentEN READ(long code)
        {
            CommentEN comment = new CommentEN();
            SqlConnection c = new SqlConnection(db);
            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("SELECT * FROM Comment WHERE email = " + code + "", c);
                SqlDataReader dr = com.ExecuteReader();
                if (dr.Read())
                {
                    comment.Code = Int32.Parse(dr["Code"].ToString());
                    comment.Date = DateTime.Parse(dr["Date"].ToString());
                    comment.Description = dr["Description"].ToString();
                }
                dr.Close();
            }
            catch (Exception ex) { }
            finally
            {
                c.Close();
            }

            return comment;
        }
Beispiel #2
0
 public bool Comment(UserEN u, RecipeEN r, CommentEN c)
 {
     bool added = false;
     SqlConnection sql = new SqlConnection(db);
     try
     {
         sql.Open();
         SqlCommand com = new SqlCommand("INSERT INTO Ternary (Email, Id, Code)" +
                                         " VALUES ('" + u.Email + "', " + r.Id + ", " + c.Code + ")", sql);
         com.ExecuteNonQuery();
         added = true;
     }
     catch (Exception ex) { }
     finally
     {
         sql.Close();
     }
     return added;
 }
Beispiel #3
0
        public bool INSERT(CommentEN e)
        {
            bool added = false;
            SqlConnection c = new SqlConnection(db);
            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("INSERT INTO Comment (Code, Date, Description)" +
                                                " VALUES (" + e.Code + ", " + e.Date + ", '" + e.Description + ")", c);
                com.ExecuteNonQuery();
                added = true;
            }
            catch (Exception ex) { }
            finally
            {
                c.Close();
            }

            return added;
        }
Beispiel #4
0
 public bool UPDATE(CommentEN c)
 {
     bool updated = false;
     SqlConnection sql = new SqlConnection(db);
     try
     {
         sql.Open();
         SqlCommand com = new SqlCommand("UPDATE Comment SET Date = " + c.Date + ", Description =  '" + c.Description + "'"
             + "WHERE Code = " + c.Code, sql);
         com.ExecuteNonQuery();
         updated = true;
     }
     catch (Exception ex) { }
     finally
     {
         sql.Close();
     }
     return updated;
 }
Beispiel #5
0
 public void comment(CommentEN comment)
 {
 }
Beispiel #6
0
 public void UPDATE(CommentEN update)
 {
 }
Beispiel #7
0
 public void INSERT(CommentEN e)
 {
 }
Beispiel #8
0
 public void comment(UserEN user, CommentEN comment)
 {
 }
Beispiel #9
0
 public bool Comment(RecipeEN recipe, CommentEN comment)
 {
     UserCAD u = new UserCAD();
     return u.Comment(this, recipe, comment);
 }