Exemple #1
0
        private void DeleteFileHandler(object sender, EventArgs e)
        {
            if (((Form)sender).DialogResult != DialogResult.Yes)
            {
                return;
            }

            FileList currentList = GetActiveFileList();

            if (currentList == null)
            {
                MessageBox.Show("请选择文件", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                foreach (ListViewItem item in currentList.FileListView.Items)
                {
                    if (item.Checked)
                    {
                        CResourceEntity res      = new CResourceEntity(MidLayerSettings.ConnectionString).Load((int)item.Tag);
                        String          filePath = res.MakeFullPath();
                        _currentUser.DeleteResource((int)item.Tag);
                        System.IO.File.Delete(filePath);
                    }
                }
                DirTree selTree = GetActiveTree();
                selTree.ReloadFileList();
            }
            catch (Exception ex)
            {
                MessageBox.Show("系统错误: " + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        public virtual void DeleteFile(CUserEntity user, int resource)
        {
            CResourceEntity res      = new CResourceEntity(user.ConnString).Load(resource);
            String          filePath = res.MakeFullPath();

            user.DeleteResource(resource);
            System.IO.File.Delete(filePath);
        }
Exemple #3
0
        public virtual void DeleteFolder(CUserEntity user, int resource)
        {
            CACLEntity acl = new CACLEntity(user.ConnString);

            acl.Acl_Resource  = resource;
            acl.Acl_Operation = (int)ACLOPERATION.WRITE;
            if (!user.CheckPrivilege(acl))
            {
                throw new Exception("没有写权限!");
            }

            CResourceEntity res = new CResourceEntity(user.ConnString).Load(resource);

            String dirPath = res.MakeFullPath();

            user.DeleteResource(resource);
            System.IO.Directory.Delete(dirPath, true);
        }