private void ToolS_FolderAdd_Click(object sender, EventArgs e) { nodeTemp = this.trvDocumentList.SelectedNode; if (nodeTemp != null) { if (chkIsFile()) { MessageBox.Show("请选择文件夹的上层路径,不能选择文件节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } else { IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.FolderCreate, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString()); if (bl == false) { MessageBox.Show("你没有权限在此文件下创建文件夹!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //MessageBox.Show(nodeTemp.Text.ToString()); CreateNewFolderFrm frm = new CreateNewFolderFrm(); frm.SaveFilepath = fileHelper.getDocumentAllPathByPathID(nodeTemp.Tag.ToString()); frm.SaveFileKey = nodeTemp.Tag.ToString(); frm.BlAddFlg = true; frm.ShowDialog(); } } else { MessageBox.Show("请选择文件夹的上层路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } IniEvent(); }
private void tspViewFile_Click(object sender, EventArgs e) { if (chkIsFile()) { IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.View, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString()); if (bl == false) { MessageBox.Show("你没有权限查看此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string fileName = this.trvDocumentList.SelectedNode.Text.ToString(); string swfFileName = System.IO.Path.GetFileNameWithoutExtension(fileName) + @".swf"; //下载文件 try { FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(ViewFilePath + swfFileName, this.SaveTempPath + swfFileName); if (!downSocket.AckStatus) { return; } } catch (Exception ex) { MessageBox.Show("下载数据异常!:" + ex.Message.ToString(), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); return; } if (tspInView.Checked) { // this.webB.Navigate(@"D:\swf\文件权限管理.swf"); this.webB.Navigate(this.SaveTempPath + swfFileName); } else { ViewFileFrm fileView = new ViewFileFrm(); // fileView.FileName = "文件权限管理.swf"; fileView.FileName = swfFileName; // fileView.ViewFilePath = @"D:\swf\"; fileView.ViewFilePath = this.SaveTempPath; fileView.ShowDialog(); } } else { MessageBox.Show("请在窗体左边的清单中选择需要预览的文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } }
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 tspFileDownLoad_Click(object sender, EventArgs e) { string serverpath = ""; if (chkIsFile()) { IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper(); TreeNode node = this.trvDocumentList.SelectedNode; string dd = node.Text; string ee = node.Tag.ToString(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.DownLoad, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString()); if (bl == false) { MessageBox.Show("你没有权限下载此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.FileName = this.trvDocumentList.SelectedNode.Text.ToString(); saveDialog.Filter = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; DialogResult res = saveDialog.ShowDialog(); if (DialogResult.OK == res) { string clientSaveFileAndPath = saveDialog.FileName.ToString(); serverpath = file.getDocumentAllPathByFileID(this.trvDocumentList.SelectedNode.Tag.ToString()) + this.trvDocumentList.SelectedNode.Text.ToString(); //FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, @"C:\\" + node.Cells[0].Value.ToString()); FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, clientSaveFileAndPath); } else { MessageBox.Show("请选择需要下载的文件" + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } //ViewFileFrm fileView = new ViewFileFrm(); //fileView.FileName = "文件名称.txt"; //fileView.ViewFilePathAndName = @"D:\swf\Java网络编程精解.swf"; //fileView.ShowDialog(); } else { MessageBox.Show("请在窗体左边的清单中选择需要预览的文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } }
private void tspViewFile_Click(object sender, EventArgs e) { if (chkIsFile()) { IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.View, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString()); if (bl == false) { MessageBox.Show("你没有权限查看此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string fileName = this.trvDocumentList.SelectedNode.Text.ToString(); string swfFileName = System.IO.Path.GetFileNameWithoutExtension(fileName) + @".swf"; //下载文件 try { FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(ViewFilePath + swfFileName, this.SaveTempPath + swfFileName); if (!downSocket.AckStatus) { return; } } catch (Exception ex) { MessageBox.Show("下载数据异常!:" + ex.Message.ToString(), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); return; } if (tspInView.Checked) { // this.webB.Navigate(@"D:\swf\文件权限管理.swf"); this.webB.Navigate(this.SaveTempPath + swfFileName); } else { ViewFileFrm fileView = new ViewFileFrm(); // fileView.FileName = "文件权限管理.swf"; fileView.FileName = swfFileName; // fileView.ViewFilePath = @"D:\swf\"; fileView.ViewFilePath = this.SaveTempPath; fileView.ShowDialog(); } } else { MessageBox.Show("请在窗体左边的清单中选择需要预览的文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } }
private void tspFileDownLoad_Click(object sender, EventArgs e) { string serverpath = ""; if (chkIsFile()) { IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper(); TreeNode node = this.trvDocumentList.SelectedNode; string dd = node.Text; string ee = node.Tag.ToString(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.DownLoad, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString()); if (bl == false) { MessageBox.Show("你没有权限下载此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.FileName = this.trvDocumentList.SelectedNode.Text.ToString(); saveDialog.Filter = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; DialogResult res = saveDialog.ShowDialog(); if (DialogResult.OK == res) { string clientSaveFileAndPath = saveDialog.FileName.ToString(); serverpath = file.getDocumentAllPathByFileID(this.trvDocumentList.SelectedNode.Tag.ToString()) + this.trvDocumentList.SelectedNode.Text.ToString(); //FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, @"C:\\" + node.Cells[0].Value.ToString()); FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, clientSaveFileAndPath); } else { MessageBox.Show("请选择需要下载的文件" + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } //ViewFileFrm fileView = new ViewFileFrm(); //fileView.FileName = "文件名称.txt"; //fileView.ViewFilePathAndName = @"D:\swf\Java网络编程精解.swf"; //fileView.ShowDialog(); } else { MessageBox.Show("请在窗体左边的清单中选择需要预览的文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } }
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 ToolS_FolderAmend_Click(object sender, EventArgs e) { nodeTemp = this.trvDocumentList.SelectedNode; if (nodeTemp != null) { if (chkIsFile()) { MessageBox.Show("请选择文件夹的上层路径,不能选择文件节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } else { IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.FolderEdit, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString()); if (bl == false) { MessageBox.Show("你没有权限修改此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //MessageBox.Show(nodeTemp.Text.ToString()); CreateNewFolderFrm frm = new CreateNewFolderFrm(); frm.SaveFilepath = fileHelper.getDocumentAllPathByPathID(nodeTemp.Tag.ToString()); frm.SaveFileKey = nodeTemp.Tag.ToString(); frm.BlAddFlg = false; frm.FatherFileKey = nodeTemp.Parent.Tag.ToString(); frm.ModifyFolderText = nodeTemp.Text.ToString(); frm.DocName = nodeTemp.Text.ToString(); frm.ShowDialog(); } } else { MessageBox.Show("请选择文件夹的上层路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } IniEvent(); }
private void ToolS_FilesAdd_Click(object sender, EventArgs e) { nodeTemp = this.trvDocumentList.SelectedNode; if (nodeTemp != null) { if (chkIsFile()) { MessageBox.Show("请选择文件存放的路径,不能选择文件节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } else { IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.UpLoad, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString()); if (bl == false) { MessageBox.Show("你没有权限上传文件到此文件夹!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //MessageBox.Show(nodeTemp.Text.ToString()); CreateNewFileFrm frm = new CreateNewFileFrm(); frm.SaveFilepath = fileHelper.getDocumentAllPathByPathID(nodeTemp.Tag.ToString()); frm.ShowDialog(); } } else { MessageBox.Show("请选择文件存放的路径节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } }