using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class LogList : System.Web.UI.Page
{
    private string blogerName = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            WebCount wc = new WebCount();
            int Id = int.Parse(Request["log_id"]);
            wc.ForCount(Id);
        }
        if (User.Identity.Name != null)
        {
            this.TxtAu.Text = User.Identity.Name;
        }


        DataSourceSelectArguments args = new DataSourceSelectArguments();
        this.blogerName = ((DataView)this.SqlDataSource3.Select(args)).Table.Rows[0]["bloger_name"].ToString();
    }
    protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
    {
        e.Command.Parameters["@log_id"].Value = Request["log_id"];
    }
    protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
    {
        e.Command.Parameters["@log_id"].Value = Request["log_id"];
    }
    protected void BtnPub_Click(object sender, EventArgs e)
    {
        SqlDataSource2.Insert();
        this.TxtAu.Text = "";
        this.Txtcont.Text = "";
    }
    protected void SqlDataSource2_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {
        e.Command.Parameters["@log_id"].Value = Request["log_id"];
        e.Command.Parameters["@contents"].Value = this.Txtcont.Text;
        e.Command.Parameters["@author"].Value = this.TxtAu.Text;
        e.Command.Parameters["@pub_date"].Value = DateTime.Now;
    }
    protected void SqlDataSource3_Selected(object sender, SqlDataSourceStatusEventArgs e)
    {
        DataSourceSelectArguments args = new DataSourceSelectArguments();
        this.SqlDataSource4.Select(args);
    }
    protected void SqlDataSource4_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
    {
        e.Command.Parameters["@bloger_name"].Value = this.blogerName;
    }
}
