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; } }
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; }