public static void Update(Mount mount){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),mount); return; } Crud.MountCrud.Update(mount); }
public static long Insert(Mount mount){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { mount.MountNum=Meth.GetLong(MethodBase.GetCurrentMethod(),mount); return mount.MountNum; } return Crud.MountCrud.Insert(mount); }
public static void Delete(Mount mount){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),mount); return; } string command="DELETE FROM mount WHERE MountNum='"+POut.Long(mount.MountNum)+"'"; Db.NonQ(command); }
///<summary></summary> public FormMountEdit(Mount mount) { // // Required for Windows Form Designer support // InitializeComponent(); Lan.F(this); myMount=mount; }
///<summary>Selection doesn't only happen by the tree and mouse clicks, but can also happen by automatic processes, such as image import, image paste, etc...</summary> private void SelectTreeNode(TreeNode node) { //Select the node always, but perform additional tasks when necessary (i.e. load an image, or mount). treeDocuments.SelectedNode=node; treeDocuments.Invalidate(); //Clear the copy document number for mount item swapping whenever a new mount is potentially selected. IdxDocToCopy=-1; //We only perform a load if the new selection is different than the old selection. ImageNodeId nodeId=new ImageNodeId(); if(node!=null) { nodeId=(ImageNodeId)node.Tag; } if(nodeId.Equals(NodeIdentifierOld)) { return; } pictureBoxMain.Visible=true; if(axAcroPDF1!=null) { axAcroPDF1.Dispose();//Clear any previously loaded Acrobat .pdf file. } DocSelected=new Document(); NodeIdentifierOld=nodeId; //Disable all item tools until the currently selected node is loaded properly in the picture box. EnableAllTreeItemTools(false); if(ToolBarPaint.Buttons["Hand"]!=null) { ToolBarPaint.Buttons["Hand"].Pushed=true; } if(ToolBarPaint.Buttons["Crop"]!=null) { ToolBarPaint.Buttons["Crop"].Pushed=false; } //Stop any current image processing. This will avoid having the ImageRenderingNow set to a valid image after //the current image has been erased. This will also avoid concurrent access to the the currently loaded images by //the main and worker threads. EraseCurrentImages(); if(nodeId.NodeType==ImageNodeType.Category) { //A folder was selected (or unselection, but I am not sure unselection would be possible here). //The panel note control is made invisible to start and then made visible for the appropriate documents. This //line prevents the possibility of showing a signature box after selecting a folder node. panelNote.Visible=false; //Make sure the controls are sized properly in the image module since the visibility of the panel note might //have just changed. ResizeAll(); } else if(nodeId.NodeType==ImageNodeType.Eob) { EobAttach eob=EobAttaches.GetOne(nodeId.PriKey); ImagesCur=ImageStore.OpenImagesEob(eob); if(ImagesCur[0]==null) { if(ImageHelper.HasImageExtension(eob.FileName)) { MessageBox.Show(Lan.g(this,"File not found: ") + eob.FileName); } else if(Path.GetExtension(eob.FileName).ToLower()==".pdf") {//Adobe acrobat file. try { axAcroPDF1=new AxAcroPDFLib.AxAcroPDF(); this.Controls.Add(axAcroPDF1); axAcroPDF1.Visible=true; axAcroPDF1.Size=pictureBoxMain.Size; axAcroPDF1.Location=pictureBoxMain.Location; axAcroPDF1.OnError+=new EventHandler(pdfFileError); string pdfFilePath=ODFileUtils.CombinePaths(ImageStore.GetEobFolder(),eob.FileName); if(!File.Exists(pdfFilePath)) { MessageBox.Show(Lan.g(this,"File not found: ") + eob.FileName); } else { axAcroPDF1.LoadFile(pdfFilePath);//The return status of this function doesn't seem to be helpful. pictureBoxMain.Visible=false; } } catch { //An exception can happen if they do not have Adobe Acrobat Reader version 8.0 or later installed. //Simply ignore this exception and do nothing. We never used to display .pdf files anyway, so we //essentially revert back to the old behavior in this case. } } //return;? } EnableTreeItemTools(pictureBoxMain.Visible,true,true,pictureBoxMain.Visible,true,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible, pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible); } else if(nodeId.NodeType==ImageNodeType.Doc) { //Reload the doc from the db. We don't just keep reusing the tree data, because it will become more and //more stale with age if the program is left open in the image module for long periods of time. DocSelected=Documents.GetByNum(nodeId.PriKey); IdxSelectedInMount=0; ImagesCur=ImageStore.OpenImages(new Document[] { DocSelected },PatFolder); bool isExportable=pictureBoxMain.Visible; if(ImagesCur[0]==null) { if(ImageHelper.HasImageExtension(DocSelected.FileName)) { MessageBox.Show(Lan.g(this,"File not found: ") + DocSelected.FileName); } else if(Path.GetExtension(DocSelected.FileName).ToLower()==".pdf") {//Adobe acrobat file. try { axAcroPDF1=new AxAcroPDFLib.AxAcroPDF(); this.Controls.Add(axAcroPDF1); axAcroPDF1.Visible=true; axAcroPDF1.Size=pictureBoxMain.Size; axAcroPDF1.Location=pictureBoxMain.Location; axAcroPDF1.OnError+=new EventHandler(pdfFileError); string pdfFilePath=ODFileUtils.CombinePaths(PatFolder,DocSelected.FileName); if(!File.Exists(pdfFilePath)) { MessageBox.Show(Lan.g(this,"File not found: ") + DocSelected.FileName); } else { axAcroPDF1.LoadFile(pdfFilePath);//The return status of this function doesn't seem to be helpful. pictureBoxMain.Visible=false; isExportable=true; } } catch { //An exception can happen if they do not have Adobe Acrobat Reader version 8.0 or later installed. //Simply ignore this exception and do nothing. We never used to display .pdf files anyway, so we //essentially revert back to the old behavior in this case. } } } SetBrightnessAndContrast(); EnableTreeItemTools(pictureBoxMain.Visible,true,true,pictureBoxMain.Visible,true,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible, pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible,isExportable); } else if(nodeId.NodeType==ImageNodeType.Mount) { //Creates a complete initial mount image. No need to call invalidate until changes are made to the mount later. MountItemsForSelected=MountItems.GetItemsForMount(nodeId.PriKey); DocsInMount=Documents.GetDocumentsForMountItems(MountItemsForSelected); IdxSelectedInMount=-1;//No selection to start. ImagesCur=ImageStore.OpenImages(DocsInMount,PatFolder); MountSelected=Mounts.GetByNum(nodeId.PriKey); ImageRenderingNow=new Bitmap(MountSelected.Width,MountSelected.Height); ImageHelper.RenderMountImage(ImageRenderingNow,ImagesCur,MountItemsForSelected,DocsInMount,IdxSelectedInMount); EnableTreeItemTools(true,true,true,true,false,false,false,true,true,true,false,false,false,true); } else if(nodeId.NodeType==ImageNodeType.Amd) { EhrAmendment amd=EhrAmendments.GetOne(nodeId.PriKey); ImagesCur=ImageStore.OpenImagesAmd(amd); if(ImagesCur[0]==null) { if(ImageHelper.HasImageExtension(amd.FileName)) { MessageBox.Show(Lan.g(this,"File not found: ") + amd.FileName); } else if(Path.GetExtension(amd.FileName).ToLower()==".pdf") {//Adobe acrobat file. try { axAcroPDF1=new AxAcroPDFLib.AxAcroPDF(); this.Controls.Add(axAcroPDF1); axAcroPDF1.Visible=true; axAcroPDF1.Size=pictureBoxMain.Size; axAcroPDF1.Location=pictureBoxMain.Location; axAcroPDF1.OnError+=new EventHandler(pdfFileError); string pdfFilePath=ODFileUtils.CombinePaths(ImageStore.GetAmdFolder(),amd.FileName); if(!File.Exists(pdfFilePath)) { MessageBox.Show(Lan.g(this,"File not found: ") + amd.FileName); } else { axAcroPDF1.LoadFile(pdfFilePath);//The return status of this function doesn't seem to be helpful. pictureBoxMain.Visible=false; } } catch { //An exception can happen if they do not have Adobe Acrobat Reader version 8.0 or later installed. //Simply ignore this exception and do nothing. We never used to display .pdf files anyway, so we //essentially revert back to the old behavior in this case. } } //return;? } EnableTreeItemTools(pictureBoxMain.Visible,true,true,pictureBoxMain.Visible,true,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible, pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible,pictureBoxMain.Visible); } if(nodeId.NodeType==ImageNodeType.Doc || nodeId.NodeType==ImageNodeType.Mount || nodeId.NodeType==ImageNodeType.Eob || nodeId.NodeType==ImageNodeType.Amd) { WidthsImagesCur=new int[ImagesCur.Length]; HeightsImagesCur=new int[ImagesCur.Length]; for(int i=0;i<ImagesCur.Length;i++) { if(ImagesCur[i]!=null) { WidthsImagesCur[i]=ImagesCur[i].Width; HeightsImagesCur[i]=ImagesCur[i].Height; } } //Adjust visibility of panel note control based on if the new document has a signature. SetPanelNoteVisibility(DocSelected); //Resize controls in our window to adjust for a possible change in the visibility of the panel note control. ResizeAll(); //Refresh the signature and note in case the last document also had a signature. FillSignature(); } if(nodeId.NodeType==ImageNodeType.Mount) { ReloadZoomTransCrop(ImageRenderingNow.Width,ImageRenderingNow.Height,new Document(), new Rectangle(0,0,pictureBoxMain.Width,pictureBoxMain.Height),out ZoomImage, out ZoomLevel,out ZoomOverall,out PointTranslation); RenderCurrentImage(new Document(),ImageRenderingNow.Width,ImageRenderingNow.Height,ZoomImage,PointTranslation); } if(nodeId.NodeType==ImageNodeType.Doc || nodeId.NodeType==ImageNodeType.Eob || nodeId.NodeType==ImageNodeType.Amd) { //Render the initial image within the current bounds of the picturebox (if the document is an image). InvalidateSettings(ImageSettingFlags.ALL,true); } }
///<summary>Takes in a mount object and finds all the images pertaining to the mount, then concatonates them together into one large, unscaled image and returns that image. For use in other modules.</summary> public Bitmap CreateMountImage(Mount mount) { List<MountItem> mountItems=MountItems.GetItemsForMount(mount.MountNum); Document[] documents=Documents.GetDocumentsForMountItems(mountItems); Bitmap[] originalImages=ImageStore.OpenImages(documents,PatFolder); Bitmap mountImage=new Bitmap(mount.Width,mount.Height); ImageHelper.RenderMountImage(mountImage,originalImages,mountItems,documents,-1); return mountImage; }
///<summary>Handles a change in selection of the xRay capture button.</summary> private void ToolBarCapture_Click() { if(treeDocuments.SelectedNode==null) { return; } if(ToolBarMain.Buttons["Capture"].Pushed) { ImageNodeId nodeId=(ImageNodeId)treeDocuments.SelectedNode.Tag; //ComputerPref computerPrefs=ComputerPrefs.GetForLocalComputer(); xRayImageController.SensorType=ComputerPrefs.LocalComputer.SensorType; xRayImageController.PortNumber=ComputerPrefs.LocalComputer.SensorPort; xRayImageController.Binned=ComputerPrefs.LocalComputer.SensorBinned; xRayImageController.ExposureLevel=ComputerPrefs.LocalComputer.SensorExposure; if(nodeId.NodeType!=ImageNodeType.Mount) {//No mount is currently selected. //Show the user that they are performing an image capture by generating a new mount. Mount mount=new Mount(); mount.DateCreated=DateTimeOD.Today; mount.Description="unnamed capture"; mount.DocCategory=GetCurrentCategory(); mount.ImgType=ImageType.Mount; mount.PatNum=PatCur.PatNum; int border=Math.Max(xRayImageController.SensorSize.Width,xRayImageController.SensorSize.Height)/24; mount.Width=4*xRayImageController.SensorSize.Width+5*border; mount.Height=xRayImageController.SensorSize.Height+2*border; mount.MountNum=Mounts.Insert(mount); MountItem mountItem=new MountItem(); mountItem.MountNum=mount.MountNum; mountItem.Width=xRayImageController.SensorSize.Width; mountItem.Height=xRayImageController.SensorSize.Height; mountItem.Ypos=border; mountItem.OrdinalPos=1; mountItem.Xpos=border; MountItems.Insert(mountItem); mountItem.OrdinalPos=0; mountItem.Xpos=mountItem.Width+2*border; MountItems.Insert(mountItem); mountItem.OrdinalPos=2; mountItem.Xpos=2*mountItem.Width+3*border; MountItems.Insert(mountItem); mountItem.OrdinalPos=3; mountItem.Xpos=3*mountItem.Width+4*border; MountItems.Insert(mountItem); FillDocList(false); SelectTreeNode(GetNodeById(MakeIdMount(mount.MountNum))); sliderBrightnessContrast.MinVal=PrefC.GetInt(PrefName.ImageWindowingMin); sliderBrightnessContrast.MaxVal=PrefC.GetInt(PrefName.ImageWindowingMax); } else if(nodeId.NodeType==ImageNodeType.Mount) {//A mount is currently selected. We must allow the user to insert new images into partially complete mounts. //Clear the visible selection so that the user will know when the device is ready for xray exposure. ImageHelper.RenderMountFrames(ImageRenderingNow,MountItemsForSelected,-1); RenderCurrentImage(new Document(),ImageRenderingNow.Width,ImageRenderingNow.Height,ZoomImage*ZoomOverall,PointTranslation); } //Here we can only allow access to the capture button during a capture, because it is too complicated and hard for a //user to follow what is going on if they use the other tools when a capture is taking place. EnableAllTools(false); ToolBarMain.Buttons["Capture"].Enabled=true; ToolBarMain.Invalidate(); xRayImageController.CaptureXRay(); } else {//The user unselected the image capture button, so cancel the current image capture. xRayImageController.KillXRayThread();//Stop current xRay capture and call OnCaptureFinalize() when done. } }
///<summary>Takes in a mount object and finds all the images pertaining to the mount, then combines them together into one large, unscaled image and returns that image. For use in other modules.</summary> public static Bitmap GetMountImage(Mount mount,string patFolder) { //string patFolder=GetPatientFolder(pat); List<MountItem> mountItems = MountItems.GetItemsForMount(mount.MountNum); Document[] documents = Documents.GetDocumentsForMountItems(mountItems); Bitmap[] originalImages = OpenImages(documents,patFolder); Bitmap mountImage = new Bitmap(mount.Width,mount.Height); ImageHelper.RenderMountImage(mountImage,originalImages,mountItems,documents,-1); return mountImage; }
public static void Delete(Mount mount) { string command = "DELETE FROM mount WHERE MountNum='" + POut.PInt(mount.MountNum) + "'"; General2.NonQEx(command); }