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

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

计算机毕业设计介绍:

4.2 主页
     1.主页面
     在菜单栏中实现了菜单栏动态编辑功能,不同身份的登录者所拥有的功能不同。
其实现代码为:
protected void menuManage()
    {
        string strSQL = "select * from tb_admSet where userName='" + Session["userName"] + "'";
        SqlDataReader da = dataOperate.getRow(strSQL);
        da.Read();
        MenuItem miIndex = new MenuItem();
        miIndex.Text = "首页";
        miIndex.NavigateUrl = "../index.aspx";
        this.Menu1.Items.Add(miIndex);
        if (dataOperate.isAdm(da["systemSet"].ToString()))
        {
            string strSql = "select * from tb_menuInfo where menuName='systemSet'";
            biandMenu(strSql, "systemSet");
        }
        if (dataOperate.isAdm(da["readerManage"].ToString()))
        {
            string strSql = "select * from tb_menuInfo where menuName='readerManage'";
            biandMenu(strSql, "readerManage");
        }
        if (dataOperate.isAdm(da["bookManage"].ToString()))
        {
            string strSql = "select * from tb_menuInfo where menuName='bookManage'";
            biandMenu(strSql, "bookManage");
        }
        if (dataOperate.isAdm(da["bookBorrow"].ToString()))
        {
            string strSql = "select * from tb_menuInfo where menuName='bookBorrow'";
            biandMenu(strSql, "bookBorrow");
        }
        if (dataOperate.isAdm(da["systemSearch"].ToString()))
        {
            string strSql = "select * from tb_menuInfo where menuName='systemSearch'";
            biandMenu(strSql, "systemSearch");
        }
        MenuItem miPwd = new MenuItem();
        miPwd.Text = "修改密码";
        miPwd.NavigateUrl = "../newPass.aspx";
        this.Menu1.Items.Add(miPwd);
        MenuItem miExit = new MenuItem();
        miExit.Text = "退出系统";
        miExit.NavigateUrl = "../Default.aspx";
        this.Menu1.Items.Add(miExit);
    }
    public void biandMenu(string strSql, string strField)
    {
        string strSel = "select * from tb_admSet where userName='" + Session["userName"] + "'";
        SqlDataReader da = dataOperate.getRow(strSel);
        da.Read();
        string[] str = da[strField].ToString().Split(',');
        int count = 0;
        foreach (string s in str)
        {
            if (s == "1")
            {
                count += 1;
            }
        }
        DataSet ds = dataOperate.getDataset(strSql);
        MenuItem[] mi = new MenuItem[count + 1];
        for (int i = 0; i < count+1; i++)
        {
            mi[i] = new MenuItem();
        }
        mi[0].Text = ds.Tables[0].Rows[0][2].ToString();
        //mi[0].NavigateUrl = ds.Tables[0].Rows[0][3].ToString();
        int mig=0;
        for (int j = 0; j < str.Length; j++)
        {
            if (str[j] == "1")
            {
                mig += 1;
                mi[mig].Text = ds.Tables[0].Rows[j+1][2].ToString();
                mi[mig].NavigateUrl = ds.Tables[0].Rows[j+1][3].ToString();
                mi[0].ChildItems.Add(mi[mig]);
            }
        }
        this.Menu1.Items.Add(mi[0]);
    }
    public void menuReader()
    {
        MenuItem miIndex = new MenuItem();
        miIndex.Text = "首页";
        miIndex.NavigateUrl = "../index.aspx";
        this.Menu1.Items.Add(miIndex);
        MenuItem miSearch = new MenuItem();
        miSearch.Text = "系统查询";
        MenuItem miBookInfo = new MenuItem();
        miBookInfo.Text = "图书档案查询";
        miBookInfo.NavigateUrl = "~/systemSearch/bookInfoSearch.aspx";
        MenuItem miBookBorrow = new MenuItem();
        miBookBorrow.Text = "图书借阅查询";
        miBookBorrow.NavigateUrl = "~/systemSearch/bookBorrowSearch.aspx";
        miSearch.ChildItems.Add(miBookInfo);
        miSearch.ChildItems.Add(miBookBorrow);
        this.Menu1.Items.Add(miSearch);
        MenuItem miPwd = new MenuItem();
        miPwd.Text = "修改密码";
        miPwd.NavigateUrl = "../newPass.aspx";
        this.Menu1.Items.Add(miPwd);
        MenuItem miExit = new MenuItem();
        miExit.Text = "退出系统";
        miExit.NavigateUrl = "../Default.aspx";
        this.Menu1.Items.Add(miExit);
    }

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

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

【联系方式】

【本站信誉】

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