/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { BLL.T_CellAndEFile_BLL cellAndFile_bll = new BLL.T_CellAndEFile_BLL(); BLL.T_FileList_BLL fileList_bll = new BLL.T_FileList_BLL(); int OrderIndex = 1; foreach (DataGridViewRow px_ros in dgv_PX.Rows) { try { if (_Flg == 0) { //文件级 MDL.T_FileList fileMDL1 = fileList_bll.Find(px_ros.Cells["cl_ID"].Value.ToString(), Globals.ProjectNO); fileMDL1.GdFileOrderIndex = OrderIndex; fileList_bll.Update(fileMDL1); } else { //电子文件 MDL.T_CellAndEFile cellMDL = cellAndFile_bll.Find(px_ros.Cells["cl_ID"].Value.ToString(), Globals.ProjectNO); cellMDL.GdOrderIndex = OrderIndex; cellAndFile_bll.Update(cellMDL); } OrderIndex++; } catch (Exception ex) { TXMessageBoxExtensions.Info("排序更新失败!" + ex.Message); } } TXMessageBoxExtensions.Info("修改成功!"); this.DialogResult = DialogResult.OK; }
private void ExpendParentNode(MDL.T_FileList obj) { pnodeList.Clear(); GetParentNode(obj); foreach (MDL.T_FileList obj3 in pnodeList) { treeFactory.SelectNode(treeView1, obj3.FileID); } }
/// <summary> /// 廊坊的 原文打包 /// </summary> /// <param name="ds"></param> /// <param name="i"></param> private void getDocModel(MDL.T_FileList obj) { string FileID = obj.FileID;// ds.Tables[0].Rows[fileIndex]["FileID"].ToString(); string decFilePath = Application.StartupPath + "\\temp\\" + obj.FileID + ".xml"; string sourFilePath = Application.StartupPath + "\\Reports\\model.xml"; System.IO.File.Copy(sourFilePath, decFilePath); XmlDocument document = new XmlDocument(); document.Load(decFilePath); XmlNode rootFirst = document.SelectSingleNode("元数据/内容信息/数据对象"); XmlNode childNode = rootFirst.FirstChild; if (childNode.Name == "数字对象") { string tFilePath = obj.filepath.Replace("MPDF\\", ""); string decMfile = Application.StartupPath + "\\temp\\" + tFilePath; string sourMfile = Globals.ProjectPath + obj.filepath; try { System.IO.File.Copy(sourMfile, decMfile); childNode.InnerText = obj.filepath; document.Save(decFilePath); } catch { } } BLL.T_CellAndEFile_BLL cellBLL = new ERM.BLL.T_CellAndEFile_BLL(); IList <MDL.T_CellAndEFile> cellList = cellBLL.FindByFileID(FileID, Globals.ProjectNO, 1); XmlNode root1 = document.SelectSingleNode("元数据/内容信息/数据对象/物理对象"); foreach (MDL.T_CellAndEFile obj2 in cellList) { string yswjpath = obj2.filepath.Replace("ODOC\\", ""); XmlElement elementRecord = document.CreateElement("记录"); elementRecord.InnerText = ""; XmlElement element = document.CreateElement("对象名称"); element.InnerText = yswjpath; // dsAttachment.Tables[0].Rows[ii]["yswjpath"].ToString(); elementRecord.AppendChild(element); string dec = Application.StartupPath + "\\temp\\" + yswjpath; // dsAttachment.Tables[0].Rows[ii]["yswjpath"]; string sour = Globals.ProjectPath + obj2.filepath; // dsAttachment.Tables[0].Rows[ii]["yswjpath"]; try { System.IO.File.Copy(sour, dec); } catch { } if (progressBar1.Value < progressBar1.Maximum) { progressBar1.Value++; } else { progressBar1.Value = 1; } Application.DoEvents(); } document.Save(decFilePath); }
private void GetParentNode(MDL.T_FileList obj) { pnodeList.Insert(0, obj); BLL.T_FileList_BLL fileBLL = new ERM.BLL.T_FileList_BLL(); MDL.T_FileList objP = fileBLL.Find(obj.ParentID, obj.ProjectNO); if (objP != null) { GetParentNode(objP); } }
/// <summary> /// 廊坊的 原文打包 /// </summary> /// <param name="ds"></param> /// <param name="i"></param> private void getDocModel_NEW(MDL.T_FileList obj, string filepath_flg) { string FileID = obj.FileID; if (obj.filepath != null) { string tFilePath = obj.filepath.Replace("MPDF\\", ""); string decMfile = filepath_flg + "\\" + tFilePath; string sourMfile = Globals.ProjectPath + obj.filepath; try { if (System.IO.File.Exists(sourMfile)) { System.IO.File.Copy(sourMfile, decMfile, true); } } catch (Exception ex) { MyCommon.WriteLog("生成移交文件时,拷贝文件失败!错误信息:" + ex.Message); } } BLL.T_CellAndEFile_BLL cellBLL = new ERM.BLL.T_CellAndEFile_BLL(); IList <MDL.T_CellAndEFile> cellList = cellBLL.FindByFileID(FileID, Globals.ProjectNO, 1); foreach (MDL.T_CellAndEFile obj2 in cellList) { string yswjpath = obj2.filepath.Replace("ODOC\\", ""); string dec = filepath_flg + "\\" + yswjpath; string sour = Globals.ProjectPath + obj2.filepath; try { if (System.IO.File.Exists(sour)) { System.IO.File.Copy(sour, dec, true); } } catch (Exception ex) { MyCommon.WriteLog("生成移交文件时,拷贝原文件失败!错误信息:" + ex.Message); } if (progressBar1.Value < progressBar1.Maximum) { progressBar1.Value++; } else { progressBar1.Value = 1; } Application.DoEvents(); } }
/// <summary> /// 修改节点属性 /// </summary> private void EditNode() { try { TreeNodeEx theNode = (TreeNodeEx)treeView1.SelectedNode; if (theNode == null) { return; } if (theNode.Parent == null) { return; } if (theNode.ImageIndex == 4) { TXMessageBoxExtensions.Info("提示:已经组卷的文件不允许修改!"); return; } frmMainGetTempletFromStandard frm = new frmMainGetTempletFromStandard(theNode, (theNode.ImageIndex == 2 || theNode.ImageIndex == 7), (TreeNodeEx)theNode.Parent); frm.Text = "修改"; DialogResult ret = frm.ShowDialog(); if (ret == DialogResult.OK) { if (GetTrueText(theNode.Text) == frm.StrTitle.Trim()) { return; } string title = MyCommon.ToSqlString(frm.StrTitle.Trim()); theNode.Text = title; MDL.T_FileList fileMDL = (new BLL.T_FileList_BLL()).Find(theNode.Name, Globals.ProjectNO); if (fileMDL != null) { fileMDL.wjtm = title; (new BLL.T_FileList_BLL()).Update(fileMDL); } } } catch (Exception ex) { ////TXMessageBoxExtensions.InfoErrors(ex); } }
public void CopyFileAndEFileList(string s_projectNO, string t_projectNO) { MDL.T_FileList obj = new MDL.T_FileList(); obj.ProjectNO = s_projectNO; obj.ParentID = t_projectNO; String stmtId = "T_FileList.CopyFileListByProjectNO"; MyISqlMap.QueryForObject <int>(stmtId, obj); MDL.T_CellAndEFile obj2 = new MDL.T_CellAndEFile(); obj2.ProjectNO = s_projectNO; obj2.FileID = t_projectNO; stmtId = "T_CellAndEFile.CopyCellFileListByProjectNO"; MyISqlMap.QueryForObject <int>(stmtId, obj2); MDL.T_GdList obj3 = new MDL.T_GdList(); obj3.ProjectNo = s_projectNO; obj3.ID = t_projectNO; stmtId = "T_GdList.CopyGdFileByProjectNO"; MyISqlMap.QueryForObject <int>(stmtId, obj3); }
//string OldTitle = null; //string oldNum = null; public frmReName(TreeNodeEx node) { if (node != null) { InitializeComponent(); NewNode = node; //OldTitle = node.Text; if (node.ImageIndex == 3) { txtReName.Text = node.Text; //txtReName.Text = node.Text.Substring(node.Text.LastIndexOf("]") + 1); //oldNum = node.Text.Substring(0, node.Text.LastIndexOf("]") + 1); } else { //获取文件信息 MDL.T_FileList fileMDL1 = (new BLL.T_FileList_BLL()).Find(node.Name, Globals.ProjectNO); txtReName.Text = fileMDL1.wjtm; //txtReName.Text = node.Text; //oldNum = ""; } } }
private void btn_OK_Click(object sender, EventArgs e) { bool is_Check = false; foreach (TreeNode c_node in tv_Info.Nodes[0].Nodes) { if (c_node.Checked) { is_Check = true; break; } } if (!is_Check || tv_Info.Nodes[0].Nodes.Count == 0) { TXMessageBoxExtensions.Info("提示:请选择有效的文件!"); return; } foreach (TreeNode NewNode in tv_Info.Nodes[0].Nodes) { if (NewNode.Checked) { MDL.T_FileList fileMDL = (new BLL.T_FileList_BLL()).Find(NewNode.Name, Globals.ProjectNO); if (fileMDL != null && fileMDL.isvisible == 1) { fileMDL.ArchiveID = ""; fileMDL.fileStatus = "3"; NewNode.ImageIndex = (treeFactory.CheckEFileByFileID(NewNode.Name, 2) == true) ? 7 : 2;//判断是否有电子文件 NewNode.SelectedImageIndex = NewNode.ImageIndex; (new BLL.T_FileList_BLL()).Update(fileMDL); } } } TXMessageBoxExtensions.Info("提示:成功撤消文件!"); this.DialogResult = DialogResult.OK; }
/// <summary> /// 判断目录下是否有目录已经组卷 /// </summary> /// <param name="SelectTreeNode">文件夹节点对象</param> /// <param name="check_flg">判断标识:传入false 返回true表示有组卷 false则没有组卷</param> private void CheckFileNodeIsArch(TreeNode SelectTreeNode, ref bool check_flg, ref int NodeCount) { if (!check_flg) { foreach (TreeNode cure_node in SelectTreeNode.Nodes) { NodeCount++; if (cure_node.Nodes != null && cure_node.Nodes.Count > 0) { CheckFileNodeIsArch(cure_node, ref check_flg, ref NodeCount); } MDL.T_FileList fileMDL = (new BLL.T_FileList_BLL()).Find(cure_node.Name, Globals.ProjectNO); if (fileMDL != null) { if (int.Parse(fileMDL.fileStatus) > 3) { check_flg = true; break; } } } } }
/// <summary> /// 重新生成PDF /// </summary> /// <param name="FileID">节点ID</param> private void ConvertAllEFileToPDF(string FileID) { BLL.T_FileList_BLL fileBLL = new ERM.BLL.T_FileList_BLL(); MDL.T_FileList fileMDL = fileBLL.Find(FileID, Globals.ProjectNO); BLL.T_CellAndEFile_BLL cellBLL = new ERM.BLL.T_CellAndEFile_BLL(); IList <MDL.T_CellAndEFile> cellList = cellBLL.FindByGdFileID(FileID, Globals.ProjectNO); System.Collections.ArrayList fileArryList = new System.Collections.ArrayList(); bool isUpdateFileSelect_flg = false; foreach (MDL.T_CellAndEFile cellMDL in cellList) { string pdfPath = ""; if (cellMDL.DocYs == null || cellMDL.DocYs == 1 || cellMDL.fileTreePath == String.Empty || cellMDL.fileTreePath == "") { if (!isUpdateFileSelect_flg) { isUpdateFileSelect_flg = true; } using (ConvertCell2PDF c1 = new ConvertCell2PDF()) { try { int iPageCount = c1.PrintCellToPDF(Globals.ProjectPath + cellMDL.filepath, Globals.ProjectPath + "PDF\\" + cellMDL.CellID + ".pdf"); if (iPageCount == 0) { cellMDL.fileTreePath = ""; } else { cellMDL.fileTreePath = "PDF\\" + cellMDL.CellID + ".pdf"; } cellMDL.DocYs = 0; cellMDL.DoStatus = 1; cellMDL.ys = iPageCount; cellBLL.Update(cellMDL); } catch (Exception e) { cellMDL.fileTreePath = ""; MyCommon.WriteLog("PDF转换失败!错误信息:" + e.Message); } pdfPath = cellMDL.fileTreePath; } } else { pdfPath = cellMDL.fileTreePath; } if (!System.IO.File.Exists(Globals.ProjectPath + pdfPath)) { continue; } fileArryList.Add(Globals.ProjectPath + pdfPath); } string[] FileList = new string[fileArryList.Count]; for (int i = 0; i < fileArryList.Count; i++) { FileList[i] = fileArryList[i].ToString(); } using (ConvertCell2PDF c1 = new ConvertCell2PDF()) { int iPageCount = 0; if (FileList.Length > 0) { try { iPageCount = c1.MergePDF(FileList, Globals.ProjectPath + "MPDF\\" + FileID + ".pdf"); if (iPageCount == 0) { fileMDL.filepath = ""; } else { fileMDL.filepath = "MPDF\\" + FileID + ".pdf"; } } catch (Exception ex) { iPageCount = 0; fileMDL.filepath = ""; MyCommon.WriteLog("合并PDF失败!错误信息:" + ex.Message); } } else { fileMDL.filepath = ""; } //1 文字数量 2声像 3照片数量 int EFileType_flg = 1; TreeFactory treeFactory = new TreeFactory(); treeFactory.GetParentNodeType(FileID, ref EFileType_flg); if (EFileType_flg == 1) { fileMDL.sl = iPageCount; } else if (EFileType_flg == 3) { int tzz = MyCommon.ToInt(fileMDL.tzz); int dtz = MyCommon.ToInt(fileMDL.dtz); int zpz = MyCommon.ToInt(fileMDL.zpz); int dpz = MyCommon.ToInt(fileMDL.dpz); fileMDL.dw = (iPageCount + dtz).ToString(); fileMDL.tzz = (iPageCount).ToString(); fileMDL.dtz = dtz.ToString(); fileMDL.wzz = (zpz + dpz).ToString(); fileMDL.zpz = zpz.ToString(); fileMDL.dpz = dpz.ToString(); } else if (EFileType_flg == 2) { int tzz = MyCommon.ToInt(fileMDL.tzz); int dtz = MyCommon.ToInt(fileMDL.dtz); int zpz = MyCommon.ToInt(fileMDL.zpz); int dpz = MyCommon.ToInt(fileMDL.dpz); fileMDL.dw = (tzz + dtz).ToString(); fileMDL.tzz = tzz.ToString(); fileMDL.dtz = dtz.ToString(); fileMDL.wzz = (iPageCount + dpz).ToString(); fileMDL.zpz = (iPageCount).ToString(); fileMDL.dpz = dpz.ToString(); } fileMDL.selected = 0; fileBLL.Update(fileMDL); } }
/// <summary> /// 保存 /// </summary> public void Save(string text) { //CBLL.FileRegist cbll = new ERM.CBLL.FileRegist(); if (!String.IsNullOrEmpty(text)) { if (!MyCommon.IsMatchCode(text)) { TXMessageBoxExtensions.Info("包含非法字符,不能保存!"); return; } //for (int i = 0; i < NewNode.Parent.Nodes.Count; i++) //{ // string newtext = NewNode.Parent.Nodes[i].Text.Trim().Substring(NewNode.Parent.Nodes[i].Text.Trim().LastIndexOf("]") + 1); // if (text.Trim().Equals(newtext)) // { // TXMessageBoxExtensions.Info("重命名失败,同一层级下节点名字不能重复!"); // return; // } //} try { if (NewNode.ImageIndex == 3) { BLL.T_CellAndEFile_BLL cellAndFile_bll = new BLL.T_CellAndEFile_BLL(); MDL.T_CellAndEFile cellMDL = cellAndFile_bll.Find(NewNode.Name, Globals.ProjectNO); cellMDL.title = text; cellAndFile_bll.Update(cellMDL); //cbll.UpdateAttachmentTitle(OpeartPath((TreeNodeEx)(NewNode.Parent)), Globals.ProjectNO, OldTitle, text); } else { BLL.T_FileList_BLL fileList_bll = new BLL.T_FileList_BLL(); MDL.T_FileList fileMDL1 = fileList_bll.Find(NewNode.Name, Globals.ProjectNO); fileMDL1.wjtm = text; fileMDL1.gdwj = text; fileList_bll.Update(fileMDL1); //string OldPath = OpeartPath((TreeNodeEx)NewNode); //string NewPath = OldPath.Substring(0, OldPath.LastIndexOf("\\") + 1) + text; //cbll.UpdateFinal_fileTitle(NewPath, Globals.ProjectNO, OldPath); //cbll.UpdateCell_TempletTitle(NewPath, Globals.ProjectNO, OldPath, text); //cbll.UpdateAttachmentFilePath(NewPath, OldPath, Globals.ProjectNO); } NewNode.Text = text; TXMessageBoxExtensions.Info("修改成功!"); this.Close(); } catch { TXMessageBoxExtensions.Info("重命名失败!"); } } else { TXMessageBoxExtensions.Info("名称不能为空!"); return; } }
public void ShowData(TreeNodeEx NewNode) { BLL.T_FileList_BLL fileBLL = new ERM.BLL.T_FileList_BLL(); MDL.T_FileList fileMDL = fileBLL.Find(NewNode.Name, Globals.ProjectNO); if (fileMDL == null)//没有登记文件也不显示它|| fileMDL.fileStatus == "3" { return; } this.wjtm.Text = fileMDL.wjtm; if (fileMDL.zrr != null && fileMDL.zrr != "") { this.cmbzrz.Text = fileMDL.zrr; } else { this.cmbzrz.Text = getzrz(); } this.wh.Text = fileMDL.wh; // this.bgqx.Text = fileMDL.bgqx; // this.mj.Text = fileMDL.mj; this.ztlx.Text = fileMDL.ztlx; //if ((!String.IsNullOrEmpty(fileMDL.CreateDate)) && fileMDL.CreateDate != "") //{ // this.dptCreateDate.Text = DateTime.Parse(fileMDL.CreateDate).ToString("yyyy-MM-dd"); //} //else //{ // this.dptCreateDate.Text = ""; //} //if ((!String.IsNullOrEmpty(fileMDL.CreateDate2)) && fileMDL.CreateDate2 != "") //{ // this.dptCreateDate2.Text = DateTime.Parse(fileMDL.CreateDate2).ToString("yyyy-MM-dd"); //} //else //{ // this.dptCreateDate2.Text = ""; //} //if (this.dptCreateDate.Text == "" && this.dptCreateDate2.Text == "") //{ // MDL.T_Projects projectMDL = (new BLL.T_Projects_BLL()).Find(Globals.ProjectNO); // if (projectMDL != null) // { // this.dptCreateDate.Text = (projectMDL.begindate == null || projectMDL.begindate=="") ? "" : DateTime.Parse ((projectMDL.begindate)).ToString("yyyy-MM-dd"); //开工日期 // this.dptCreateDate2.Text = (projectMDL.enddate == null || projectMDL.enddate == "") ? "" : DateTime.Parse(projectMDL.enddate).ToString("yyyy-MM-dd"); // } //} this.gg.Text = fileMDL.gg; this.gb.Text = fileMDL.wjgbdm; //this.wjlx.Text = fileMDL.wjlxdm; // this.wjgs.Text = fileMDL.wjgs; //this.wjdx.Text = fileMDL.wjdx; this.txtstys.Text = fileMDL.stys.ToString(); this.txtWzys.Text = fileMDL.wzys.ToString(); //this.psdd.Text = fileMDL.psdd; //this.dptpssj.TextEx = fileMDL.pssj; //this.psz.Text = fileMDL.psz; //this.fbl.Text = fileMDL.fbl; //this.xjpp.Text = fileMDL.xjpp; //this.xjxh.Text = fileMDL.xjxh; this.wh.Text = fileMDL.wh; //this.sb.Text = fileMDL.sb; this.fz.Text = fileMDL.bz; //this.wjmc.Text = fileMDL.wjmc; //this.FileID.Text = fileMDL.FileID; //this.wjbsm.Text = fileMDL.wjbsm; // this.cmb_wjlx.Text = fileMDL.wjlx; this.sl.Text = MyCommon.ToInt(fileMDL.sl).ToString(); //this.wzz.Text = MyCommon.ToInt(fileMDL.wzz).ToString();// 照片张 注:图样张=图纸张+底图张 this.tzz.Text = MyCommon.ToInt(fileMDL.tzz).ToString(); //图纸张 this.dtz.Text = MyCommon.ToInt(fileMDL.dtz).ToString(); //底图张 this.txtWzys.Text = fileMDL.wzys.ToString(); //this.dw.Text = MyCommon.ToInt(fileMDL.dw).ToString(); //注:图样张=照片张+底片张 this.zpz.Text = MyCommon.ToInt(fileMDL.zpz).ToString(); //照片张 this.dpz.Text = MyCommon.ToInt(fileMDL.dpz).ToString(); //底片张 this.dptCreateDate.Text = fileMDL.CreateDate; this.dptCreateDate2.Text = fileMDL.CreateDate2; if (fileMDL.fileStatus == "0")//没有登记文件也不显示它 { // this.bgqx.Text = "长期"; // this.mj.Text = "内部"; this.ztlx.Text = "纸质"; this.gg.Text = "A4"; this.gb.Text = "正本"; // this.wjlx.Text = "文本文件(T)"; // this.cmb_wjlx.Text = "纸质"; } else { // this.bgqx.Text =fileMDL.bgqx; // this.mj.Text = fileMDL.mj; this.ztlx.Text = fileMDL.ztlx; this.gg.Text = fileMDL.gg; this.gb.Text = fileMDL.wjgbdm; // this.wjlx.Text =fileMDL.wjlxdm; } }
private void CreateFile(string TableName, string ID, string TempSavePath) { if (TableName == "T_FileList") { BLL.T_FileList_BLL fileBLL = new ERM.BLL.T_FileList_BLL(); MDL.T_FileList fileMDL = fileBLL.Find(ID, Globals.ProjectNO); if (fileMDL != null) { List <MDL.T_FileList> fileList = new List <ERM.MDL.T_FileList>(); fileList.Add(fileMDL); DataTable ds = MyCommon.ToDataTable <MDL.T_FileList>(fileList); ds.TableName = "T_FileList_" + ID; ds.WriteXml(TempSavePath + "\\T_FileList\\" + ID + ".xml", XmlWriteMode.WriteSchema); lblTitle.Text = @"正在导出:" + fileMDL.wjtm; if (!string.IsNullOrEmpty(fileMDL.filepath) && System.IO.File.Exists(Globals.ProjectPath + fileMDL.filepath))//pdf文件 { System.IO.File.Copy(Globals.ProjectPath + fileMDL.filepath, TempSavePath + "\\T_CellAndEFile\\" + fileMDL.filepath, true); } } else { MDL.T_GdList gdList_MDL = (new BLL.T_GdList_BLL()).FindIDAndProjectNo(ID, Globals.ProjectNO); if (gdList_MDL != null) { List <MDL.T_GdList> GdList = new List <ERM.MDL.T_GdList>(); GdList.Add(gdList_MDL); DataTable ds = MyCommon.ToDataTable <MDL.T_GdList>(GdList); ds.TableName = "T_GdList_" + ID; ds.WriteXml(TempSavePath + "\\T_GdList\\" + ID + ".xml", XmlWriteMode.WriteSchema); lblTitle.Text = @"正在导出:" + gdList_MDL.GdName; } } if (curIndex < progressBar1.Maximum) { progressBar1.Value = curIndex++; } else { progressBar1.Value = progressBar1.Maximum - 1; } Application.DoEvents(); } else if (TableName == "T_CellAndEFile") { BLL.T_CellAndEFile_BLL cellBLL = new ERM.BLL.T_CellAndEFile_BLL(); IList <MDL.T_CellAndEFile> cellList = cellBLL.FindByGdFileID(ID, Globals.ProjectNO); if (cellList.Count > 0) { ///移除没有保存的电子表格 // for (int i = 0; i < cellList.Count; i++) // { // if (cellList[i].DoStatus != 1) // { // cellList.RemoveAt(i); // i--; // } // } if (cellList.Count > 0) { BLL.T_CellFileTemplate_BLL cellTplBLL = new ERM.BLL.T_CellFileTemplate_BLL(); foreach (MDL.T_CellAndEFile cellMDL in cellList) { if (cellMDL.filepath == null || cellMDL.filepath.Trim() == "") { MDL.T_CellFileTemplate cellTplMDL = cellTplBLL.Find(cellMDL.CellID); if (cellTplMDL != null) { string CelllTplFile = Application.StartupPath + "\\Template" + cellTplMDL.filepath; if (System.IO.File.Exists(CelllTplFile)) { FileInfo fileInfo = new FileInfo(CelllTplFile); string NewCellFileID = cellMDL.CellID; cellMDL.filepath = "ODOC\\" + NewCellFileID + fileInfo.Extension; string NewCellFile = TempSavePath + "\\T_CellAndEFile\\ODOC\\" + NewCellFileID + fileInfo.Extension; System.IO.File.Copy(CelllTplFile, NewCellFile, true); } } } else { if (System.IO.File.Exists(Globals.ProjectPath + cellMDL.filepath))//原件 { System.IO.File.Copy(Globals.ProjectPath + cellMDL.filepath, TempSavePath + "\\T_CellAndEFile\\" + cellMDL.filepath, true); } if (System.IO.File.Exists(Globals.ProjectPath + cellMDL.fileTreePath))//pdf文件 { System.IO.File.Copy(Globals.ProjectPath + cellMDL.fileTreePath, TempSavePath + "\\T_CellAndEFile\\" + cellMDL.fileTreePath, true); } } } DataTable ds2 = MyCommon.ToDataTable <MDL.T_CellAndEFile>(cellList); ds2.TableName = "T_CellAndEFile_" + ID; ds2.WriteXml(TempSavePath + "\\T_CellAndEFile\\" + ID + ".xml", XmlWriteMode.WriteSchema); } } if (curIndex < progressBar1.Maximum) { progressBar1.Value = curIndex++; } else { progressBar1.Value = progressBar1.Maximum - 1; } Application.DoEvents(); } }
private void menuPasteFile_Click(object sender, EventArgs e) { TreeNodeEx theNode = treeView1.SelectedNode as TreeNodeEx; if (theNode == null) { return; } if (CopyFileID != "") { BLL.T_FileList_BLL fileBLL = new ERM.BLL.T_FileList_BLL(); //fileBLL.FindByFileID( MDL.T_FileList fileMDL = fileBLL.Find(CopyFileID, Globals.ProjectNO); string OldFileID = fileMDL.FileID; string NewFileID = Guid.NewGuid().ToString().ToUpper(); fileMDL.FileID = NewFileID; fileMDL.ParentID = theNode.Name; fileMDL.ArchiveID = ""; fileMDL.fileStatus = "0"; fileMDL.wjtm += "_复制"; fileMDL.gdwj += "_复制"; fileMDL.OrderIndex = fileBLL.GetMaxOrderIndex(theNode.Name, Globals.ProjectNO) + 1; fileBLL.Add(fileMDL); BLL.T_CellAndEFile_BLL cellTplBLL = new ERM.BLL.T_CellAndEFile_BLL(); IList <MDL.T_CellAndEFile> cellTplList = cellTplBLL.FindByFileID(CopyFileID, Globals.ProjectNO);//cellTplBLL.FindByFileID(CopyFileID, Globals.ProjectNO, 0); foreach (MDL.T_CellAndEFile obj in cellTplList) { string newCellID = Guid.NewGuid().ToString().ToUpper(); string fileName = Globals.ProjectPath + obj.filepath; if (System.IO.File.Exists(fileName)) { System.IO.File.Copy(fileName, fileName.ToUpper().Replace(obj.CellID.ToUpper(), newCellID), true); obj.filepath = obj.filepath.ToUpper().Replace(obj.CellID.ToUpper(), newCellID); } else { obj.filepath = ""; } string fileNamePDF = Globals.ProjectPath + obj.fileTreePath; if (System.IO.File.Exists(fileNamePDF)) { System.IO.File.Copy(fileNamePDF, fileNamePDF.ToUpper().Replace(obj.CellID.ToUpper(), newCellID), true); obj.fileTreePath = obj.fileTreePath.ToUpper().Replace(obj.CellID.ToUpper(), newCellID); } else { obj.fileTreePath = ""; } obj.CellID = newCellID; obj.FileID = NewFileID; cellTplBLL.Add(obj); } TreeNodeEx newNode = new TreeNodeEx(); newNode.Name = fileMDL.FileID; newNode.Text = fileMDL.wjtm; newNode.ImageIndex = (treeFactory.CheckEFileByFileID(newNode.Name, 1) == true) ? 7 : 2;//判断是否有电子文件; newNode.SelectedImageIndex = newNode.ImageIndex; newNode.NodeValue = fileMDL.FileID; theNode.Nodes.Add(newNode); } else { TXMessageBoxExtensions.Info("请先复制!"); } }
private void SaveInfo(int a_flg, MDL.T_FileList File_MDL, MDL.T_CellAndEFile Cell_MDL, BLL.T_FileList_BLL File_BLL, BLL.T_CellAndEFile_BLL Cell_BLL) { switch (a_flg) { case 1: //首次或多条记录 添加 File_MDL.ParentID = _gdID; File_MDL.FromFileID = File_MDL.FileID; File_MDL.FileID = Guid.NewGuid().ToString(); File_MDL.GDID = _gdID; File_MDL.FL = 1; File_MDL.GdFileOrderIndex = File_BLL.GetMaxGdFileOrderIndex(File_MDL.GDID, Globals.ProjectNO) + 1; File_BLL.Add(File_MDL); if (Cell_MDL != null) { Cell_MDL.GdFileID = File_MDL.FileID; Cell_MDL.DoStatus = 1; Cell_MDL.GdOrderIndex = Cell_BLL.GetMaxGdFileOrderIndex(Cell_MDL.GdFileID, Globals.ProjectNO) + 1; Cell_BLL.Update(Cell_MDL); //添加原文信息 if (File.Exists(Globals.ProjectPath + Cell_MDL.filepath)) { MyCommon.InsertOldEfile(Cell_MDL.CellID, Globals.ProjectNO, Globals.LoginUser, "资料用表-保存并归档-首次或多条记录 添加", Globals.ProjectPath + Cell_MDL.filepath); } } break; case 2: //一条记录,修改文件级 File_MDL.GDID = _gdID; File_MDL.GdFileOrderIndex = File_BLL.GetMaxGdFileOrderIndex(File_MDL.GDID, Globals.ProjectNO) + 1; File_BLL.Update(File_MDL); break; case 3: //多个表格设置 以前的文件条目是否要删除?还是不动 File_MDL.ParentID = _gdID; File_MDL.FromFileID = File_MDL.FileID; File_MDL.FileID = Guid.NewGuid().ToString(); File_MDL.GDID = _gdID; File_MDL.FL = 1; File_BLL.Add(File_MDL); ArrayList gdFileList = new ArrayList(); string[] cell_list = _CellID.Split(new char[] { ';' }); foreach (string c_id in cell_list) { if (c_id != null && c_id.Trim() == "") { continue; } MDL.T_CellAndEFile cell_m = Cell_BLL.Find(c_id, Globals.ProjectNO); if (!string.IsNullOrWhiteSpace(cell_m.GdFileID)) { gdFileList.Add(cell_m.GdFileID); } if (cell_m != null) { cell_m.GdFileID = File_MDL.FileID; cell_m.DoStatus = 1; cell_m.GdOrderIndex = Cell_BLL.GetMaxGdFileOrderIndex(cell_m.GdFileID, Globals.ProjectNO) + 1; Cell_BLL.Update(cell_m); //添加原文信息 if (File.Exists(Globals.ProjectPath + cell_m.filepath)) { MyCommon.InsertOldEfile(cell_m.CellID, Globals.ProjectNO, Globals.LoginUser, "资料用表-保存并归档-多个表格设置", Globals.ProjectPath + cell_m.filepath); } } } //修改前可以判断下文件级,如果要删除,就在修改前删除 //表格更新完成之后,再删除 for (int i = 0; i < gdFileList.Count; i++) { string gdf_id = gdFileList[i].ToString(); MDL.T_FileList file_mdl_del = File_BLL.Find(gdf_id, Globals.ProjectNO); if (file_mdl_del != null) { IList <MDL.T_CellAndEFile> CellMDL_checklist = Cell_BLL.FindByGdFileID(gdf_id, Globals.ProjectNO); if (CellMDL_checklist == null || CellMDL_checklist.Count == 0) { //文件条目只有一条记录的,就删掉 File_BLL.Delete(file_mdl_del); } } } break; } }
/// <summary> /// 获取已经选择的组卷类别 /// </summary> private void getGDID() { if (_a_flg == 1)//单个表格 { #region MDL.T_CellAndEFile cell_MDL = (new BLL.T_CellAndEFile_BLL()).Find(_CellID, Globals.ProjectNO); if (cell_MDL != null) { _FileID = cell_MDL.FileID; MDL.T_FileList file_MDL = (new BLL.T_FileList_BLL()).Find(cell_MDL.GdFileID, Globals.ProjectNO); if (file_MDL != null) { if (!string.IsNullOrEmpty(file_MDL.GDID)) { _gdID = file_MDL.GDID; } } } #endregion } else if (_a_flg == 2)//多个表格 { #region BLL.T_CellAndEFile_BLL Cell_BLL = new BLL.T_CellAndEFile_BLL(); BLL.T_FileList_BLL File_BLL = new BLL.T_FileList_BLL(); string[] cell_list = _CellID.Split(new char[] { ';' }); foreach (string c_id in cell_list) { if (c_id != null && c_id.Trim() == "") { continue; } MDL.T_CellAndEFile cell_MDL = Cell_BLL.Find(c_id, Globals.ProjectNO); _FileID = cell_MDL.FileID; if (cell_MDL != null) { MDL.T_FileList file_MDL = File_BLL.Find(cell_MDL.GdFileID, Globals.ProjectNO); if (file_MDL != null) { if (!string.IsNullOrEmpty(file_MDL.GDID) && string.IsNullOrEmpty(_gdID)) { _gdID = file_MDL.GDID; } if (!string.IsNullOrEmpty(file_MDL.GDID) && !string.IsNullOrEmpty(_gdID) && _gdID != file_MDL.GDID) { _gdID = null; break; } } } } #endregion } else if (_a_flg == 3)//文件 { #region BLL.T_FileList_BLL File_BLL = new BLL.T_FileList_BLL(); MDL.T_FileList file_MDL = File_BLL.Find(_FileID, Globals.ProjectNO); if (file_MDL != null) { _gdID = file_MDL.GDID; } #endregion } }
/// <summary> /// 删除当前节点 /// </summary> private void DelNode() { frm2PDFProgressMsg dfmsg = null; try { TreeNodeEx theNode = (TreeNodeEx)treeView1.SelectedNode; if (theNode == null) { return; } TreeNodeEx parentNode = (TreeNodeEx)theNode.Parent; if (parentNode == null) { return; } if (parentNode.Tag != null && parentNode.Tag.ToString() == "") { MyFavorites myFav1 = new MyFavorites(); myFav1.Delete(theNode.Name); theNode.Remove(); return; } int DelCount = 0; if (theNode.ImageIndex == 1) { bool check_flg = false; CheckFileNodeIsArch(theNode, ref check_flg, ref DelCount); if (check_flg) { TXMessageBoxExtensions.Info("提示:已经组卷的文件目录不允许修改!"); return; } } DialogResult ret = TXMessageBoxExtensions.Question("确定删除 [" + GetTrueText(theNode.Text) + "] 及其子节点?"); if (ret == DialogResult.OK) { this.Enabled = false; MDL.T_FileList fileMDL = (new BLL.T_FileList_BLL()).Find(theNode.Name, Globals.ProjectNO); if (fileMDL != null) { if (int.Parse(fileMDL.fileStatus) > 3) { TXMessageBoxExtensions.Info("该文件已经 登记或组卷,无法进行删除操作!"); this.Enabled = true; return; } dfmsg = new frm2PDFProgressMsg(); if (theNode.ImageIndex == 1) { dfmsg.progressBar1.Maximum = DelCount; dfmsg.label2.Text = "正在删除:0/" + DelCount.ToString(); dfmsg.Show(); Application.DoEvents(); } else { dfmsg.progressBar1.Maximum = 2; dfmsg.progressBar1.Value = 1; dfmsg.label2.Text = "正在删除:1/1"; dfmsg.Show(); Application.DoEvents(); } DeleteRecycle(theNode.Name, ref dfmsg); theNode.Remove(); CheckEnable(); tssLabel1.Text = Globals.NormalStatus; } this.Enabled = true; } } catch (Exception ex) { this.Enabled = true; if (dfmsg != null) { dfmsg.Dispose(); dfmsg.Close(); } } finally { this.Enabled = true; if (dfmsg != null) { dfmsg.Dispose(); dfmsg.Close(); } } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { ///说明:表格保存流程 ///1单个表格保存 ///选择“组卷类别”,保存时,将文件和当前表格文件拷贝到归档类别下面 /// 修改时,如果如果是当个表格就直接将文件条目,改变到新归档类别下 /// ///2多个表格保存,就在多个目录下都创建一个目录,每个目录对应一个电子表格 /// ///3文件保存 ///3.1 将文件下所有表格指定到同目录下 ///3.2 将没有设置目录的表格指定到一个目录下 /// _gdID = getCheckBoxID(); if (string.IsNullOrEmpty(_gdID)) { TXMessageBoxExtensions.Info("提示:请选择归档类别!"); return; } else { if (_a_flg == 1)//单个表格 { #region BLL.T_FileList_BLL File_BLL = new BLL.T_FileList_BLL(); BLL.T_CellAndEFile_BLL Cell_BLL = new BLL.T_CellAndEFile_BLL(); MDL.T_CellAndEFile cell_MDL = Cell_BLL.Find(_CellID, Globals.ProjectNO); MDL.T_FileList File_MDL = File_BLL.Find(_FileID, Globals.ProjectNO); if (cell_MDL != null && File_MDL != null) { //判断是否存在以前的记录 if (string.IsNullOrEmpty(cell_MDL.GdFileID)) { //无记录,第一次直接添加 SaveInfo(1, File_MDL, cell_MDL, File_BLL, Cell_BLL); } else { ///存在记录 ///如果只有当前电子表格的,就将文件一起修改到最新归档目录下 ///如果文件目录下有多个表格,就再创建一条记录,最后一条记录,就修改文件归档类别 IList <MDL.T_CellAndEFile> CellMDL_list = Cell_BLL.FindByGdFileID(cell_MDL.GdFileID, Globals.ProjectNO); if (CellMDL_list != null && CellMDL_list.Count > 0) { if (CellMDL_list.Count == 1) { ///一条记录,多条改成一条,只要是最后一个电子文件,调整时,就是将文件归档分类修改 MDL.T_FileList FileCheck_MDL = File_BLL.Find(cell_MDL.GdFileID, Globals.ProjectNO); if (FileCheck_MDL != null) { SaveInfo(2, FileCheck_MDL, null, File_BLL, null); } else { ///记录不存在,重新创建 SaveInfo(1, File_MDL, cell_MDL, File_BLL, Cell_BLL); } } else if (CellMDL_list.Count > 1) { ///多条记录 ,产生一条,新的文件条目,将电子文件挂到当前条目下 SaveInfo(1, File_MDL, cell_MDL, File_BLL, Cell_BLL); } } } TXMessageBoxExtensions.Info("提示:保存成功!"); this.Close(); } #endregion } else if (_a_flg == 2)//多个表格 { #region BLL.T_FileList_BLL File_BLL = new BLL.T_FileList_BLL(); BLL.T_CellAndEFile_BLL Cell_BLL = new BLL.T_CellAndEFile_BLL(); MDL.T_FileList File_MDL = File_BLL.Find(_FileID, Globals.ProjectNO); if (File_MDL != null) { SaveInfo(3, File_MDL, null, File_BLL, Cell_BLL); TXMessageBoxExtensions.Info("提示:保存成功!"); this.Close(); } #endregion } else if (_a_flg == 3)//文件 { #region BLL.T_FileList_BLL File_BLL = new BLL.T_FileList_BLL(); BLL.T_CellAndEFile_BLL Cell_BLL = new BLL.T_CellAndEFile_BLL(); MDL.T_FileList File_MDL = File_BLL.Find(_FileID, Globals.ProjectNO); ArrayList gdFileList = new ArrayList(); if (File_MDL != null) { IList <MDL.T_CellAndEFile> CellMDL_list = Cell_BLL.FindByFileIDAndNOCell(_FileID, Globals.ProjectNO); if (CellMDL_list != null && CellMDL_list.Count > 0) { File_MDL.FromFileID = File_MDL.FileID; File_MDL.FileID = Guid.NewGuid().ToString(); File_MDL.GDID = _gdID; File_MDL.FL = 1; File_MDL.GdFileOrderIndex = File_BLL.GetMaxGdFileOrderIndex(File_MDL.GDID, Globals.ProjectNO) + 1; File_BLL.Add(File_MDL); foreach (MDL.T_CellAndEFile cell_m in CellMDL_list) { if (!string.IsNullOrEmpty(cell_m.GdFileID)) { gdFileList.Add(cell_m.GdFileID); } cell_m.GdFileID = File_MDL.FileID; cell_m.GdOrderIndex = Cell_BLL.GetMaxGdFileOrderIndex(cell_m.GdFileID, Globals.ProjectNO) + 1; Cell_BLL.Update(cell_m); } } //表格更新完成之后,再删除 for (int i = 0; i < gdFileList.Count; i++) { string gdf_id = gdFileList[i].ToString(); MDL.T_FileList file_mdl_del = File_BLL.Find(gdf_id, Globals.ProjectNO); if (file_mdl_del != null) { IList <MDL.T_CellAndEFile> CellMDL_checklist = Cell_BLL.FindByGdFileID(gdf_id, Globals.ProjectNO); if (CellMDL_checklist == null || CellMDL_checklist.Count == 0) { //文件条目只有一条记录的,就删掉 File_BLL.Delete(file_mdl_del); } } } } #endregion } } }