Exemplo n.º 1
0
        public FormUserRole(FishEntity.PersonEntity user)
        {
            InitializeComponent();

            //tmiAdd.Visible = false;
            //tmiCancel.Visible = false;
            //tmiDelete.Visible = false;
            //tmiExport.Visible = false;
            //tmiModify.Visible = false;
            //tmiNext.Visible = false;
            //tmiPrevious.Visible = false;
            //tmiQuery.Visible = false;
            tmiReview.Visible = false;
            tmiprint.Visible  = false;
            _user             = user;
            label1.Text       = _user.username;

            FishBll.Bll.RoleBll          bll   = new FishBll.Bll.RoleBll();
            List <FishEntity.RoleEntity> roles = bll.GetModelList("1=1");

            if (roles == null || roles.Count < 1)
            {
                return;
            }

            foreach (FishEntity.RoleEntity item in roles)
            {
                TreeNode node = new TreeNode(item.rolename);
                node.Tag = item;
                treeView1.Nodes.Add(node);
            }

            FishBll.Bll.UserRoleBll rolebll = new FishBll.Bll.UserRoleBll();

            _oldRoles = rolebll.GetModelList("userid=" + _user.id);
            if (_oldRoles == null || _oldRoles.Count < 1)
            {
                return;
            }

            foreach (TreeNode node in treeView1.Nodes)
            {
                FishEntity.RoleEntity r = node.Tag as FishEntity.RoleEntity;
                if (r == null)
                {
                    continue;
                }
                bool isexist = _oldRoles.Exists((i) => { return(i.roleid == r.roleid); });
                if (isexist == true)
                {
                    node.Checked = true;
                }
            }
        }
Exemplo n.º 2
0
        public override int Query()
        {
            _list = _bll.GetModelList("");

            treeViewRoles.Nodes.Clear();

            if (_list == null || _list.Count < 1)
            {
                return(0);
            }

            foreach (FishEntity.RoleEntity item in _list)
            {
                TreeNode node = new TreeNode(item.rolename);
                node.Tag = item;
                treeViewRoles.Nodes.Add(node);
            }

            treeViewRoles.SelectedNode = treeViewRoles.Nodes[0];

            return(base.Query());
        }