示例#1
0
        public virtual void LoadDirectory(TreeNodeCollection objNodes, CUserEntity user, int resourceId)
        {
            objNodes.Clear();

            //insert the root node
            List <CResourceEntity> children = user.ListDescendants(resourceId);

            foreach (CResourceEntity res in children)
            {
                if (res.Res_Type != (int)RESOURCETYPE.FOLDERRESOURCE)
                {
                    continue;
                }

                bool blnHasNodes            = false;
                List <CResourceEntity> list = user.ListResources(res.Res_Id);
                foreach (CResourceEntity r in list)
                {
                    if (r.Res_Type == (int)RESOURCETYPE.FOLDERRESOURCE)
                    {
                        blnHasNodes = true;
                        break;
                    }
                }

                TreeNode objNode = new TreeNode(res.Res_Name);
                objNode.Tag = res.Res_Id;

                objNode.IsExpanded = !blnHasNodes;
                objNode.HasNodes   = blnHasNodes;

                objNode.Loaded = !blnHasNodes;
                objNodes.Add(objNode);
            }
        }
示例#2
0
        public virtual void InitDirectory(TreeNodeCollection objNodes, CUserEntity user, int resourceId)
        {
            objNodes.Clear();
            CResourceEntity rootRes = new CResourceEntity(user.ConnString).Load(resourceId);

            if (rootRes.Res_Type != (int)RESOURCETYPE.FOLDERRESOURCE)
            {
                return;
            }

            List <CResourceEntity> children = user.ListDescendants(resourceId);

            bool blnHasNodes = false;

            foreach (CResourceEntity r in children)
            {
                if (r.Res_Type == (int)RESOURCETYPE.FOLDERRESOURCE)
                {
                    blnHasNodes = true;
                    break;
                }
            }

            TreeNode objNode = new TreeNode(rootRes.Res_Name);

            objNode.Tag = resourceId;

            objNode.IsExpanded = !blnHasNodes;
            objNode.HasNodes   = blnHasNodes;

            objNode.Loaded = !blnHasNodes;
            objNodes.Add(objNode);
        }
示例#3
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            String targetText = targetBox.Text;

            if (targetText.Length <= 0)
            {
                MessageBox.Show("请填写检索内容!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            List <String> searchScopes = new List <string>();

            if (currentDirBox.Checked)
            {
                CResourceEntity res    = new CResourceEntity().Load(_resource);
                String          curDir = res.MakeFullPath();
                searchScopes.Add(curDir);
            }

            if (myDirBox.Checked)
            {
                int             myDirId = _currentUser.Usr_Resource;
                CResourceEntity res     = new CResourceEntity().Load(myDirId);
                String          myDir   = res.MakeFullPath();
                searchScopes.Add(myDir);
            }

            if (archiveDirBox.Checked)
            {
                int        archiveId = _currentUser.GetUserOrganize().Org_ArchiveRes;
                CACLEntity acl1      = new CACLEntity();
                acl1.Acl_Resource  = archiveId;
                acl1.Acl_Operation = (int)ACLOPERATION.READ;

                if (_currentUser.CheckPrivilege(acl1))
                {
                    CResourceEntity res        = new CResourceEntity().Load(archiveId);
                    String          archiveDir = res.MakeFullPath();
                    searchScopes.Add(archiveDir);
                }
                else
                {
                    List <CResourceEntity> ress = _currentUser.ListDescendants(archiveId);
                    foreach (CResourceEntity res in ress)
                    {
                        searchScopes.Add(res.MakeFullPath());
                    }
                }
            }

            if (shareDirBox.Checked)
            {
                List <CResourceEntity> ress = _currentUser.ListShareResources();
                foreach (CResourceEntity res in ress)
                {
                    searchScopes.Add(res.MakeFullPath());
                }
            }

            _result.Clear();
            foreach (String s in searchScopes)
            {
                SearchFullText(targetText, s);
            }

            this.DialogResult = DialogResult.OK;
            Close();
        }