Пример #1
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (roleid != "")
        {
            BLLTable<SYS_ROLE_MDLPOWER_DIC>.Factory(conn).Delete(SYS_ROLE_MDLPOWER_DIC.Attribute.ROLE_ID,roleid);
        }
        else if (userid != "")
        {
            BLLTable<SYS_USER_MDLPOWER_DIC>.Factory(conn).Delete(SYS_USER_MDLPOWER_DIC.Attribute.USER_ID,userid);
        }

        for (int i = 0; i < repModule.Items.Count; i++)
        {
            TreeView tvMdl = (TreeView)repModule.Items[i].FindControl("tvModule");
            //Response.Write(tvMdl.CheckedNodes.Count.ToString() + "<hr/>");

            foreach (TreeNode tn in tvMdl.CheckedNodes)
            {
                if (roleid != "")
                {
                    SYS_ROLE_MDLPOWER_DIC val = new SYS_ROLE_MDLPOWER_DIC();
                    val.ROLE_ID = int.Parse(roleid);
                    if (tn.ToolTip != "权限字典")
                    {
                        val.PAGE_URL = tn.Value;// arr[1];
                        val.DIC_ID = 0;//关联表里存放的是页面地址,没有权限字典的数据,这点很重要,可以根据此判断用户是否有进入某页面
                    }
                    else
                    {
                        val.PAGE_URL = tn.Parent.Value;
                        val.DIC_ID = int.Parse(tn.Value);

                    }
                    if (!BLLTable<SYS_ROLE_MDLPOWER_DIC>.Exists(val))
                    {
                        BLLTable<SYS_ROLE_MDLPOWER_DIC>.Factory(conn).Insert(val);
                    }
                }
                else if (userid != "")
                {
                    SYS_USER_MDLPOWER_DIC val = new SYS_USER_MDLPOWER_DIC();
                    val.USER_ID = decimal.Parse(userid);
                    if (tn.ToolTip != "权限字典")
                    {
                        val.PAGE_URL = tn.Value;// arr[1];
                        val.DIC_ID = 0;//关联表里存放的是页面地址,没有权限字典的数据,这点很重要,可以根据此判断用户是否有进入某页面
                    }
                    else
                    {
                        val.PAGE_URL = tn.Parent.Value;
                        val.DIC_ID = int.Parse(tn.Value);

                    }
                    if (!BLLTable<SYS_USER_MDLPOWER_DIC>.Exists(val))
                    {
                        BLLTable<SYS_USER_MDLPOWER_DIC>.Factory(conn).Insert(val);
                    }
                }
            }
        }
        // Response.Write(repModule.Items.Count.ToString());
        AgileFrame.Core.ScriptHelper.ResponseScript(Page, "window.close();", false);
    }
Пример #2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (roleid != "")
        {
            BLLTable <SYS_ROLE_MDLPOWER_DIC> .Factory(conn).Delete(SYS_ROLE_MDLPOWER_DIC.Attribute.ROLE_ID, roleid);
        }
        else if (userid != "")
        {
            BLLTable <SYS_USER_MDLPOWER_DIC> .Factory(conn).Delete(SYS_USER_MDLPOWER_DIC.Attribute.USER_ID, userid);
        }

        for (int i = 0; i < repModule.Items.Count; i++)
        {
            TreeView tvMdl = (TreeView)repModule.Items[i].FindControl("tvModule");
            //Response.Write(tvMdl.CheckedNodes.Count.ToString() + "<hr/>");

            foreach (TreeNode tn in tvMdl.CheckedNodes)
            {
                if (roleid != "")
                {
                    SYS_ROLE_MDLPOWER_DIC val = new SYS_ROLE_MDLPOWER_DIC();
                    val.ROLE_ID = int.Parse(roleid);
                    if (tn.ToolTip != "权限字典")
                    {
                        val.PAGE_URL = tn.Value; // arr[1];
                        val.DIC_ID   = 0;        //关联表里存放的是页面地址,没有权限字典的数据,这点很重要,可以根据此判断用户是否有进入某页面
                    }
                    else
                    {
                        val.PAGE_URL = tn.Parent.Value;
                        val.DIC_ID   = int.Parse(tn.Value);
                    }
                    if (!BLLTable <SYS_ROLE_MDLPOWER_DIC> .Exists(val))
                    {
                        BLLTable <SYS_ROLE_MDLPOWER_DIC> .Factory(conn).Insert(val);
                    }
                }
                else if (userid != "")
                {
                    SYS_USER_MDLPOWER_DIC val = new SYS_USER_MDLPOWER_DIC();
                    val.USER_ID = decimal.Parse(userid);
                    if (tn.ToolTip != "权限字典")
                    {
                        val.PAGE_URL = tn.Value; // arr[1];
                        val.DIC_ID   = 0;        //关联表里存放的是页面地址,没有权限字典的数据,这点很重要,可以根据此判断用户是否有进入某页面
                    }
                    else
                    {
                        val.PAGE_URL = tn.Parent.Value;
                        val.DIC_ID   = int.Parse(tn.Value);
                    }
                    if (!BLLTable <SYS_USER_MDLPOWER_DIC> .Exists(val))
                    {
                        BLLTable <SYS_USER_MDLPOWER_DIC> .Factory(conn).Insert(val);
                    }
                }
            }
        }
        // Response.Write(repModule.Items.Count.ToString());
        AgileFrame.Core.ScriptHelper.ResponseScript(Page, "window.close();", false);
    }