コード例 #1
0
        private void objFile_FileOk(object sender, CancelEventArgs e)
        {
            int selectedResource = GetSelectedTreeResource();

            if (selectedResource <= 0)
            {
                MessageBox.Show("请选择一个目录", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                OpenFileDialog objFileDialog = (OpenFileDialog)sender;
                for (int i = 0; i < objFileDialog.Files.Count; i++)
                {
                    String filePath;
                    HttpPostedFileHandle hfh = (HttpPostedFileHandle)objFileDialog.Files[i];;
                    _currentUser.CreateFile(selectedResource, hfh.PostedFileName, out filePath);
                    hfh.SaveAs(filePath);

                    DirTree selTree = GetActiveTree();
                    selTree.ReloadFileList();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("创建文件失败:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: HelpClass.cs プロジェクト: jhoran1046/olakedms
        public virtual void UploadFile(CUserEntity user, int parentResource, OpenFileDialog objFileDialog)
        {
            CACLEntity acl = new CACLEntity(user.ConnString);

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

            for (int i = 0; i < objFileDialog.Files.Count; i++)
            {
                String filePath;
                HttpPostedFileHandle hfh = (HttpPostedFileHandle)objFileDialog.Files[i];;
                user.CreateFile(parentResource, hfh.PostedFileName, out filePath);
                hfh.SaveAs(filePath);
            }
        }