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; }
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; }
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; }
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; }
public void comment(CommentEN comment) { }
public void UPDATE(CommentEN update) { }
public void INSERT(CommentEN e) { }
public void comment(UserEN user, CommentEN comment) { }
public bool Comment(RecipeEN recipe, CommentEN comment) { UserCAD u = new UserCAD(); return u.Comment(this, recipe, comment); }