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

        var bll = new PopedomManagerBLL();

        var selectedUser = bll.GetAdminUser(int.Parse(ListBox1.SelectedValue));

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

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

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

        try
        {
            bll.ModifyUserPopedom(selectedUser);
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
    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;
    }
Example #3
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;
    }
Example #4
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);
        }
    }