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 LogView : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        HomeCount hc = new HomeCount();
        string Id = Request["bb"];
        hc.ForCount(Id);

        if (Session["UserName"].ToString() != "") // 用户登录
        {
            this.LinkButton2.Visible = false;
            this.LinkButton3.Visible = false;
            this.Label1.Visible = true;
            this.LoginName1.Visible = true;
            this.Button1.Visible = true;
        }
        else
        {
            this.LinkButton2.Visible = true;
            this.LinkButton3.Visible = true;
            this.Label1.Visible = false;
            this.LoginName1.Visible = false;
            this.Button1.Visible = false;
        }
    }
    protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
    {
        e.Command.Parameters["@bloger_name"].Value = Request["bb"];
    }
    protected void SqlDataSource3_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
    {
        e.Command.Parameters["@bloger_name"].Value = Request["bb"];
    }
    protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
    {
        e.Command.Parameters["@bloger_name"].Value = Request["bb"];
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string userName = Session["UserName"].ToString();
        if (Roles.IsUserInRole(userName, "Admin"))
        {
            Response.Redirect("~/Admin/CollegeManage.aspx");
        }
        else if (Roles.IsUserInRole(userName, "Bloger"))
        {
            Response.Redirect("~/Bloger/BlogManage/BlogConfig.aspx");
        }
        else if (Roles.IsUserInRole(userName, "Register"))
        {
            Response.Redirect("~/Register/RegisterManage.aspx");
        }
    }
}
