private void BindFileTreeData(TreeGridView tgv, DataType.FileType fileType) { //this.tvFileList.Nodes.Clear(); tgv.Nodes.Clear(); IDocFileListService service = ServiceContainer.GetService <IDocFileListService>(); dtDocFile = service.GetDocFileDataTableByDCID(Document.DOCID, fileType.ToString()); // Font boldFont = new Font(tvFileList.DefaultCellStyle.Font, FontStyle.Bold); Font boldFont = new Font(tgv.DefaultCellStyle.Font, FontStyle.Bold); // DataView dv = new DataView(dt); node = new TreeGridNode(); // dv.RowFilter = "[PARENT]=" + parentId; //foreach (DataRowView dr in dv) //{ // if (parentId == "0") // { // node = tvFileList.Nodes.Add(Document.DOCNO, "", "", "", "", "", "", ""); node = tgv.Nodes.Add(Document.DOCNO, "", "", "", "", "", "", ""); node.DefaultCellStyle.Font = boldFont; // BindChildNode(node, (string)dr["PHYSICALID"]); HYDocumentMS.IFileHelper file = new FileHelper(); foreach (DataRow dr in dtDocFile.Rows) { node.Nodes.Add(dr["DFL_FILE_NAME"].ToString(), file.getDocumentAllPathByPathID(dr["DFL_FILE_CHILD_PATH"].ToString()), dr["DFL_VER_LATEST"].ToString(), dr["CHECKINFLG"].ToString(), dr["CHECKINDATE"].ToString(), dr["CHECKOUTFLG"].ToString(), dr["CHECKOUTDATE"].ToString(), dr["DFL_ID"].ToString()); node.Expand(); } }
//private DataTable dt; ///// <summary> ///// 查看文件 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //private void btnView_Click(object sender, EventArgs e) //{ // ViewFile(this.tvFileList, DataType.FileType.ProcessFile); //} ///// <summary> ///// 工艺文件注册 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //private void btnRegPhysicalFile_Click(object sender, EventArgs e) //{ // //注册工艺文件 // RegFile(DataType.FileType.ProcessFile); //} ///// <summary> ///// 删除文件 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //private void btnDel_Click(object sender, EventArgs e) //{ // delFile(this.tvFileList, DataType.FileType.ProcessFile); //} ///// <summary> ///// 检入 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //private void btnCheckIN_Click(object sender, EventArgs e) //{ // CheckInFile(this.tvFileList, DataType.FileType.ProcessFile); //} ///// <summary> ///// 检出 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //private void btnCheckOut_Click(object sender, EventArgs e) //{ // CheckOut(this.tvFileList, DataType.FileType.ProcessFile); //} /// <summary> /// 物理文件注册 /// </summary> /// <param name="fileType"></param> private void RegFile(DataType.FileType fileType) { string savePath = ""; string savePathID = "";//保存的目标路径的id ListView listViewFile = null; HYPDM.WinUI.Document.AddFileFrm frm = new HYPDM.WinUI.Document.AddFileFrm(); if (frm.ShowDialog() == DialogResult.OK) { //将需要添加的文件信息返回来 //fileList //savePath listViewFile = frm.ListViewFile; savePath = frm.SaveFilepath; //从弹出窗体返回来的保存路径 savePathID = frm.SavePathID; //保存的目标路径的id // MessageBox.Show(savePath); // FileSockClient.UpLoadFileSocketClient sock = null; //DataEntityQuery<DOC_FILE_LIST> query = DataEntityQuery<DOC_FILE_LIST>.Create(); DOC_FILE_LIST file = new DOC_FILE_LIST(); String path = ""; foreach (ListViewItem item in listViewFile.Items) { // MessageBox.Show(item.Text.ToString()); //var path = ofdFile.FileName; path = item.Text.ToString(); // IDocFileListService _fileService = ServiceContainer.GetService<DocFileListService>(); try { //FileSockClient.UpLoadFileSocketClient sock = new FileSockClient.UpLoadFileSocketClient(path, @"D:\\PDM文件服务器根目录"); FileSockClient.UpLoadFileSocketClient uploadSocket = new FileSockClient.UpLoadFileSocketClient(path, savePath); if (!uploadSocket.AckStatus) { return; } // MessageBox.Show("文件添加成功==文件目录" + @"E:\\PDM文件服务器根目录"); } catch (Exception ex) { MessageBox.Show("文件添加失败==文件目录" + savePath + "===" + ex.Message.ToString()); } finally { } try { file.DFL_ID = Guid.NewGuid().ToString(); file.DFL_FILE_NAME = path.Substring(path.LastIndexOf(@"\") + 1); file.DFL_FILE_EXTEND = path.Substring(path.LastIndexOf(@".") + 1); file.DFL_FILE_CHILD_PATH = savePathID; file.DEL_FLAG = "N"; //file.DFL_VER_LATEST = "V" + DateTime.Now.ToString("yyyyMMddHHmmss"); file.DFL_VER_LATEST = new HYDocumentMS.FileHelper().getNewVer("V"); file.DOCID = Document.DOCID; //与文档表关联主键 file.CREATEDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); file.CREATEUSER = LoginInfo.LoginID; file.LASTUPDATEDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); file.LASTUPDATEUSER = LoginInfo.LoginID; file.CHECKOUTFLG = "N"; file.CHECKINFLG = "Y"; // query.Save(file); //query.Insert(file); file.FILE_TYPE = fileType.ToString(); file.Save(); MessageBox.Show("图纸注册成功,文件目录" + savePath, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } catch (Exception ex) { MessageBox.Show("图纸注册失败【注册到数据库失败】," + ex.Message.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } this.BindTreeData(); } } }