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 Admin_BlogManage : System.Web.UI.Page
{
    private DataBaseConnection dbConn;
    private string userName;
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
    {
        this.dbConn = new DataBaseConnection();
        string connStr = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["DesertEagleConnectionString"].ToString();
        this.dbConn.Open(connStr);

        string sqlComTxt = "INSERT INTO DE_category (category_name, bloger_name) VALUES ('默认', '" + userName + "')";
        this.dbConn.Insert(sqlComTxt);
        this.dbConn.Close();

    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        userName = this.GridView1.DataKeys[e.RowIndex]["bloger_name"].ToString();
        Roles.RemoveUserFromRole(userName, "Register");
        Roles.AddUserToRole(userName, "Bloger");
    }
}
