ASP.NET图书租赁管理系统(8)

来源:xiaoniu168.com 作者:本站原创 添加时间:2012-03-04 点击数:24338

计算机毕业设计介绍:

管理员权限设置部分代码:
  public void bindUerManage()
    {
        string strSql = "select * from tb_admSet";
        DataSet ds = dataOperate.getDataset(strSql);
        this.GridView1.DataSource = ds;
        this.GridView1.DataKeyNames=new string[]{"userName"};
        this.GridView1.DataBind();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string userName = e.Row.Cells[0].Text;
            if (userName.ToLower() == Session["userName"].ToString())
            {
                e.Row.Cells[0].Enabled = false;
            }
            string strSql = "select * from tb_admSet where userName='" + userName + "'";
            SqlDataReader da = dataOperate.getRow(strSql);
            da.Read();
            if (dataOperate.isAdm(da["systemSet"].ToString()))
            {
                CheckBox ck = (CheckBox)e.Row.FindControl("ckboxSystemSet");
                ck.Checked = true;
            }
            if (dataOperate.isAdm(da["readerManage"].ToString()))
            {
                CheckBox ck = (CheckBox)e.Row.FindControl("ckboxReaderManage");
                ck.Checked = true;
            }
            if (dataOperate.isAdm(da["bookManage"].ToString()))
            {
                CheckBox ck = (CheckBox)e.Row.FindControl("ckboxBookManage");
                ck.Checked = true;
            }
            if (dataOperate.isAdm(da["bookBorrow"].ToString()))
            {
                CheckBox ck = (CheckBox)e.Row.FindControl("ckboxBookBorrow");
                ck.Checked = true;
            }
            if (dataOperate.isAdm(da["systemSearch"].ToString()))
            {
                CheckBox ck = (CheckBox)e.Row.FindControl("ckboxSystemSearch");
                ck.Checked = true;
            }
           
        }
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string userName = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
        string strSql = "select count(*) from tb_admSet where userName='"+userName+"'";
        if (dataOperate.seleSQL(strSql) > 0)
        {
            string strDel = "delete tb_admSet where userName='" + userName + "'";
            if (dataOperate.execSQL(strDel))
            {
                Response.Write("");
                bindUerManage();
            }
            else
            {
                Response.Write("");
            }
        }
        else
        {
            Response.Write("");
        }
    }

〖资料来源:计算机毕业论文 www.xiaoniu168.com

第9页为计算机毕业论文部分......

【联系方式】

【本站信誉】

用心做计算机毕业设计论文网