private void ToolS_FolderDelete_Click(object sender, EventArgs e) { nodeTemp = this.trvDocumentList.SelectedNode; if (nodeTemp != null) { if (chkIsFile()) { MessageBox.Show("请选择文件夹的上层路径,不能选择文件节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } else { if (checkDel()) { IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.FolderDelete, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString()); if (bl == false) { MessageBox.Show("你没有权限删除文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DOC_FILE_DIR doc = new DOC_FILE_DIR(); // DocumentDirService docS = new DocumentDirService(); DataEntityQuery <DOC_FILE_DIR> query = DataEntityQuery <DOC_FILE_DIR> .Create(); IDocumentDirService _docService = ServiceContainer.GetService <DocumentDirService>(); Boolean ok = false; doc = _docService.findDoc(nodeTemp.Tag.ToString()); doc.DEL_FLAG = "Y"; ok = _docService.deleteDocumentDir(doc); if (ok == true) { MessageBox.Show("文件夹删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } else { MessageBox.Show("文件夹删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } } } } else { MessageBox.Show("请选择文件夹的上层路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } IniEvent(); }
private void OK_Click(object sender, EventArgs e) { if (this.blAddFlg == true) { if (addChecking()) { //添加 IDocumentDirService _docService = ServiceContainer.GetService <DocumentDirService>(); bool ok = false; DOC_FILE_DIR dir = new DOC_FILE_DIR(); dir.DFD_ID = Guid.NewGuid().ToString(); dir.DFD_ROOT_DIR = null; dir.DFD_PATH_NAME = this.txtNewFolder.Text.ToString(); dir.DFD_PARENT_DIR_ID = saveFileKey;// dir.DEL_FLAG = "N"; ok = _docService.addDocumentDir(dir); if (ok == true) { FileSockClient.FolderOperSocketClient folder = new FileSockClient.FolderOperSocketClient("add", new FileHelper().getDocumentAllPathByPathID(dir.DFD_ID.ToString()), ""); if (folder.AckStatus) { MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); this.Close(); } else { return; } } else { MessageBox.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } } } else { //修改 if (modifyChecking()) { DOC_FILE_DIR doc = new DOC_FILE_DIR(); IDocumentDirService docS = ServiceContainer.GetService <DocumentDirService>(); Boolean ok = false; doc = docS.findDoc(saveFileKey); string oldPath = new FileHelper().getDocumentAllPathByPathID(doc.DFD_ID.ToString()); doc.DFD_PATH_NAME = this.txtNewFolder.Text.Trim(); ok = docS.updateDocumentDir(doc); if (ok == true) { FileSockClient.FolderOperSocketClient folder = new FileSockClient.FolderOperSocketClient("modify", oldPath, new FileHelper().getDocumentAllPathByPathID(doc.DFD_ID.ToString())); if (folder.AckStatus) { MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); this.Close(); } else { return; } } else { MessageBox.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } } } }