示例#1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ListBox1.SelectedItem == null)
        {
            lblError.Text = "请选择角色!以对所选择的角色进行权限分配!";
            return;
        }

        var bll = new PopedomManagerBLL();

        // 获取所选定的角色
        var selectedRole = bll.GetRole(int.Parse(ListBox1.SelectedValue));

        if (selectedRole == null)
        {
            lblError.Text = "请选择角色!以对所选择的角色进行权限分配!";
            return;
        }

        // 获取分配给用户权限的模块ID列表

        // 保存至数据库
        selectedRole.PopedomIDList = (from TreeNode node in TreeView1.CheckedNodes
                                      where node.Checked
                                      select int.Parse(node.Value.Trim())).ToArray();

        try
        {
            bll.ModifyRolePopedom(selectedRole);
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var bll = new PopedomManagerBLL();

            bindAdminRoleList(bll);
            if (!string.IsNullOrEmpty(Request["id"]) && ListBox1.Items.FindByValue(Request["id"]) != null)
            {
                ListBox1.SelectedValue = Request["id"];
            }

            DisplayModuleTree(bll);
        }
    }
示例#3
0
    private void bindAdminRoleList(PopedomManagerBLL bll)
    {
        ListBox1.Items.Clear();

        var roles = bll.GetCachingRoleList();

        foreach (var role in roles)
        {
            ListBox1.Items.Add(new ListItem(string.Format("{0}", role.RoleName), role.ID.ToString()));
        }

        if (ListBox1.Items.Count > 0)
        {
            ListBox1.SelectedIndex = 0;
        }
    }
示例#4
0
    private void DisplayModuleTree(PopedomManagerBLL bll)
    {
        if (ListBox1.SelectedItem == null)
        {
            return;
        }

        // 获取所选定的角色
        var selectedRole = bll.GetRole(int.Parse(ListBox1.SelectedValue.Trim()));

        var moduleTree = new AccountBLL().GetModulesTree();

        // 递归加载字模块显示树结点
        TreeView1.Nodes.Clear();
        bindMenuTree(selectedRole, TreeView1.Nodes, moduleTree.SubList);

        lblSelectedUser.Text = ListBox1.SelectedItem.Text;
    }
    private void displayModuleTree(PopedomManagerBLL BLL)
    {
        if (ListBox1.SelectedItem == null)
        {
            return;
        }

        // 获取所选定的用户
        UserInfo selectedUser = BLL.GetAdminUser(int.Parse(ListBox1.SelectedValue));

        Tree <ModuleInfo> moduleTree = new AccountBLL().GetModulesTree();

        // 递归加载子模块显示树结点
        TreeView1.Nodes.Clear();
        bindMenuTree(selectedUser, TreeView1.Nodes, moduleTree.SubList);

        lblSelectedUser.Text = ListBox1.SelectedItem.Text;
    }
示例#6
0
    private void DisplayModuleTree(PopedomManagerBLL BLL)
    {
        if (ListBox1.SelectedItem == null)
        {
            return;
        }

        // 获取所选定的用户
        var selectedUser = BLL.GetAdminUser(int.Parse(ListBox1.SelectedValue));

        var allRoleList = BLL.GetCachingRoleList();
        var moduleTree  = new AccountBLL().GetModulesTree();

        // 递归加载字模块显示树结点
        TreeView1.Nodes.Clear();
        bindMenuTree(selectedUser, allRoleList, TreeView1.Nodes, moduleTree.SubList);

        lblSelectedUser.Text = ListBox1.SelectedItem.Text;
    }
示例#7
0
    private void BindAdminUserList(PopedomManagerBLL bll)
    {
        ListBox1.Items.Clear();

        var users = bll.GetAdminUserList();

        foreach (var user in users)
        {
            if (user.IsSystem)
            {
                continue;
            }

            ListBox1.Items.Add(new ListItem(string.Format("{0}({1})", user.Alias, user.UserName), user.ID.ToString()));
        }

        if (ListBox1.Items.Count > 0)
        {
            ListBox1.SelectedIndex = 0;
        }
    }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var bll = new PopedomManagerBLL();

            BindAdminUserList(bll);

            if (!string.IsNullOrEmpty(Request["id"]))
            {
                // 获取所选定的用户
                UserInfo selectedUser = bll.GetAdminUser(int.Parse(Request["id"].Trim()));

                if (selectedUser != null && ListBox1.Items.FindByValue(selectedUser.ID.ToString()) != null)
                {
                    ListBox1.SelectedValue = selectedUser.ID.ToString();
                }
            }

            DisplayModuleTree(bll);
        }
    }