void btn_Click(object sender, EventArgs e) { BP.Sys.FrmAttachment athDesc = new BP.Sys.FrmAttachment(this.FK_FrmAttachment); System.Web.UI.WebControls.FileUpload fu = this.Pub1.FindControl("file") as System.Web.UI.WebControls.FileUpload; if (fu.HasFile == false || fu.FileName.Length <= 2) { this.Alert("请选择上传的文件."); return; } if (System.IO.Directory.Exists(athDesc.SaveTo) == false) { System.IO.Directory.CreateDirectory(athDesc.SaveTo); } int oid = BP.DA.DBAccess.GenerOID(); string exp = ""; string saveTo = athDesc.SaveTo + "\\" + oid + "." + fu.FileName.Substring(fu.FileName.LastIndexOf('.') + 1); fu.SaveAs(saveTo); FileInfo info = new FileInfo(saveTo); FrmAttachmentDB dbUpload = new FrmAttachmentDB(); dbUpload.MyPK = athDesc.FK_MapData + oid.ToString(); dbUpload.FK_FrmAttachment = this.FK_FrmAttachment; dbUpload.RefPKVal = this.PKVal.ToString(); dbUpload.FK_MapData = athDesc.FK_MapData; dbUpload.FileExts = info.Extension; dbUpload.FileFullName = saveTo; dbUpload.FileName = fu.FileName; dbUpload.FileSize = (float)info.Length; dbUpload.RDT = DataType.CurrentDataTime; dbUpload.Rec = BP.Web.WebUser.No; dbUpload.RecName = BP.Web.WebUser.Name; if (athDesc.IsNote) { dbUpload.MyNote = this.Pub1.GetTextBoxByID("TB_Note").Text; } if (athDesc.Sort.Contains(",")) { dbUpload.Sort = this.Pub1.GetDDLByID("ddl").SelectedItemStringVal; } dbUpload.Insert(); this.Response.Redirect("AttachmentUpload.aspx?IsBTitle=" + this.IsBTitle + "&FK_FrmAttachment=" + this.FK_FrmAttachment + "&PKVal=" + this.PKVal, true); }
/// <summary> /// 删除附件 /// </summary> /// <param name="MyPK"></param> /// <returns></returns> private string DelWorkCheckAttach(string MyPK) { FrmAttachmentDB athDB = new FrmAttachmentDB(); athDB.RetrieveByAttr(FrmAttachmentDBAttr.MyPK, MyPK); //删除文件 if (athDB.FileFullName != null) { if (File.Exists(athDB.FileFullName) == true) { File.Delete(athDB.FileFullName); } } int i = athDB.Delete(FrmAttachmentDBAttr.MyPK, MyPK); if (i > 0) { return("true"); } return("false"); }
protected void Page_Load(object sender, EventArgs e) { if (this.DoType == "Del") { FrmAttachmentDB delDB = new FrmAttachmentDB(); delDB.MyPK = this.DelPKVal; delDB.DirectDelete(); } if (this.DoType == "Down") { FrmAttachmentDB downDB = new FrmAttachmentDB(); downDB.MyPK = this.MyPK; downDB.Retrieve(); BP.PubClass.DownloadFile(downDB.FileFullName, downDB.FileName); this.WinClose(); return; } BP.Sys.FrmAttachment athDesc = new BP.Sys.FrmAttachment(); athDesc.MyPK = this.FK_FrmAttachment; if (athDesc.RetrieveFromDBSources() == 0) { } this.Title = athDesc.Name; this.Pub1.AddTable("width='100%'"); if (this.IsBTitle == "1") { this.Pub1.AddTR(); this.Pub1.AddTDTitle("IDX"); if (athDesc.Sort.Contains(",")) { this.Pub1.AddTDTitle("类别"); } this.Pub1.AddTDTitle("文件名"); this.Pub1.AddTDTitle("大小KB"); this.Pub1.AddTDTitle("上传日期"); this.Pub1.AddTDTitle("上传人"); if (athDesc.IsNote) { this.Pub1.AddTDTitle("备注"); } this.Pub1.AddTDTitle("操作"); this.Pub1.AddTREnd(); } else { this.Pub1.AddTR(); this.Pub1.AddTD("IDX"); if (athDesc.Sort.Contains(",")) { this.Pub1.AddTD("类别"); } this.Pub1.AddTD("文件名"); this.Pub1.AddTD("大小KB"); this.Pub1.AddTD("上传日期"); this.Pub1.AddTD("上传人"); if (athDesc.IsNote) { this.Pub1.AddTD("备注"); } this.Pub1.AddTD("操作"); this.Pub1.AddTREnd(); } BP.Sys.FrmAttachmentDBs dbs = new BP.Sys.FrmAttachmentDBs(); dbs.Retrieve(FrmAttachmentDBAttr.FK_FrmAttachment, this.FK_FrmAttachment, FrmAttachmentDBAttr.RefPKVal, this.PKVal); int i = 0; foreach (FrmAttachmentDB db in dbs) { i++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(i); if (athDesc.Sort.Contains(",")) { this.Pub1.AddTD(db.Sort); } // this.Pub1.AddTDIdx(i++); if (athDesc.IsDownload) { this.Pub1.AddTD("<a href='AttachmentUpload.aspx?DoType=Down&MyPK=" + db.MyPK + "' target=_blank ><img src='/WF/Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='/WF/Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>"); } else { this.Pub1.AddTD(db.FileName); } this.Pub1.AddTD(db.FileSize); this.Pub1.AddTD(db.RDT); this.Pub1.AddTD(db.RecName); if (athDesc.IsNote) { this.Pub1.AddTD(db.MyNote); } if (athDesc.IsDelete && this.IsReadonly != "1") { this.Pub1.AddTD("<a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a>"); } else { this.Pub1.AddTD(""); } this.Pub1.AddTREnd(); } if (athDesc.IsUpload && this.IsReadonly != "1") { this.Pub1.AddTR(); this.Pub1.AddTDBegin("colspan=7"); this.Pub1.Add("文件:"); System.Web.UI.WebControls.FileUpload fu = new System.Web.UI.WebControls.FileUpload(); fu.ID = "file"; fu.BorderStyle = BorderStyle.NotSet; this.Pub1.Add(fu); if (athDesc.Sort.Contains(",")) { string[] strs = athDesc.Sort.Split(','); BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL(); ddl.ID = "ddl"; foreach (string str in strs) { if (str == null || str == "") { continue; } ddl.Items.Add(new ListItem(str, str)); } this.Pub1.Add(ddl); } if (athDesc.IsNote) { TextBox tb = new TextBox(); tb.ID = "TB_Note"; tb.Attributes["Width"] = "100%"; tb.Attributes["class"] = "TBNote"; tb.Columns = 30; this.Pub1.Add(" 备注:"); this.Pub1.Add(tb); } Button btn = new Button(); btn.Text = "上传"; btn.ID = "Btn_Upload"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); }
private void SingleAttach(HttpContext context, string attachPk, string workid, string fk_node, string ensName) { FrmAttachment frmAth = new FrmAttachment(); frmAth.MyPK = attachPk; frmAth.RetrieveFromDBSources(); string athDBPK = attachPk + "_" + workid; BP.WF.Node currND = new BP.WF.Node(fk_node); BP.WF.Work currWK = currND.HisWork; currWK.OID = long.Parse(workid); currWK.Retrieve(); //处理保存路径. string saveTo = frmAth.SaveTo; if (saveTo.Contains("*") || saveTo.Contains("@")) { /*如果路径里有变量.*/ saveTo = saveTo.Replace("*", "@"); saveTo = BP.WF.Glo.DealExp(saveTo, currWK, null); } try { saveTo = context.Server.MapPath("~/" + saveTo); } catch (Exception) { saveTo = saveTo; } if (System.IO.Directory.Exists(saveTo) == false) { System.IO.Directory.CreateDirectory(saveTo); } saveTo = saveTo + "\\" + athDBPK + "." + context.Request.Files[0].FileName.Substring(context.Request.Files[0].FileName.LastIndexOf('.') + 1); context.Request.Files[0].SaveAs(saveTo); FileInfo info = new FileInfo(saveTo); FrmAttachmentDB dbUpload = new FrmAttachmentDB(); dbUpload.MyPK = athDBPK; dbUpload.FK_FrmAttachment = attachPk; dbUpload.RefPKVal = workid; dbUpload.FK_MapData = ensName; dbUpload.FileExts = info.Extension; dbUpload.FileFullName = saveTo; dbUpload.FileName = context.Request.Files[0].FileName; dbUpload.FileSize = (float)info.Length; dbUpload.Rec = WebUser.No; dbUpload.RecName = WebUser.Name; dbUpload.RDT = BP.DA.DataType.CurrentDataTime; dbUpload.NodeID = fk_node; dbUpload.Save(); }
public void MoreAttach(HttpContext context, string attachPk, string workid, string fk_node, string ensNamestring, string fk_flow, string pkVal) { BP.Sys.FrmAttachment athDesc = new BP.Sys.FrmAttachment(attachPk); string savePath = athDesc.SaveTo; if (savePath.Contains("@") == true || savePath.Contains("*") == true) { /*如果有变量*/ savePath = savePath.Replace("*", "@"); GEEntity en = new GEEntity(athDesc.FK_MapData); en.PKVal = pkVal; en.Retrieve(); savePath = BP.WF.Glo.DealExp(savePath, en, null); if (savePath.Contains("@") && fk_node != null) { /*如果包含 @ */ BP.WF.Flow flow = new BP.WF.Flow(fk_flow); BP.WF.Data.GERpt myen = flow.HisGERpt; myen.OID = long.Parse(workid); myen.RetrieveFromDBSources(); savePath = BP.WF.Glo.DealExp(savePath, myen, null); } if (savePath.Contains("@") == true) { throw new Exception("@路径配置错误,变量没有被正确的替换下来." + savePath); } } else { savePath = athDesc.SaveTo + "\\" + pkVal; } //替换关键的字串. savePath = savePath.Replace("\\\\", "\\"); try { savePath = context.Server.MapPath("~/" + savePath); } catch (Exception) { savePath = savePath; } try { if (System.IO.Directory.Exists(savePath) == false) { System.IO.Directory.CreateDirectory(savePath); //System.IO.Directory.CreateDirectory(athDesc.SaveTo); } } catch (Exception ex) { throw new Exception("@创建路径出现错误,可能是没有权限或者路径配置有问题:" + context.Server.MapPath("~/" + savePath) + "===" + savePath + "@技术问题:" + ex.Message); } string exts = System.IO.Path.GetExtension(context.Request.Files[0].FileName).ToLower().Replace(".", ""); //int oid = BP.DA.DBAccess.GenerOID(); string guid = BP.DA.DBAccess.GenerGUID(); string fileName = context.Request.Files[0].FileName.Substring(0, context.Request.Files[0].FileName.LastIndexOf('.')); //string ext = fu.FileName.Substring(fu.FileName.LastIndexOf('.') + 1); string ext = System.IO.Path.GetExtension(context.Request.Files[0].FileName); //string realSaveTo = Server.MapPath("~/" + savePath) + "/" + guid + "." + fileName + "." + ext; //string realSaveTo = Server.MapPath("~/" + savePath) + "\\" + guid + "." + fu.FileName.Substring(fu.FileName.LastIndexOf('.') + 1); //string saveTo = savePath + "/" + guid + "." + fileName + "." + ext; string realSaveTo = savePath + "/" + guid + "." + fileName + ext; string saveTo = realSaveTo; try { context.Request.Files[0].SaveAs(realSaveTo); } catch (Exception ex) { throw; } FileInfo info = new FileInfo(realSaveTo); FrmAttachmentDB dbUpload = new FrmAttachmentDB(); dbUpload.MyPK = guid; // athDesc.FK_MapData + oid.ToString(); dbUpload.NodeID = fk_node.ToString(); dbUpload.FK_FrmAttachment = attachPk; dbUpload.FK_MapData = athDesc.FK_MapData; dbUpload.FK_FrmAttachment = attachPk; dbUpload.FileExts = info.Extension; dbUpload.FileFullName = saveTo; dbUpload.FileName = context.Request.Files[0].FileName; dbUpload.FileSize = (float)info.Length; dbUpload.RDT = DataType.CurrentDataTimess; dbUpload.Rec = BP.Web.WebUser.No; dbUpload.RecName = BP.Web.WebUser.Name; dbUpload.RefPKVal = pkVal; //if (athDesc.IsNote) // dbUpload.MyNote = this.Pub1.GetTextBoxByID("TB_Note").Text; //if (athDesc.Sort.Contains(",")) // dbUpload.Sort = this.Pub1.GetDDLByID("ddl").SelectedItemStringVal; dbUpload.UploadGUID = guid; dbUpload.Insert(); }
protected void Page_Load(object sender, EventArgs e) { MapData md = new MapData(this.FK_MapData); FrmAttachment athDesc = new FrmAttachment(); int i = athDesc.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData, FrmAttachmentAttr.NoOfObj, "DocMainAth"); if (i == 0) { /*如果没有数据.*/ /*如果没有查询到它,就有可能是公文多附件被删除了.*/ athDesc.NoOfObj = "DocMainAth"; athDesc.Exts = "doc,docx,xls,xlsx"; athDesc.MyPK = athDesc.FK_MapData + "_" + athDesc.NoOfObj; athDesc.FK_MapData = this.FK_MapData; //存储路径. string path = Server.MapPath("/DataUser/UploadFile/"); path += "\\F" + this.FK_Flow + "MainAth"; athDesc.SaveTo = path; //位置. athDesc.X = (float)94.09; athDesc.Y = (float)140.18; athDesc.W = (float)626.36; athDesc.H = (float)150; //多附件. athDesc.UploadType = AttachmentUploadType.Single; athDesc.Name = "公文正文(系统自动增加)"; athDesc.SetValByKey("AtPara", "@IsWoEnablePageset=1@IsWoEnablePrint=1@IsWoEnableViewModel=1@IsWoEnableReadonly=0@IsWoEnableSave=1@IsWoEnableWF=1@IsWoEnableProperty=1@IsWoEnableRevise=1@IsWoEnableIntoKeepMarkModel=1@FastKeyIsEnable=0@IsWoEnableViewKeepMark=1@FastKeyGenerRole=@IsWoEnableTemplete=1"); athDesc.Insert(); //有可能在其其它的节点上没有这个附件,所以也要循环增加上它. BP.WF.Nodes nds = new Nodes(this.FK_Flow); foreach (Node nd in nds) { athDesc.FK_MapData = "ND" + nd.NodeID; athDesc.MyPK = athDesc.FK_MapData + "_" + athDesc.NoOfObj; if (athDesc.IsExits == true) { continue; } athDesc.Insert(); } //重新查询一次,把默认值加上. athDesc.RetrieveFromDBSources(); } FrmAttachmentDBs athDBs = null; athDBs = new FrmAttachmentDBs(this.FK_MapData, this.WorkID.ToString()); FrmAttachmentDB athDB = null; if (athDBs.Count == 0 && this.IsCC == "1") { /*如果是抄送过来的, 有可能是抄送到的节点不是发送到的节点,导致附件数据没有copy。 * 也就是说,发给b节点,但是抄送到c节点上去了,导致c节点上的人看不到附件数据。*/ CCList cc = new CCList(); int nnn = cc.Retrieve(CCListAttr.FK_Node, this.FK_Node, CCListAttr.WorkID, this.WorkID, CCListAttr.CCTo, WebUser.No); this._fk_node = cc.NDFrom; if (cc.NDFrom != 0) { athDBs.Retrieve(FrmAttachmentDBAttr.FK_MapData, "ND" + cc.NDFrom, FrmAttachmentDBAttr.RefPKVal, this.WorkID.ToString()); string ndFromMapdata = athDesc.MyPK.Replace(athDesc.FK_MapData, "ND" + cc.NDFrom); athDB = athDBs.GetEntityByKey(FrmAttachmentDBAttr.FK_FrmAttachment, ndFromMapdata) as FrmAttachmentDB; //重新设置文件描述。 athDesc.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData, FrmAttachmentAttr.NoOfObj, "DocMainAth"); } } else { /* 单个文件 */ athDB = athDBs.GetEntityByKey(FrmAttachmentDBAttr.FK_FrmAttachment, athDesc.MyPK) as FrmAttachmentDB; } Label lab = new Label(); lab.ID = "Lab" + athDesc.MyPK; this.Pub1.Add(lab); if (athDB != null) { if (athDB.FileExts == "ceb") { athDB.FileExts = "pdf"; } if (athDesc.IsWoEnableWF) { lab.Text = "<a href=\"javascript:OpenOfiice('" + athDB.FK_FrmAttachment + "','" + this.WorkID + "','" + athDB.MyPK + "','" + this.FK_MapData + "','" + athDesc.NoOfObj + "','" + this.FK_Node + "')\"><img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/FileType/" + athDB.FileExts + ".gif' border=0/>" + athDB.FileName + "</a>"; } else { lab.Text = "<img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/FileType/" + athDB.FileExts + ".gif' border=0/>" + athDB.FileName; } } #region 处理权限问题. // 处理权限问题, 有可能当前节点是可以上传或者删除,但是当前节点上不能让此人执行工作。 bool isDel = athDesc.IsDeleteInt == 0 ? false : true; bool isUpdate = athDesc.IsUpload; if (isDel == true || isUpdate == true) { if (this.WorkID != 0 && string.IsNullOrEmpty(this.FK_Flow) == false) { isDel = BP.WF.Dev2Interface.Flow_IsCanDoCurrentWork(this.FK_Flow, this.FK_Node, this.WorkID, WebUser.No); if (isDel == false) { isUpdate = false; } } } #endregion 处理权限问题. Button mybtn = new Button(); mybtn.CssClass = "Btn"; if (athDesc.IsUpload && isUpdate == true) { FileUpload fu = new FileUpload(); fu.ID = athDesc.MyPK; Btn_Upload.ID = "Btn_Upload_" + athDesc.MyPK + "_" + this.WorkID; fu.Attributes["Width"] = athDesc.W.ToString(); fu.Attributes["onchange"] = "UploadChange('" + mybtn.ID + "');"; this.Pub1.Add(fu); } if (athDesc.IsDownload) { mybtn = new Button(); mybtn.Text = "下载"; mybtn.CssClass = "Btn"; mybtn.ID = "Btn_Download_" + athDesc.MyPK + "_" + this.WorkID; mybtn.Click += new EventHandler(btnUpload_Click); mybtn.CssClass = "bg"; if (athDB == null) { mybtn.Visible = false; } else { mybtn.Visible = true; } this.Pub1.Add(mybtn); } if (this.IsReadonly == false) { if (athDesc.IsDeleteInt != 0 && isDel == true) { bool isDeleteBtn = true; if (athDesc.IsDeleteInt == 2) { if (!athDB.Rec.Equals(WebUser.No)) { isDeleteBtn = false; } } if (isDeleteBtn) { mybtn = new Button(); mybtn.CssClass = "Btn"; mybtn.Text = "删除"; mybtn.Attributes["onclick"] = " return confirm('您确定要执行删除吗?');"; mybtn.ID = "Btn_Delete_" + athDesc.MyPK + "_" + this.WorkID; mybtn.Click += new EventHandler(btnUpload_Click); mybtn.CssClass = "bg"; if (athDB == null) { mybtn.Visible = false; } else { mybtn.Visible = true; } this.Pub1.Add(mybtn); } } if (athDesc.IsWoEnableWF) { mybtn = new Button(); mybtn.CssClass = "Btn"; mybtn.Text = "打开"; mybtn.ID = "Btn_Open_" + athDesc.MyPK + "_" + this.WorkID; mybtn.Click += new EventHandler(btnUpload_Click); mybtn.CssClass = "bg"; if (athDB == null) { mybtn.Visible = false; } else { mybtn.Visible = true; } this.Pub1.Add(mybtn); } } }
protected void btnUpload_Click(object sender, EventArgs e) { Button btn = sender as Button; string[] ids = btn.ID.Split('_'); //string athPK = ids[2] + "_" + ids[3] ; string doType = ids[1]; string athPK = btn.ID.Replace("Btn_" + doType + "_", ""); athPK = athPK.Substring(0, athPK.LastIndexOf('_')); string athDBPK = athPK + "_" + this.WorkID; FrmAttachment frmAth = new FrmAttachment(); frmAth.MyPK = athPK; frmAth.RetrieveFromDBSources(); string pkVal = this.WorkID.ToString(); switch (doType) { case "Delete": FrmAttachmentDB db = new FrmAttachmentDB(); db.MyPK = athDBPK; db.Delete(); try { Button btnDel = this.Pub1.GetButtonByID("Btn_Delete_" + athDBPK); btnDel.Visible = false; btnDel = this.Pub1.GetButtonByID("Btn_Download_" + athDBPK); btnDel.Visible = false; btnDel = this.Pub1.GetButtonByID("Btn_Open_" + athDBPK); btnDel.Visible = false; } catch { } Label lab1 = this.Pub1.GetLabelByID("Lab" + frmAth.MyPK); lab1.Text = ""; break; case "Upload": FileUpload fu = this.Pub1.FindControl(athPK) as FileUpload; if (fu.HasFile == false || fu.FileName.Length <= 2) { BP.Sys.PubClass.Alert("请选择上传的文件"); return; } //检查格式是否符合要求. if (frmAth.Exts == "" || frmAth.Exts == "*.*") { /*任何格式都可以上传.*/ } else { string fileExt = fu.FileName.Substring(fu.FileName.LastIndexOf('.') + 1); fileExt = fileExt.ToLower().Replace(".", ""); if (frmAth.Exts.ToLower().Contains(fileExt) == false) { BP.Sys.PubClass.Alert("您上传的文件格式不符合要求,要求格式为:" + frmAth.Exts); return; } } //处理保存路径. string saveTo = frmAth.SaveTo; if (saveTo.Contains("*") || saveTo.Contains("@")) { /*如果路径里有变量.*/ saveTo = saveTo.Replace("*", "@"); saveTo = BP.WF.Glo.DealExp(saveTo, null, null); } try { saveTo = Server.MapPath("~/" + saveTo); } catch { //saveTo = saveTo; } if (System.IO.Directory.Exists(saveTo) == false) { System.IO.Directory.CreateDirectory(saveTo); } saveTo = saveTo + "\\" + athDBPK + "." + fu.FileName.Substring(fu.FileName.LastIndexOf('.') + 1); fu.SaveAs(saveTo); FileInfo info = new FileInfo(saveTo); FrmAttachmentDB dbUpload = new FrmAttachmentDB(); dbUpload.MyPK = athDBPK; dbUpload.FK_FrmAttachment = athPK; dbUpload.RefPKVal = this.WorkID.ToString(); if (this.EnName == null) { dbUpload.FK_MapData = this.FK_MapData; } else { dbUpload.FK_MapData = this.EnName; } dbUpload.FileExts = info.Extension; dbUpload.FileFullName = saveTo; dbUpload.FileName = fu.FileName; dbUpload.FileSize = (float)info.Length; dbUpload.Rec = WebUser.No; dbUpload.RecName = WebUser.Name; dbUpload.RDT = BP.DA.DataType.CurrentDataTime; if (this.Request.QueryString["FK_Node"] != null) { dbUpload.NodeID = this.Request.QueryString["FK_Node"]; } dbUpload.Save(); Button myBtnDel = this.Pub1.GetButtonByID("Btn_Delete_" + athDBPK); if (myBtnDel != null) { myBtnDel.Visible = true; myBtnDel = this.Pub1.GetButtonByID("Btn_Download_" + athDBPK); myBtnDel.Visible = true; } Button myBtnOpen = this.Pub1.GetButtonByID("Btn_Open_" + athDBPK); if (myBtnOpen != null) { myBtnOpen.Visible = true; myBtnOpen = this.Pub1.GetButtonByID("Btn_Download_" + athDBPK); myBtnOpen.Visible = true; } Label lab = this.Pub1.GetLabelByID("Lab" + frmAth.MyPK); if (lab != null) { if (frmAth.IsWoEnableWF) { if (dbUpload.FileExts.ToUpper().Equals("CEB")) { lab.Text = "<a href=\"javascript:OpenOfiice('" + dbUpload.FK_FrmAttachment + "','" + this.WorkID + "','" + dbUpload.MyPK + "','" + this.FK_MapData + "','" + frmAth.NoOfObj + "','" + this.FK_Node + "')\"><img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/FileType/pdf.gif' border=0/>" + dbUpload.FileName + "</a>"; } else { lab.Text = "<a href=\"javascript:OpenOfiice('" + dbUpload.FK_FrmAttachment + "','" + this.WorkID + "','" + dbUpload.MyPK + "','" + this.FK_MapData + "','" + frmAth.NoOfObj + "','" + this.FK_Node + "')\"><img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/FileType/" + dbUpload.FileExts + ".gif' border=0/>" + dbUpload.FileName + "</a>"; } } else { if (dbUpload.FileExts.ToUpper().Equals("CEB")) { lab.Text = "<a href=\"javascript:OpenFileView('" + this.WorkID + "','" + dbUpload.MyPK + "')\"><img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/FileType/pdf.gif' border=0/>" + dbUpload.FileName + "</a>"; } else { lab.Text = "<img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/FileType/" + dbUpload.FileExts + ".gif' border=0/>" + dbUpload.FileName; } } //lab.Text = "<img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/FileType/" + dbUpload.FileExts + ".gif' alt='" + dbUpload.FileName + "' ID='" + frmAth.NoOfObj + "' border=0/>" + dbUpload.FileName; } return; case "Download": FrmAttachmentDB dbDown = new FrmAttachmentDB(); dbDown.MyPK = athDBPK; if (dbDown.RetrieveFromDBSources() == 0) { dbDown.Retrieve(FrmAttachmentDBAttr.FK_MapData, this.FK_MapData, FrmAttachmentDBAttr.RefPKVal, this.WorkID, FrmAttachmentDBAttr.FK_FrmAttachment, frmAth.FK_MapData + "_" + frmAth.NoOfObj); } string downPath = GetRealPath(dbDown.FileFullName); PubClass.DownloadFile(dbDown.FileFullName, dbDown.FileName); break; case "Open": var url = BP.WF.Glo.CCFlowAppPath + "WF/WebOffice/AttachOffice.aspx?DoType=EditOffice&DelPKVal=" + athDBPK + "&FK_FrmAttachment=" + frmAth.MyPK + "&PKVal=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&FK_MapData=" + frmAth.FK_MapData + "&NoOfObj=" + frmAth.NoOfObj; PubClass.WinOpen(url, "WebOffice编辑", 850, 600); break; default: break; } }
//多附件上传方法 public void MoreAttach() { string PKVal = this.GetRequestVal("PKVal"); string attachPk = this.GetRequestVal("AttachPK"); // 多附件描述. BP.Sys.FrmAttachment athDesc = new BP.Sys.FrmAttachment(attachPk); MapData mapData = new MapData(athDesc.FK_MapData); string msg = null; GEEntity en = new GEEntity(athDesc.FK_MapData); en.PKVal = PKVal; en.Retrieve(); for (int i = 0; i < context.Request.Files.Count; i++) { HttpPostedFile file = context.Request.Files[i]; #region 文件上传的iis服务器上 or db数据库里. if (athDesc.AthSaveWay == AthSaveWay.IISServer) { string savePath = athDesc.SaveTo; if (savePath.Contains("@") == true || savePath.Contains("*") == true) { /*如果有变量*/ savePath = savePath.Replace("*", "@"); savePath = BP.WF.Glo.DealExp(savePath, en, null); if (savePath.Contains("@") && this.FK_Node != 0) { /*如果包含 @ */ BP.WF.Flow flow = new BP.WF.Flow(this.FK_Flow); BP.WF.Data.GERpt myen = flow.HisGERpt; myen.OID = this.WorkID; myen.RetrieveFromDBSources(); savePath = BP.WF.Glo.DealExp(savePath, myen, null); } if (savePath.Contains("@") == true) { throw new Exception("@路径配置错误,变量没有被正确的替换下来." + savePath); } } else { savePath = athDesc.SaveTo + "\\" + PKVal; } //替换关键的字串. savePath = savePath.Replace("\\\\", "\\"); try { savePath = context.Server.MapPath("~/" + savePath); } catch (Exception) { } try { if (System.IO.Directory.Exists(savePath) == false) { System.IO.Directory.CreateDirectory(savePath); } } catch (Exception ex) { throw new Exception("@创建路径出现错误,可能是没有权限或者路径配置有问题:" + context.Server.MapPath("~/" + savePath) + "===" + savePath + "@技术问题:" + ex.Message); } string exts = System.IO.Path.GetExtension(file.FileName).ToLower().Replace(".", ""); string guid = BP.DA.DBAccess.GenerGUID(); string fileName = file.FileName.Substring(0, file.FileName.LastIndexOf('.')); if (fileName.LastIndexOf("\\") > 0) { fileName = fileName.Substring(fileName.LastIndexOf("\\") + 1); } string ext = System.IO.Path.GetExtension(file.FileName); string realSaveTo = savePath + "\\" + guid + "." + fileName + ext; realSaveTo = realSaveTo.Replace("~", "-"); realSaveTo = realSaveTo.Replace("'", "-"); realSaveTo = realSaveTo.Replace("*", "-"); file.SaveAs(realSaveTo); //执行附件上传前事件,added by liuxc,2017-7-15 msg = mapData.DoEvent(FrmEventList.AthUploadeBefore, en, "@FK_FrmAttachment=" + athDesc.MyPK + "@FileFullName=" + realSaveTo); if (!string.IsNullOrEmpty(msg)) { BP.Sys.Glo.WriteLineError("@AthUploadeBefore事件返回信息,文件:" + file.FileName + "," + msg); try { File.Delete(realSaveTo); } catch { } //note:此处如何向前uploadify传递失败信息,有待研究 //this.Alert("上传附件错误:" + msg, true); return; } FileInfo info = new FileInfo(realSaveTo); FrmAttachmentDB dbUpload = new FrmAttachmentDB(); dbUpload.MyPK = guid; // athDesc.FK_MapData + oid.ToString(); dbUpload.NodeID = this.FK_Node.ToString(); dbUpload.FK_FrmAttachment = attachPk; dbUpload.FK_MapData = athDesc.FK_MapData; dbUpload.FK_FrmAttachment = attachPk; dbUpload.FileExts = info.Extension; #region 处理文件路径,如果是保存到数据库,就存储pk. if (athDesc.AthSaveWay == AthSaveWay.IISServer) { //文件方式保存 dbUpload.FileFullName = realSaveTo; } if (athDesc.AthSaveWay == AthSaveWay.FTPServer) { //保存到数据库 dbUpload.FileFullName = dbUpload.MyPK; } #endregion 处理文件路径,如果是保存到数据库,就存储pk. dbUpload.FileName = fileName + ext; dbUpload.FileSize = (float)info.Length; dbUpload.RDT = DataType.CurrentDataTimess; dbUpload.Rec = BP.Web.WebUser.No; dbUpload.RecName = BP.Web.WebUser.Name; dbUpload.RefPKVal = PKVal; dbUpload.FID = this.FID; //if (athDesc.IsNote) // dbUpload.MyNote = this.Pub1.GetTextBoxByID("TB_Note").Text; //if (athDesc.Sort.Contains(",")) // dbUpload.Sort = this.Pub1.GetDDLByID("ddl").SelectedItemStringVal; dbUpload.UploadGUID = guid; dbUpload.Insert(); if (athDesc.AthSaveWay == AthSaveWay.DB) { //执行文件保存. BP.DA.DBAccess.SaveFileToDB(realSaveTo, dbUpload.EnMap.PhysicsTable, "MyPK", dbUpload.MyPK, "FDB"); } //执行附件上传后事件,added by liuxc,2017-7-15 msg = mapData.DoEvent(FrmEventList.AthUploadeAfter, en, "@FK_FrmAttachment=" + dbUpload.FK_FrmAttachment + "@FK_FrmAttachmentDB=" + dbUpload.MyPK + "@FileFullName=" + dbUpload.FileFullName); if (!string.IsNullOrEmpty(msg)) { BP.Sys.Glo.WriteLineError("@AthUploadeAfter事件返回信息,文件:" + dbUpload.FileName + "," + msg); } } #endregion 文件上传的iis服务器上 or db数据库里. #region 保存到数据库 / FTP服务器上. if (athDesc.AthSaveWay == AthSaveWay.DB || athDesc.AthSaveWay == AthSaveWay.FTPServer) { string guid = DBAccess.GenerGUID(); //把文件临时保存到一个位置. string temp = SystemConfig.PathOfTemp + "" + guid + ".tmp"; try { file.SaveAs(temp); } catch (Exception ex) { System.IO.File.Delete(temp); file.SaveAs(temp); } // fu.SaveAs(temp); //执行附件上传前事件,added by liuxc,2017-7-15 msg = mapData.DoEvent(FrmEventList.AthUploadeBefore, en, "@FK_FrmAttachment=" + athDesc.MyPK + "@FileFullName=" + temp); if (string.IsNullOrEmpty(msg) == false) { BP.Sys.Glo.WriteLineError("@AthUploadeBefore事件返回信息,文件:" + file.FileName + "," + msg); try { File.Delete(temp); } catch { } throw new Exception("err@上传附件错误:" + msg); } FileInfo info = new FileInfo(temp); FrmAttachmentDB dbUpload = new FrmAttachmentDB(); dbUpload.MyPK = BP.DA.DBAccess.GenerGUID(); dbUpload.NodeID = FK_Node.ToString(); dbUpload.FK_FrmAttachment = athDesc.MyPK; dbUpload.FID = this.FID; //流程id. if (athDesc.AthUploadWay == AthUploadWay.Inherit) { /*如果是继承,就让他保持本地的PK. */ dbUpload.RefPKVal = PKVal.ToString(); } if (athDesc.AthUploadWay == AthUploadWay.Interwork) { /*如果是协同,就让他是PWorkID. */ Paras ps = new Paras(); ps.SQL = "SELECT PWorkID FROM WF_GenerWorkFlow WHERE WorkID=" + SystemConfig.AppCenterDBVarStr + "WorkID"; ps.Add("WorkID", PKVal); string pWorkID = BP.DA.DBAccess.RunSQLReturnValInt(ps, 0).ToString(); if (pWorkID == null || pWorkID == "0") { pWorkID = PKVal; } dbUpload.RefPKVal = pWorkID; } dbUpload.FK_MapData = athDesc.FK_MapData; dbUpload.FK_FrmAttachment = athDesc.MyPK; dbUpload.FileName = file.FileName; dbUpload.FileSize = (float)info.Length; dbUpload.RDT = DataType.CurrentDataTimess; dbUpload.Rec = BP.Web.WebUser.No; dbUpload.RecName = BP.Web.WebUser.Name; //if (athDesc.IsNote) // dbUpload.MyNote = this.Pub1.GetTextBoxByID("TB_Note").Text; //if (athDesc.Sort.Contains(",")) //{ // string[] strs = athDesc.Sort.Contains("@") == true ? athDesc.Sort.Substring(athDesc.Sort.LastIndexOf("@") + 1).Split(',') : athDesc.Sort.Split(','); // BP.Web.Controls.DDL ddl = this.Pub1.GetDDLByID("ddl"); // dbUpload.Sort = strs[0]; // if (ddl != null) // { // int selectedIndex = string.IsNullOrEmpty(ddl.SelectedItemStringVal) ? 0 : int.Parse(ddl.SelectedItemStringVal); // dbUpload.Sort = strs[selectedIndex]; // } //} dbUpload.UploadGUID = guid; if (athDesc.AthSaveWay == AthSaveWay.DB) { dbUpload.Insert(); //把文件保存到指定的字段里. dbUpload.SaveFileToDB("FileDB", temp); } if (athDesc.AthSaveWay == AthSaveWay.FTPServer) { /*保存到fpt服务器上.*/ FtpSupport.FtpConnection ftpconn = new FtpSupport.FtpConnection(SystemConfig.FTPServerIP, SystemConfig.FTPUserNo, SystemConfig.FTPUserPassword); string ny = DateTime.Now.ToString("yyyy_MM"); //判断目录年月是否存在. if (ftpconn.DirectoryExist(ny) == false) { ftpconn.CreateDirectory(ny); } ftpconn.SetCurrentDirectory(ny); //判断目录是否存在. if (ftpconn.DirectoryExist(athDesc.FK_MapData) == false) { ftpconn.CreateDirectory(athDesc.FK_MapData); } //设置当前目录,为操作的目录。 ftpconn.SetCurrentDirectory(athDesc.FK_MapData); //把文件放上去. ftpconn.PutFile(temp, guid + "." + dbUpload.FileExts); ftpconn.Close(); //设置路径. dbUpload.FileFullName = ny + "//" + athDesc.FK_MapData + "//" + guid + "." + dbUpload.FileExts; dbUpload.Insert(); } //执行附件上传后事件,added by liuxc,2017-7-15 msg = mapData.DoEvent(FrmEventList.AthUploadeAfter, en, "@FK_FrmAttachment=" + dbUpload.FK_FrmAttachment + "@FK_FrmAttachmentDB=" + dbUpload.MyPK + "@FileFullName=" + temp); if (!string.IsNullOrEmpty(msg)) { BP.Sys.Glo.WriteLineError("@AthUploadeAfter事件返回信息,文件:" + dbUpload.FileName + "," + msg); } } #endregion 保存到数据库. } }
protected void Btn_Start_Click(object sender, EventArgs e) { People en = new People(); en.No = this.TB_SFZ.Text; if (en.RetrieveFromDBSources() == 0) { this.Response.Write("证件号码错误....."); return; } //获得该节点需要的证照信息,并把证照写入到附件表里. Node nd = new Node(int.Parse(this.FK_Flow + "01")); Work wk = nd.HisWork; //获得附件描述. FrmAttachment ath = new FrmAttachment("ND" + nd.NodeID + "_AttachM1"); string[] sort = ath.Sort.Split(','); //获得附件类型. if (sort.Length == 1) { throw new Exception("@该流程不需要上传证照信息."); } //删除原来的数据,如果有。 FrmAttachmentDBs dbs = new FrmAttachmentDBs(); dbs.Delete(FrmAttachmentDBAttr.RefPKVal, this.WorkID); //求出证件库下的证照集合. Licenses lis = new Licenses(this.SFZ); //开始象流程的开始节点写附件数据. foreach (string str in sort) { foreach (License li in lis) { if (li.Name != str) { continue; //不是continue. } FrmAttachmentDB db = new FrmAttachmentDB(); db.MyPK = BP.DA.DBAccess.GenerGUID(); db.UploadGUID = li.MyPK; db.Rec = BP.Web.WebUser.No; db.RecName = BP.Web.WebUser.Name; db.RDT = BP.DA.DataType.CurrentDataTime; db.MyNote = "从证照库导入"; db.FID = 0; db.RefPKVal = this.WorkID.ToString(); db.FK_FrmAttachment = "ND" + nd.NodeID + "_AttachM1"; db.FK_MapData = "ND" + nd.NodeID; db.FileFullName = li.FilePath; db.FileName = str; db.FileExts = li.Ext; db.FileSize = li.FileSize; db.Sort = str; db.Insert(); } } //生成Url把其他的参数带入里面去. string url = "/WF/MyFlow.aspx?FK_Flow=" + this.FK_Flow + "&IsCheckGuide=1&DiZhi=" + en.Addr + "&SFZH=" + en.No + "&DianHua=" + en.Tel + "&XingBie=" + en.XB + "&YouJian=" + en.Email + "&XingMing=" + en.Name; this.Response.Redirect(url, true); }
/// <summary> /// 保存文件,在这里做修改就可以了. /// </summary> public void SaveFile() { BP.Sys.FrmAttachment athDesc = new BP.Sys.FrmAttachment(this.FK_FrmAttachment); System.Web.UI.WebControls.FileUpload fu = null; //this.Pub1.FindControl("file")as System.Web.UI.WebControls.FileUpload; if (fu.HasFile == false || fu.FileName.Length <= 2) { this.Alert("请选择上传的文件."); return; } string exts = System.IO.Path.GetExtension(fu.FileName).ToLower().Replace(".", ""); //如果有上传类型限制,进行判断格式 if (athDesc.Exts == "*.*" || athDesc.Exts == "") { /*任何格式都可以上传*/ } else { if (athDesc.Exts.ToLower().Contains(exts) == false) { this.Alert("您上传的文件,不符合系统的格式要求,要求的文件格式:" + athDesc.Exts + ",您现在上传的文件格式为:" + exts); return; } } string savePath = athDesc.SaveTo; if (savePath.Contains("@") == true || savePath.Contains("*") == true) { /*如果有变量*/ savePath = savePath.Replace("*", "@"); GEEntity en = new GEEntity(athDesc.FK_MapData); en.PKVal = this.PKVal; en.Retrieve(); savePath = BP.WF.Glo.DealExp(savePath, en, null); if (savePath.Contains("@") && this.FK_Node != null) { /*如果包含 @ */ BP.WF.Flow flow = new BP.WF.Flow(this.FK_Flow); BP.WF.Data.GERpt myen = flow.HisGERpt; myen.OID = this.WorkID; myen.RetrieveFromDBSources(); savePath = BP.WF.Glo.DealExp(savePath, myen, null); } if (savePath.Contains("@") == true) throw new Exception("@路径配置错误,变量没有被正确的替换下来." + savePath); } else { //savePath = athDesc.SaveTo + "\\" + this.PKVal; } //替换关键的字串. savePath = savePath.Replace("\\\\", "\\"); savePath = Server.MapPath("~/" + savePath); try { if (System.IO.Directory.Exists(savePath) == false) System.IO.Directory.CreateDirectory(savePath); } catch (Exception ex) { throw new Exception("@创建路径出现错误,可能是没有权限或者路径配置有问题:" + Server.MapPath("~/" + savePath) + "===" + savePath + "@技术问题:" + ex.Message); } string guid = BP.DA.DBAccess.GenerGUID(); string fileName = fu.FileName.Substring(0, fu.FileName.LastIndexOf('.')); string ext = System.IO.Path.GetExtension(fu.FileName); //string realSaveTo = Server.MapPath("~/" + savePath) + "/" + guid + "." + fileName + "." + ext; //string realSaveTo = Server.MapPath("~/" + savePath) + "\\" + guid + "." + fu.FileName.Substring(fu.FileName.LastIndexOf('.') + 1); //string saveTo = savePath + "/" + guid + "." + fileName + "." + ext; string realSaveTo = savePath + "/" + guid + "." + fileName + ext; string saveTo = realSaveTo; try { fu.SaveAs(realSaveTo); } catch (Exception ex) { this.Response.Write("@文件存储失败,有可能是路径的表达式出问题,导致是非法的路径名称:" + ex.Message); return; } FileInfo info = new FileInfo(realSaveTo); FrmAttachmentDB dbUpload = new FrmAttachmentDB(); dbUpload.MyPK = guid; // athDesc.FK_MapData + oid.ToString(); dbUpload.NodeID = FK_Node.ToString(); dbUpload.FK_FrmAttachment = this.FK_FrmAttachment; if (athDesc.AthUploadWay == AthUploadWay.Inherit) { /*如果是继承,就让他保持本地的PK. */ dbUpload.RefPKVal = this.PKVal.ToString(); } if (athDesc.AthUploadWay == AthUploadWay.Interwork) { /*如果是协同,就让他是PWorkID. */ string pWorkID = BP.DA.DBAccess.RunSQLReturnValInt("SELECT PWorkID FROM WF_GenerWorkFlow WHERE WorkID=" + this.PKVal, 0).ToString(); if (pWorkID == null || pWorkID == "0") pWorkID = this.PKVal; dbUpload.RefPKVal = pWorkID; } dbUpload.FK_MapData = athDesc.FK_MapData; dbUpload.FK_FrmAttachment = this.FK_FrmAttachment; dbUpload.FileExts = info.Extension; dbUpload.FileFullName = saveTo; dbUpload.FileName = fu.FileName; dbUpload.FileSize = (float)info.Length; dbUpload.RDT = DataType.CurrentDataTimess; dbUpload.Rec = BP.Web.WebUser.No; dbUpload.RecName = BP.Web.WebUser.Name; //if (athDesc.IsNote) // dbUpload.MyNote = this.Pub1.GetTextBoxByID("TB_Note").Text; //if (athDesc.Sort.Contains(",")) // dbUpload.Sort = this.Pub1.GetDDLByID("ddl").SelectedItemStringVal; dbUpload.UploadGUID = guid; dbUpload.Insert(); }
protected void Page_Load(object sender, EventArgs e) { this.Response.ContentEncoding = System.Text.UTF8Encoding.UTF8; this.Request.ContentEncoding = System.Text.UTF8Encoding.UTF8; #region 功能执行. if (this.DoType == "Del") { FrmAttachmentDB delDB = new FrmAttachmentDB(); delDB.MyPK = this.DelPKVal == null ? this.MyPK : this.DelPKVal; delDB.DirectDelete(); } if (this.DoType == "Down") { FrmAttachmentDB downDB = new FrmAttachmentDB(); downDB.MyPK = this.DelPKVal == null ? this.MyPK : this.DelPKVal; downDB.Retrieve(); string downpath = GetRealPath(downDB.FileFullName); BP.Sys.PubClass.DownloadFile(downpath, downDB.FileName); this.WinClose(); return; } if (this.DoType == "WinOpen") { FrmAttachmentDB downDB = new FrmAttachmentDB(); downDB.MyPK = this.MyPK; downDB.Retrieve(); Response.ContentType = "Application/pdf"; string downpath = GetRealPath(downDB.FileFullName); Response.WriteFile(downpath); Response.End(); return; } #endregion 功能执行. #region 处理权限控制. BP.Sys.FrmAttachment athDesc = new BP.Sys.FrmAttachment(); athDesc.MyPK = this.FK_FrmAttachment; if (this.FK_Node == null || this.FK_Flow == null) { athDesc.RetrieveFromDBSources(); } else { #region 判断是否可以查询出来,如果查询不出来,就可能是公文流程。 athDesc.MyPK = this.FK_FrmAttachment; if (athDesc.RetrieveFromDBSources() == 0 && string.IsNullOrEmpty(this.FK_Flow) == false) { /*如果没有查询到它,就有可能是公文多附件被删除了.*/ athDesc.MyPK = this.FK_FrmAttachment; athDesc.NoOfObj = "DocMultiAth"; athDesc.FK_MapData = this.FK_MapData; athDesc.Exts = "*.*"; //存储路径. athDesc.SaveTo = "/DataUser/UploadFile/"; athDesc.IsNote = false; //不显示note字段. athDesc.IsVisable = false; // 让其在form 上不可见. //位置. athDesc.X = (float)94.09; athDesc.Y = (float)333.18; athDesc.W = (float)626.36; athDesc.H = (float)150; //多附件. athDesc.UploadType = AttachmentUploadType.Multi; athDesc.Name = "公文多附件(系统自动增加)"; athDesc.SetValByKey("AtPara", "@IsWoEnablePageset=1@IsWoEnablePrint=1@IsWoEnableViewModel=1@IsWoEnableReadonly=0@IsWoEnableSave=1@IsWoEnableWF=1@IsWoEnableProperty=1@IsWoEnableRevise=1@IsWoEnableIntoKeepMarkModel=1@FastKeyIsEnable=0@IsWoEnableViewKeepMark=1@FastKeyGenerRole=@IsWoEnableTemplete=1"); athDesc.Insert(); //有可能在其其它的节点上没有这个附件,所以也要循环增加上它. BP.WF.Nodes nds = new BP.WF.Nodes(this.FK_Flow); foreach (BP.WF.Node nd in nds) { athDesc.FK_MapData = "ND" + nd.NodeID; athDesc.MyPK = athDesc.FK_MapData + "_" + athDesc.NoOfObj; if (athDesc.IsExits == true) { continue; } athDesc.Insert(); } //重新查询一次,把默认值加上. athDesc.RetrieveFromDBSources(); } #endregion 判断是否可以查询出来,如果查询不出来,就可能是公文流程。 #region 处理权限方案。 /*首先判断是否具有权限方案*/ string at = BP.Sys.SystemConfig.AppCenterDBVarStr; Paras ps = new BP.DA.Paras(); ps.SQL = "SELECT FrmSln FROM WF_FrmNode WHERE FK_Node=" + at + "FK_Node AND FK_Flow=" + at + "FK_Flow AND FK_Frm=" + at + "FK_Frm"; ps.Add("FK_Node", this.FK_Node); ps.Add("FK_Flow", this.FK_Flow); ps.Add("FK_Frm", this.FK_MapData); DataTable dt = DBAccess.RunSQLReturnTable(ps); if (dt.Rows.Count == 0) { athDesc.RetrieveFromDBSources(); } else { int sln = int.Parse(dt.Rows[0][0].ToString()); if (sln == 0) { athDesc.RetrieveFromDBSources(); } else { int result = athDesc.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData, FrmAttachmentAttr.FK_Node, this.FK_Node, FrmAttachmentAttr.NoOfObj, this.Ath); if (result == 0) /*如果没有定义,就获取默认的.*/ { athDesc.RetrieveFromDBSources(); } // throw new Exception("@该流程表单在该节点("+this.FK_Node+")使用的是自定义的权限控制,但是没有定义该附件的权限。"); } } #endregion 处理权限方案。 } BP.Sys.FrmAttachmentDBs dbs = new BP.Sys.FrmAttachmentDBs(); if (athDesc.HisCtrlWay == AthCtrlWay.PWorkID) { string pWorkID = BP.DA.DBAccess.RunSQLReturnValInt("SELECT PWorkID FROM WF_GenerWorkFlow WHERE WorkID=" + this.PKVal, 0).ToString(); if (pWorkID == null || pWorkID == "0") { pWorkID = this.PKVal; } if (athDesc.AthUploadWay == AthUploadWay.Inherit) { /* 继承模式 */ BP.En.QueryObject qo = new BP.En.QueryObject(dbs); qo.AddWhere(FrmAttachmentDBAttr.RefPKVal, pWorkID); qo.addOr(); qo.AddWhere(FrmAttachmentDBAttr.RefPKVal, int.Parse(this.PKVal)); qo.addOrderBy("RDT"); qo.DoQuery(); } if (athDesc.AthUploadWay == AthUploadWay.Interwork) { /*共享模式*/ dbs.Retrieve(FrmAttachmentDBAttr.RefPKVal, pWorkID); } } else { int num = dbs.Retrieve(FrmAttachmentDBAttr.FK_FrmAttachment, this.FK_FrmAttachment, FrmAttachmentDBAttr.RefPKVal, this.PKVal, "RDT"); if (num == 0 && this.IsCC == "1") { CCList cc = new CCList(); int nnn = cc.Retrieve(CCListAttr.FK_Node, this.FK_Node, CCListAttr.WorkID, this.WorkID, CCListAttr.CCTo, WebUser.No); if (cc.NDFrom != 0) { this._fk_node = cc.NDFrom; dbs.Retrieve(FrmAttachmentDBAttr.FK_FrmAttachment, this.FK_FrmAttachmentExt, FrmAttachmentDBAttr.FK_MapData, "ND" + cc.NDFrom, FrmAttachmentDBAttr.RefPKVal, this.WorkID.ToString()); //重新设置文件描述。 athDesc.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData, FrmAttachmentAttr.NoOfObj, "DocMultiAth"); } } } #endregion 处理权限控制. #region 生成表头表体. this.Title = athDesc.Name; #region 如果图片显示. if (athDesc.FileShowWay == FileShowWay.Pict) { /* 如果是图片轮播,就在这里根据数据输出轮播的html代码.*/ if (dbs.Count == 0 && athDesc.IsUpload == true) { /*没有数据并且,可以上传,就转到上传的界面上去.*/ this.Response.Redirect("AttachmentUploadImg.aspx?1=1" + this.RequestParas, true); return; } if (dbs.Count != 0) { /*有数据,就输出.*/ this.Pub1.Add("<div class='slideBox' id='" + athDesc.MyPK + "' style='width:" + athDesc.W + "px;height:" + athDesc.H + "px; position:relative; overflow:hidden;'>"); this.Pub1.Add("<ul class='items'> "); foreach (FrmAttachmentDB db in dbs) { if (BP.DA.DataType.IsImgExt(db.FileExts) == false) { continue; } if (athDesc.IsDelete != false) { if (athDesc.IsDelete == true) { this.Pub1.Add("<li> <a title='" + db.MyNote + "'><img src = '" + db.FileFullName + "' width=" + athDesc.W + " height=" + athDesc.H + "/></a> | <a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a></li>"); } else if (athDesc.IsDeleteInt == 2) { if (db.Rec.Equals(WebUser.No)) { this.Pub1.Add("<li> <a title='" + db.MyNote + "'><img src = '" + db.FileFullName + "' width=" + athDesc.W + " height=" + athDesc.H + "/></a> | <a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a></li>"); } } else { this.Pub1.Add("<li> <a title='" + db.MyNote + "'><img src = '" + db.FileFullName + "' width=" + athDesc.W + " height=" + athDesc.H + "/></a> </li>"); } } else { this.Pub1.Add("<li> <a title='" + db.MyNote + "'><img src = '" + db.FileFullName + "' width=" + athDesc.W + " height=" + athDesc.H + "/></a> </li>"); } } this.Pub1.Add("</ul>"); this.Pub1.Add("</div>"); this.Pub1.Add("<script>$(function(){$('#" + athDesc.MyPK + "').slideBox({duration : 0.3,easing : 'linear',delay : 5,hideClickBar : false,clickBarRadius : 10});})</script>"); } if (athDesc.IsUpload == true) { /*可以上传,就显示上传的按钮.. */ this.Pub1.Add("<a href='AttachmentUploadImg.aspx?1=1" + this.RequestParas + "' >上传</a>"); } return; } #endregion 如果图片显示. float athWidth = athDesc.W - 20; // 执行装载模版. if (dbs.Count == 0 && athDesc.IsWoEnableTemplete == true) { /*如果数量为0,就检查一下是否有模版如果有就加载模版文件.*/ string templetePath = BP.Sys.SystemConfig.PathOfDataUser + "AthTemplete\\" + athDesc.NoOfObj.Trim(); if (Directory.Exists(templetePath) == false) { Directory.CreateDirectory(templetePath); } /*有模版文件夹*/ DirectoryInfo mydir = new DirectoryInfo(templetePath); FileInfo[] fls = mydir.GetFiles(); if (fls.Length == 0) { throw new Exception("@流程设计错误,该多附件启用了模版组件,模版目录:" + templetePath + "里没有模版文件."); } foreach (FileInfo fl in fls) { if (System.IO.Directory.Exists(athDesc.SaveTo) == false) { System.IO.Directory.CreateDirectory(athDesc.SaveTo); } int oid = BP.DA.DBAccess.GenerOID(); string saveTo = athDesc.SaveTo + "\\" + oid + "." + fl.Name.Substring(fl.Name.LastIndexOf('.') + 1); if (saveTo.Contains("@") == true || saveTo.Contains("*") == true) { /*如果有变量*/ saveTo = saveTo.Replace("*", "@"); if (saveTo.Contains("@") && this.FK_Node != null) { /*如果包含 @ */ BP.WF.Flow flow = new BP.WF.Flow(this.FK_Flow); BP.WF.Data.GERpt myen = flow.HisGERpt; myen.OID = this.WorkID; myen.RetrieveFromDBSources(); saveTo = BP.WF.Glo.DealExp(saveTo, myen, null); } if (saveTo.Contains("@") == true) { throw new Exception("@路径配置错误,变量没有被正确的替换下来." + saveTo); } } fl.CopyTo(saveTo); FileInfo info = new FileInfo(saveTo); FrmAttachmentDB dbUpload = new FrmAttachmentDB(); dbUpload.CheckPhysicsTable(); dbUpload.MyPK = athDesc.FK_MapData + oid.ToString(); dbUpload.NodeID = FK_Node.ToString(); dbUpload.FK_FrmAttachment = this.FK_FrmAttachment; if (athDesc.AthUploadWay == AthUploadWay.Inherit) { /*如果是继承,就让他保持本地的PK. */ dbUpload.RefPKVal = this.PKVal.ToString(); } if (athDesc.AthUploadWay == AthUploadWay.Interwork) { /*如果是协同,就让他是PWorkID. */ string pWorkID = BP.DA.DBAccess.RunSQLReturnValInt("SELECT PWorkID FROM WF_GenerWorkFlow WHERE WorkID=" + this.PKVal, 0).ToString(); if (pWorkID == null || pWorkID == "0") { pWorkID = this.PKVal; } dbUpload.RefPKVal = pWorkID; } dbUpload.FK_MapData = athDesc.FK_MapData; dbUpload.FK_FrmAttachment = this.FK_FrmAttachment; dbUpload.FileExts = info.Extension; dbUpload.FileFullName = saveTo; dbUpload.FileName = fl.Name; dbUpload.FileSize = (float)info.Length; dbUpload.RDT = DataType.CurrentDataTime; dbUpload.Rec = BP.Web.WebUser.No; dbUpload.RecName = BP.Web.WebUser.Name; //if (athDesc.IsNote) // dbUpload.MyNote = this.Pub1.GetTextBoxByID("TB_Note").Text; //if (athDesc.Sort.Contains(",")) // dbUpload.Sort = this.Pub1.GetDDLByID("ddl").SelectedItemStringVal; dbUpload.Insert(); dbs.AddEntity(dbUpload); } //BP.Sys.FrmAttachmentDBs dbs = new BP.Sys.FrmAttachmentDBs(); } #region 处理权限问题. // 处理权限问题, 有可能当前节点是可以上传或者删除,但是当前节点上不能让此人执行工作。 bool isDel = athDesc.IsDeleteInt == 0 ? false : true; bool isUpdate = athDesc.IsUpload; if (isDel == true || isUpdate == true) { if (this.WorkID != 0 && string.IsNullOrEmpty(this.FK_Flow) == false && this.FK_Node != 0) { isDel = BP.WF.Dev2Interface.Flow_IsCanDoCurrentWork(this.FK_Flow, this.FK_Node, this.WorkID, WebUser.No); if (isDel == false) { isUpdate = false; } } } #endregion 处理权限问题. if (athDesc.FileShowWay == FileShowWay.Free) { this.Pub1.AddTable("border='0' cellspacing='0' cellpadding='0' style='width:" + athWidth + "px'"); foreach (FrmAttachmentDB db in dbs) { this.Pub1.AddTR(); if (CanEditor(db.FileExts)) { if (athDesc.IsWoEnableWF) { this.Pub1.AddTD("<a href=\"javascript:OpenOfiice('" + this.FK_FrmAttachment + "','" + this.WorkID + "','" + db.MyPK + "','" + this.FK_MapData + "','" + this.Ath + "','" + this.FK_Node + "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>"); } else { this.Pub1.AddTD("<a href=\"javascript:OpenView('" + this.PKVal + "','" + db.MyPK + "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>"); } } else if (DataType.IsImgExt(db.FileExts) || db.FileExts.ToUpper() == "PDF" || db.FileExts.ToUpper() == "CEB") { this.Pub1.AddTD("<a href=\"javascript:OpenView('" + this.PKVal + "','" + db.MyPK + "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>"); } else { this.Pub1.AddTD("<a href='AttachmentUpload.aspx?DoType=Down&MyPK=" + db.MyPK + "' target=_blank ><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>"); } if (athDesc.IsDownload) { this.Pub1.AddTD("<a href=\"javascript:Down('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">下载</a>"); } else { this.Pub1.AddTD(""); } if (this.IsReadonly != "1") { if (athDesc.IsDelete != false) { if (athDesc.IsDelete == true) { this.Pub1.AddTD("style='border:0px'", "<a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a>"); } else if (athDesc.IsDeleteInt == 2) { if (db.Rec.Equals(WebUser.No)) { this.Pub1.AddTD("style='border:0px'", "<a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a>"); } } else { this.Pub1.AddTD(""); } } else { this.Pub1.AddTD(""); } } else { this.Pub1.AddTD(""); this.Pub1.AddTD(""); } this.Pub1.AddTREnd(); } AddFileUpload(isUpdate, athDesc); this.Pub1.AddTableEnd(); return; } this.Pub1.AddTable("border='0' cellspacing='0' cellpadding='0' style='width:" + athWidth + "px'"); if (athDesc.IsShowTitle == true) { this.Pub1.AddTR("style='border:0px'"); this.Pub1.AddTDTitleExt("序号"); if (athDesc.Sort.Contains(",")) { this.Pub1.AddTD("style='background:#f4f4f4; font-size:12px; padding:3px;'", "类别"); } this.Pub1.AddTDTitleExt("文件名"); this.Pub1.AddTDTitleExt("大小KB"); this.Pub1.AddTDTitleExt("上传时间"); this.Pub1.AddTDTitleExt("上传人"); this.Pub1.AddTDTitleExt("操作"); this.Pub1.AddTREnd(); } int i = 0; StringBuilder picHtml = new StringBuilder(); foreach (FrmAttachmentDB db in dbs) { i++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(i); if (athDesc.Sort.Contains(",")) { this.Pub1.AddTD(db.Sort); } // this.Pub1.AddTDIdx(i++); if (athDesc.IsDownload) { if (athDesc.IsWoEnableWF && CanEditor(db.FileExts)) { this.Pub1.AddTD("<a href=\"javascript:OpenOfiice('" + this.FK_FrmAttachment + "','" + this.WorkID + "','" + db.MyPK + "','" + this.FK_MapData + "','" + this.Ath + "','" + this.FK_Node + "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>"); } else if (db.FileExts.ToUpper() == "TXT" || db.FileExts.ToUpper() == "JPG" || db.FileExts.ToUpper() == "JPEG" || db.FileExts.ToUpper() == "GIF" || db.FileExts.ToUpper() == "PNG" || db.FileExts.ToUpper() == "BMP" || db.FileExts.ToUpper() == "PDF" || db.FileExts.ToUpper() == "CEB") { this.Pub1.AddTD("<a href=\"javascript:OpenView('" + this.PKVal + "','" + db.MyPK + "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>"); } else { this.Pub1.AddTD("<a href='AttachmentUpload.aspx?DoType=Down&MyPK=" + db.MyPK + "' target=_blank ><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>"); } } else { this.Pub1.AddTD("<img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName); } this.Pub1.AddTD(db.FileSize); this.Pub1.AddTD(db.RDT); this.Pub1.AddTD(db.RecName); //输出操作部分. this.Pub1.AddTDBegin(); if (athDesc.IsDownload) { this.Pub1.Add("<a href=\"javascript:Down('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">下载</a>"); } if (this.IsReadonly != "1") { string op = null; if (isDel == true) { if (athDesc.IsDelete == true) { op = " <a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a>"; } else if (athDesc.IsDeleteInt == 2) { if (db.Rec.Equals(WebUser.No)) { op = " <a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a>"; } } } this.Pub1.Add(op); } this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); } if (i == 0) { this.Pub1.AddTR(); this.Pub1.AddTD("0"); if (athDesc.Sort.Contains(",")) { this.Pub1.AddTD("  "); } this.Pub1.AddTD("style='width:100px'", "<span style='color:red;' >上传附件</span>"); this.Pub1.AddTD("  "); this.Pub1.AddTD("  "); this.Pub1.AddTD("  "); this.Pub1.AddTD("  "); this.Pub1.AddTREnd(); } AddFileUpload(isUpdate, athDesc); this.Pub1.AddTableEnd(); #endregion 生成表头表体. }
protected void Page_Load(object sender, EventArgs e) { FrmAttachmentDB downDB = new FrmAttachmentDB(); if (DoType.Equals("view") || DoType.Equals("ViewPic")) { if (!string.IsNullOrEmpty(DelPKVal)) { downDB.MyPK = this.DelPKVal; downDB.Retrieve(); string filePath = ""; if (DoType.Equals("view")) { if (DataType.IsImgExt(downDB.FileExts)) { RenderPic(null); return; } } try { filePath = Server.MapPath("~/" + downDB.FileFullName); } catch (Exception ex) { filePath = downDB.FileFullName; } if (downDB.FileExts.ToUpper().Equals("CEB")) { //判断是绝对路径还是相对路径 string fileSave = Server.MapPath("~/DataUser/UploadFile/" + downDB.MyPK + "." + downDB.FileName); if (!System.IO.File.Exists(fileSave)) { byte[] fileBytes = File.ReadAllBytes(filePath); File.WriteAllBytes(fileSave, fileBytes); } this.Response.Redirect("/DataUser/UploadFile/" + downDB.MyPK + "." + downDB.FileName, true); } if (File.Exists(filePath)) { byte[] result; try { result = File.ReadAllBytes(filePath); } catch { result = File.ReadAllBytes(downDB.FileFullName); } Response.Clear(); if (downDB.FileExts == "pdf") { Response.ContentType = "Application/pdf"; } Response.BinaryWrite(result); Response.End(); } else { this.Alert("没有找到文件。"); this.WinClose(); } } } else { RenderPic(DoType); } }
private void InitOffice(bool isMenu) { bool isCompleate = false; BP.WF.Node node = new BP.WF.Node(); node.NodeID = int.Parse(this.FK_Node); node.RetrieveFromDBSources(); try { WorkFlow workFlow = new WorkFlow(node.FK_Flow, Int64.Parse(PKVal)); isCompleate = workFlow.IsComplete; } catch (Exception) { try { Flow fl = new Flow(node.FK_Flow); GERpt rpt = fl.HisGERpt; rpt.OID = Int64.Parse(PKVal); rpt.Retrieve(); if (rpt != null) { if (rpt.WFState == WFState.Complete) { isCompleate = true; } } } catch { } } if (!isCompleate) { try { isCompleate = !BP.WF.Dev2Interface.Flow_IsCanDoCurrentWork(node.FK_Flow, node.NodeID, Int64.Parse(PKVal), WebUser.No); //WorkFlow workFlow = new WorkFlow(node.FK_Flow, Int64.Parse(PKVal)); //isCompleate = !workFlow.IsCanDoCurrentWork(WebUser.No); } catch { } } FrmAttachment attachment = new FrmAttachment(); int result = 0; //表单编号与节点不为空 if (this.FK_MapData != null && this.FK_Node != null) { BP.En.QueryObject objInfo = new BP.En.QueryObject(attachment); objInfo.AddWhere(FrmAttachmentAttr.FK_MapData, this.FK_MapData); objInfo.addAnd(); objInfo.AddWhere(FrmAttachmentAttr.FK_Node, this.FK_Node); objInfo.addAnd(); objInfo.AddWhere(FrmAttachmentAttr.NoOfObj, this.NoOfObj); result = objInfo.DoQuery(); //result = attachment.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData, // FrmAttachmentAttr.FK_Node, this.FK_Node, FrmAttachmentAttr.NoOfObj, this.DelPKVal); } if (result == 0) /*如果没有定义,就获取默认的.*/ { attachment.MyPK = this.FK_FrmAttachment; attachment.Retrieve(); } if (!isCompleate) { if (attachment.IsWoEnableReadonly) { ReadOnly = true; } if (attachment.IsWoEnableCheck) { IsCheck = true; } IsMarks = attachment.IsWoEnableMarks; } else { if (attachment.IsWoEnableReadonly) { ReadOnly = true; } } if (isMenu && !isCompleate) { #region 初始化按钮 if (attachment.IsWoEnableViewKeepMark) { divMenu.InnerHtml = "<select id='marks' onchange='ShowUserName()' style='width: 100px'><option value='1'>显示留痕</option><option value='2'>隐藏留痕</option><select>"; } if (attachment.IsWoEnableTemplete) { AddBtn("openTempLate", "打开模板", "OpenTempLate"); } if (attachment.IsWoEnableSave) { AddBtn("saveFile", "保存", "saveOffice"); } if (attachment.IsWoEnableRevise) { AddBtn("accept", "接受修订", "acceptOffice"); AddBtn("refuse", "拒绝修订", "refuseOffice"); } if (attachment.IsWoEnableOver) { AddBtn("over", "套红文件", "overOffice"); } if (attachment.IsWoEnableSeal) { AddBtn("seal", "签章", "sealOffice"); } if (attachment.IsWoEnableInsertFlow) { AddBtn("flow", "插入流程图", "InsertFlow"); } if (attachment.IsWoEnableInsertFlow) { AddBtn("fegnxian", "插入风险点", "InsertFengXian"); } #endregion } #region 初始化文件 FrmAttachmentDB downDB = new FrmAttachmentDB(); downDB.MyPK = this.DelPKVal; downDB.Retrieve(); fileName.Text = downDB.FileName; fileType.Text = downDB.FileExts; RealFileName = downDB.FileName; FileFullName = downDB.FileFullName; FileSavePath = attachment.SaveTo; #endregion }
protected void Page_Load(object sender, EventArgs e) { string action = Request["action"]; string name = null; if (BP.Web.WebUser.No == "Guest") { name = BP.Web.GuestUser.Name; } else { name = BP.Web.WebUser.Name; } TB_User.Value = name; FrmAttachmentDB downDB = new FrmAttachmentDB(); if (DoType.Equals("EditOffice")) { if (!string.IsNullOrEmpty(DelPKVal)) { downDB.MyPK = this.DelPKVal; downDB.Retrieve(); TB_FilePath.Value = downDB.FileFullName; TB_FileType.Value = downDB.FileExts; } if (!string.IsNullOrEmpty(this.FK_FrmAttachment)) { FrmAttachment attachment = new FrmAttachment(); int result = 0; //表单编号与节点不为空 if (this.FK_MapData != null && this.FK_Node != null) { BP.En.QueryObject objInfo = new BP.En.QueryObject(attachment); objInfo.AddWhere(FrmAttachmentAttr.FK_MapData, this.FK_MapData); objInfo.addAnd(); objInfo.AddWhere(FrmAttachmentAttr.FK_Node, this.FK_Node); objInfo.addAnd(); objInfo.AddWhere(FrmAttachmentAttr.NoOfObj, this.NoOfObj); result = objInfo.DoQuery(); //result = attachment.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData, // FrmAttachmentAttr.FK_Node, this.FK_Node, FrmAttachmentAttr.NoOfObj, this.DelPKVal); } if (result == 0) /*如果没有定义,就获取默认的.*/ { attachment.MyPK = this.FK_FrmAttachment; attachment.Retrieve(); } if (!attachment.IsWoEnableSave) { Btn_Save.Visible = false; } if (attachment.IsWoEnableReadonly) { TB_IsReadOnly.Value = "1"; } else { TB_IsReadOnly.Value = "0"; } if (!attachment.IsWoEnableRevise) { Btn_AttachDoc.Visible = false; Btn_UnAttachDoc.Visible = false; } if (!attachment.IsWoEnablePrint) { TB_IsPrint.Value = "0"; } else { TB_IsPrint.Value = "1"; } if (!attachment.IsWoEnableViewKeepMark) { sShowName.Visible = false; } } } if (!string.IsNullOrEmpty(action)) { if (action.Equals("SaveFile")) { SaveFile(); } else if (action.Equals("LoadFile")) { LoadFile(); } else if (action.Equals("LoadFlow")) { GetFlow(); } } }