///<summary>ALWAYS save docCur before loading this form.</summary> public FormDocInfo(Patient patCur,Document docCur,string pInitialSelection){ InitializeComponent(); PatCur=patCur; DocCur=docCur; DocOld=DocCur.Copy(); initialSelection=pInitialSelection; Lan.F(this); }
private void treeDocuments_DragDrop(object sender,DragEventArgs e) { TreeNode nodeOver=treeDocuments.GetNodeAt(treeDocuments.PointToClient(Cursor.Position)); if(nodeOver==null) { return; } ImageNodeId nodeOverId=(ImageNodeId)nodeOver.Tag; long nodeOverCategoryDefNum=0; if(nodeOverId.NodeType==ImageNodeType.Category) { nodeOverCategoryDefNum=DefC.Short[(int)DefCat.ImageCats][nodeOver.Index].DefNum; } else { nodeOverCategoryDefNum=DefC.Short[(int)DefCat.ImageCats][nodeOver.Parent.Index].DefNum; } Document docSave=new Document(); ImageNodeId nodeId=new ImageNodeId(); string[] arrayFiles = (string[])e.Data.GetData(DataFormats.FileDrop); string errorMessage=""; for(int i=0;i<arrayFiles.Length;i++) { string draggedFilePath=arrayFiles[i]; string fileName=draggedFilePath.Substring(draggedFilePath.LastIndexOf("\\")+1); if(Directory.Exists(draggedFilePath)) { errorMessage+="\r\n"+fileName; continue; } docSave=ImageStore.Import(draggedFilePath,nodeOverCategoryDefNum,PatCur); FillDocList(false); SelectTreeNode(GetNodeById(MakeIdDoc(docSave.DocNum))); FormDocInfo FormD=new FormDocInfo(PatCur,docSave,GetCurrentFolderName(treeDocuments.SelectedNode)); FormD.ShowDialog();//some of the fields might get changed, but not the filename if(FormD.DialogResult!=DialogResult.OK) { DeleteSelection(false,false); } else { nodeId=MakeIdDoc(docSave.DocNum); DocSelected=docSave.Copy(); } } if(docSave!=null && !MakeIdDoc(docSave.DocNum).Equals(nodeId)) { SelectTreeNode(GetNodeById(MakeIdDoc(docSave.DocNum))); } FillDocList(true); if(errorMessage!="") { MessageBox.Show(Lan.g(this,"The following items are directories and were not copied into the images folder for this patient.")+errorMessage); } }