DataTable GetComments()
 {
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     DataTable dt = db.GetDataTable("Select * from Yorum");
     GridViewComments.DataSource = dt;
     GridViewComments.DataBind();
     db.CloseConnection();
     return dt;
 }
 protected void btn_Deneme2_Click(object sender, ImageClickEventArgs e)
 {
     decimal basID = Convert.ToDecimal((sender as ImageButton).CommandArgument);
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     db.Delete("Delete from Yorum Where YorumId = " + basID + ";");
     db.CloseConnection();
     //Response.Redirect("GridViewDeneme.aspx");
     GetComments();
 }
 DataTable MakaleOzetGetir(string category_id)
 {
     int category_id_int = int.Parse(category_id);
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     DataSet ds = db.GetDataset("SELECT m.MakaleId , m.Baslik , m.Tarih , m.Ozet , Count(y.MakaleID) as Yorum_Count FROM Makale m LEFT JOIN Yorum y ON m.MakaleId = y.MakaleID WHERE m.KategoriID = " + category_id_int + " GROUP BY m.MakaleId , Baslik , m.Tarih , Ozet ORDER BY m.Tarih DESC");
     rptMakaleOzet_Category.DataSource = ds.Tables[0];
     rptMakaleOzet_Category.DataBind();
     db.CloseConnection();
     return ds.Tables[0];
 }
 protected void btn_Comment_Click(object sender, ImageClickEventArgs e)
 {
     string yorum = txt_Comment.Text;
     string user_id = Session["User_id"].ToString();
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     db.Insert("Insert into Yorum (YorumIcerik , MakaleID , User_id , Tarih ) values ('" + yorum + "'," + makale_id + "," + user_id + ",GETDATE())");
     txt_Comment.Text = "";
     db.CloseConnection();
     Response.Redirect("Blog.aspx?id="+makale_id+"&page="+Session["Comment_Page"].ToString());
 }
 DataTable MakaleOzetGetir(string tag_id)
 {
     int tag_id_int = int.Parse(tag_id);
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     DataSet ds = db.GetDataset("SELECT m.MakaleId , m.Baslik , m.Tarih , m.Ozet , Count(y.MakaleID) as Yorum_Count , e.EtiketAd FROM Makale m LEFT JOIN Yorum y ON m.MakaleId = y.MakaleID , Etiket e , MakaleEtiket me WHERE m.MakaleId = me.MakaleId AND me.EtiketId = e.EtiketId AND e.EtiketId = " + tag_id_int +" GROUP BY m.MakaleID , Baslik , m.Tarih , Ozet , e.EtiketAd  ORDER BY m.Tarih DESC");
     rptMakaleOzet_Tag.DataSource = ds.Tables[0];
     rptMakaleOzet_Tag.DataBind();
     db.CloseConnection();
     return ds.Tables[0];
 }
 DataTable GetComments(String id)
 {
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     DataTable dt = db.GetDataTable("Select y.YorumId ,  y.YorumIcerik , y.MakaleID , y.Tarih , y.Onay , u.Name from Yorum y , Users u where y.User_id = u.User_Id and y.MakaleId=" + makale_id);
     rpt_Comment.DataSource = dt;
     rpt_Comment.DataBind();
     db.CloseConnection();
     return dt;
 }
 string GetCommentCount()
 {
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     DataTable dt = db.GetDataTable("Select COUNT(y.MakaleID) as Comment_Count from Yorum y where y.MakaleID = " + makale_id);
     db.CloseConnection();
     return dt.Rows[0]["Comment_Count"].ToString();
 }
 void GetTags(String id)
 {
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     DataTable dt = db.GetDataTable("SELECT e.EtiketAd FROM Makale m , MakaleEtiket me , Etiket e WHERE me.MakaleId = m.MakaleId AND me.EtiketId = e.EtiketId AND m.MakaleId = " + makale_id);
     dl_Tags.DataSource = dt;
     dl_Tags.DataBind();
     db.CloseConnection();
 }
 void GetContent(String id)
 {
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     DataTable dt = db.GetDataTable("Select * from Makale Where MakaleId =" + makale_id);
     rpt_Makale.DataSource = dt;
     rpt_Makale.DataBind();
     db.CloseConnection();
 }