public static void ViewFile(DESecureFile file, string fileName, string className, DELProcessInfoForCLT processArgs, bool deleteAllowed, IBizItem bizItem) { ViewFile(file, fileName, className, processArgs, deleteAllowed, bizItem, null, false); }
public static void ViewFile(DESecureFile file, string fileName, string className, DELProcessInfoForCLT processArgs, bool deleteAllowed, IBizItem bizItem, DEBrowser browser, bool isShowFileList) { CurViewFilePath = fileName; if (bizItem != null) { switch (PLGrantPerm.Agent.CanDoObjectOperation(ClientData.LogonUser.Oid, bizItem.MasterOid, bizItem.ClassName, PLGrantPerm.ToPermString(PLMBOOperation.BOView), bizItem.SecurityLevel, bizItem.Phase, bizItem.RevNum)) { case 0: MessageBoxPLM.Show("您没有浏览该对象源文件的权限。", "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; case 2: MessageBoxPLM.Show("当前对象在流程中,您没有浏览该对象源文件的权限。", "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (Path.GetExtension(fileName).ToUpper() == ".GXT") { switch (PLGrantPerm.Agent.CanDoObjectOperation(ClientData.LogonUser.Oid, bizItem.MasterOid, bizItem.ClassName, PLGrantPerm.ToPermString(PLMBOOperation.BODownload), bizItem.SecurityLevel, bizItem.Phase, bizItem.RevNum)) { case 0: MessageBoxPLM.Show("您没有下载该对象源文件的权限。", "编辑源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; case 2: MessageBoxPLM.Show("当前对象在流程中,您没有下载该对象源文件的权限。", "编辑源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } } FileBrowseWay innerBrowser = FileBrowseWay.InnerBrowser; string title = "文件浏览"; BrowserDisplayRule rule = null; if (Path.GetExtension(fileName).ToUpper() == ".GXT") { rule = new BrowserDisplayRule { IsEdit = IsEditGxt, OnlyBrowser = IsOnlyBrowser }; if (IsEditGxt) { title = "文件编辑"; } rule.Item = bizItem as DEBusinessItem; IsEditGxt = false; IsOnlyBrowser = false; } try { if (browser == null) { innerBrowser = UIBrowser.GetBrowser(file.FileOid, fileName, file.FileType, out browser); } else { innerBrowser = browser.IsInnerBrowser ? FileBrowseWay.InnerBrowser : FileBrowseWay.OpenProcess; } } catch (Exception exception) { PrintException.Print(exception, title); return; } if (innerBrowser == FileBrowseWay.InnerBrowser) { FrmViewFile file2 = null; Form form = FormManager.GetForm(PLMFormType.ViewFile, file.FileOid); if ((form != null) && (form is FrmViewFile)) { file2 = (FrmViewFile)form; if (bizItem != null) { file2.Text = bizItem.Id + "[" + ModelContext.MetaModel.GetClassLabel(bizItem.ClassName) + "] - " + title; file2.SetStatusText(GetSecureFile(bizItem, file.FileOid)); } else { file2.Text = Path.GetFileName(fileName) + " - " + title; } } else { try { file2 = new FrmViewFile(); if (bizItem != null) { file2.Text = bizItem.Id + "[" + ModelContext.MetaModel.GetClassLabel(bizItem.ClassName) + "] - " + title; file2.SetStatusText(GetSecureFile(bizItem, file.FileOid)); } else { file2.Text = Path.GetFileName(fileName) + " - " + title; } } catch (Exception exception2) { PrintException.Print(exception2, MessageBoxIcon.Exclamation); return; } file2.SetManaged(PLMFormType.ViewFile, file.FileOid); } file2.SetInput(bizItem, file, isShowFileList, processArgs, className); file2.Show(); file2.Activate(); string deleteFilePath = null; if (deleteAllowed) { deleteFilePath = Path.GetDirectoryName(fileName); } UIBrowser.OpenFileWithBrowser(file.FileOid, fileName, file2.panelBrowser, innerBrowser, browser, deleteFilePath, rule, bizItem); } else { UIBrowser.OpenFileWithBrowser(file.FileOid, fileName, null, innerBrowser, browser, Path.GetDirectoryName(fileName), bizItem); } }
private void SetInput(IBizItem bizItem, DESecureFile file, bool isShowFileList, DELProcessInfoForCLT processArgs, string className) { if (bizItem != null) { this._bizItem = PSConvert.ToBizItem(bizItem, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid); } else { this.pnlFileList.Visible = false; isShowFileList = false; } this._processArgs = processArgs; this._className = className; bool flag = isShowFileList ? (this._bizItem.FileCount > 1) : false; this.pnlFileList.Visible = flag || (this._processArgs != null); this.btnMarkup.Visible = this._processArgs != null; if (!this.IsMarkUpMode) { this.splitContainerSmall.PanelVisibility = SplitPanelVisibility.Panel1; this.panelButtons.Visible = false; this.btnMarkup.Enabled = true; } else { this.splitContainerSmall.PanelVisibility = SplitPanelVisibility.Both; this.panelButtons.Visible = true; this.btnMarkup.Enabled = false; } ArrayList fileList = null; if (isShowFileList) { fileList = this._bizItem.FileList; } else { fileList = new ArrayList { file }; } this.combFiles.SelectedIndexChanged -= new EventHandler(this.combFiles_SelectedIndexChanged); this.combFiles.DataSource = fileList; try { for (int i = 0; i < this.combFiles.Properties.Items.Count; i++) { DESecureFile file2 = this.combFiles.Properties.Items[i] as DESecureFile; if ((file2 != null) && (file2.FileOid == file.FileOid)) { this.combFiles.SelectedIndex = i; goto Label_01A1; } } } finally { this.combFiles.SelectedIndexChanged += new EventHandler(this.combFiles_SelectedIndexChanged); } Label_01A1: this.LastSelectedIndex = this.combFiles.SelectedIndex; }