コード例 #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;
        }
コード例 #2
0
ファイル: UserCAD.cs プロジェクト: jorge1993/GrupoARACocina
 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;
 }
コード例 #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;
        }
コード例 #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;
 }
コード例 #5
0
ファイル: UserEN.cs プロジェクト: jorge1993/GrupoARACocina
 public void comment(CommentEN comment)
 {
 }
コード例 #6
0
 public void UPDATE(CommentEN update)
 {
 }
コード例 #7
0
 public void INSERT(CommentEN e)
 {
 }
コード例 #8
0
ファイル: UserCAD.cs プロジェクト: jorge1993/GrupoARACocina
 public void comment(UserEN user, CommentEN comment)
 {
 }
コード例 #9
0
ファイル: UserEN.cs プロジェクト: jorge1993/GrupoARACocina
 public bool Comment(RecipeEN recipe, CommentEN comment)
 {
     UserCAD u = new UserCAD();
     return u.Comment(this, recipe, comment);
 }