public isHasAuth ( |
||
authType | 查询的权限参数,查看,编辑 | |
userAccount | string | 用户账户(KEY值) |
fileKey | string | 文件key值 |
Результат | System.Boolean |
/// <summary> /// 文件下载 /// </summary> private void downLoadFile(TreeGridView tgv, DataType.FileType fileType) { TreeGridNode node = null;//当前选择的节点 String serverpath = ""; node = new TreeGridNode(); //node = this.tvFileList.CurrentNode; node = tgv.CurrentNode; int index = node.RowIndex; if (index <= 0) { MessageBox.Show("请选择需要下载的文件" + "(" + index + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (tgv.CurrentRow == null) { MessageBox.Show("请选择需要下载的文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { HYDocumentMS.IFileHelper file = new FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.DownLoad, LoginInfo.LoginID, tgv.CurrentRow.Cells["DFL_ID"].Value.ToString()); if (bl == false) { MessageBox.Show("你没有权限下载此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.FileName = node.Cells[0].Value.ToString(); //saveDialog.Filter = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; string suffix = node.Cells[0].Value.ToString().Substring(node.Cells[0].Value.ToString().LastIndexOf(@".") + 1); saveDialog.Filter = @"文件 (*." + suffix + ")|*." + suffix; DialogResult res = saveDialog.ShowDialog(); //SaveFileDialog saveDialog = new SaveFileDialog(); //saveDialog.FileName = node.Cells[0].Value.ToString(); //saveDialog.Filter = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; //DialogResult res = saveDialog.ShowDialog(); if (DialogResult.OK == res) { string clientSaveFileAndPath = saveDialog.FileName.ToString(); //MessageBox.Show(clientSavepath); // MessageBox.Show(index.ToString()); if (index > 0) //取消第一行 { serverpath = node.Cells[1].Value.ToString() + node.Cells[0].Value.ToString(); // MessageBox.Show(serverpath); //FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, @"C:\\" + node.Cells[0].Value.ToString()); FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, clientSaveFileAndPath); if (!downSocket.AckStatus) { return; } } else { MessageBox.Show("请选择需要下载的文件" + "(" + index + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } // this.tvFileList.CurrentRow }
/// <summary> /// 删除文件 /// </summary> private void delFile(TreeGridView tgv,DataType.FileType fileType) { int rowIndex = tgv.CurrentCell.RowIndex; if (rowIndex <= 0) { MessageBox.Show("请选择文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } HYDocumentMS.IFileHelper file = new FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.Delete, LoginInfo.LoginID, tgv.CurrentRow.Cells["DFL_ID"].Value.ToString()); if (bl == false) { MessageBox.Show("你没有权限删除此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("所选择的文件将被删除,是否确定?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { DataGridViewRow row = tgv.Rows[rowIndex]; string dflID = row.Cells["DFL_ID"].Value.ToString(); //var file = _physicalService.GetPhysicalFile(Id, ""); // IDocFileListService serv = new DocFileListService(); if (_docFileListService.delDocFileByDFLID(dflID)) { MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } else { MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } this.BindTreeData(); //serv. //file.Delete(); // MessageBox.Show("所选择的文件已被删除!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// checkin文件 /// </summary> /// <param name="tgv"></param> /// <param name="fileType"></param> private void CheckInFile(TreeGridView tgv, DataType.FileType fileType) { int rowIndex = tgv.CurrentCell.RowIndex; if (rowIndex <= 0) { MessageBox.Show("请选择文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataGridViewRow row = tgv.Rows[rowIndex]; String Id = row.Cells["DFL_ID"].Value.ToString(); DOC_FILE_LIST docFileEntity = _docFileListService.GetDocFileEntityByDCID(Id); // HYPDM.Entities.PDM_PHYSICAL_FILE physicalfile = _physicalService.GetPhysicalFile(Id, ""); HYDocumentMS.IFileHelper file = new FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.CheckIn, LoginInfo.LoginID, row.Cells["DFL_ID"].Value.ToString()); if (bl == false) { MessageBox.Show("你没有权限检入此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (docFileEntity == null) return; if (docFileEntity.CHECKOUTFLG == "N") { MessageBox.Show("文件名【" + docFileEntity.DFL_FILE_NAME + "】" + "\n" + "不为检出状态,不能进行检入操作!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { CheckInForm form = new CheckInForm(); form.DocFileEntity = docFileEntity; if (form.ShowDialog() == DialogResult.OK) { docFileEntity.CHECKINFLG = "Y"; docFileEntity.CHECKINDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); docFileEntity.CHECKOUTFLG = "N"; docFileEntity.DFL_VER_LATEST = "V" + DateTime.Now.ToString("yyyyMMddHHmmss"); docFileEntity.LASTUPDATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); docFileEntity.LASTUPDATEUSER = LoginInfo.LoginID; docFileEntity.Save(); VersionSave("1", docFileEntity); } } }
/// <summary> /// 检出文件 /// </summary> /// <param name="tgv"></param> /// <param name="fileType"></param> private void CheckOut(TreeGridView tgv, DataType.FileType fileType) { int rowIndex = tgv.CurrentCell.RowIndex; if (rowIndex <= 0) { MessageBox.Show("请选择文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataGridViewRow row = tgv.Rows[rowIndex]; HYDocumentMS.IFileHelper file = new FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.CheckOut, LoginInfo.LoginID, row.Cells["DFL_ID"].Value.ToString()); if (bl == false) { MessageBox.Show("你没有权限检出此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } String Id = row.Cells["DFL_ID"].Value.ToString(); DOC_FILE_LIST docFileEntity = _docFileListService.GetDocFileEntityByDCID(Id); // HYPDM.Entities.PDM_PHYSICAL_FILE physicalfile = _physicalService.GetPhysicalFile(Id, ""); if (docFileEntity == null) return; if (docFileEntity.CHECKOUTFLG == "Y") { MessageBox.Show("当前文档已被检出,不能再次检出,请等待检出人检入!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DetectionForm form = new DetectionForm(); form.DocFileEntity = docFileEntity; if (form.ShowDialog() == DialogResult.OK) { docFileEntity.CHECKOUTFLG = "Y"; docFileEntity.CHECKINFLG = "N"; docFileEntity.CHECKOUTDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); docFileEntity.LASTUPDATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); docFileEntity.LASTUPDATEUSER = LoginInfo.LoginID; docFileEntity.Save(); try { VersionSave("0", docFileEntity); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { MessageBox.Show("文件检出成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
/// <summary> /// 查看文件 /// </summary> /// <param name="tgv"></param> /// <param name="fileType"></param> private void ViewFile(TreeGridView tgv, DataType.FileType fileType) { int rowIndex = tgv.CurrentCell.RowIndex; if (rowIndex <= 0) { MessageBox.Show("请选择文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { // dr["DFL_FILE_NAME"].ToString() DataGridViewRow row = tgv.Rows[rowIndex]; // string ff = row.Cells[0].Value.ToString(); HYDocumentMS.IFileHelper file = new FileHelper(); Boolean bl = file.isHasAuth(DataType.AuthParmsType.View, LoginInfo.LoginID, row.Cells["DFL_ID"].Value.ToString()); if (bl == false) { MessageBox.Show("你没有权限查看此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } String fileName = Path.ChangeExtension(row.Cells["DFL_FILE_NAME"].Value.ToString(), "swf"); string viewPath = System.Configuration.ConfigurationManager.AppSettings["viewFilePath"].ToString(); ViewFileFrm fileView = new ViewFileFrm(); fileView.FileName = fileName; //fileView.ViewFilePathAndName = @"D:\swf\Java网络编程精解.swf"; fileView.ViewFilePath = viewPath; fileView.ShowDialog(); } }