コード例 #1
0
ファイル: ImageStore.cs プロジェクト: steev90/opendental
        public static EhrAmendment ImportAmdAttach(string pathImportFrom, EhrAmendment amd)
        {
            string amdFolder   = "";
            string amdFilename = "";

            if (PrefC.AtoZfolderUsed)
            {
                amdFolder   = GetAmdFolder();
                amdFilename = amd.FileName;
            }
            amd.FileName = DateTime.Now.ToString("yyyyMMdd_HHmmss_") + amd.EhrAmendmentNum + Path.GetExtension(pathImportFrom);
            if (Path.GetExtension(pathImportFrom) == "")           //If the file has no extension
            {
                amd.FileName += ".jpg";
            }
            //EhrAmendments.Update(amd);
            //amd=EhrAmendments.GetOne(amd.EhrAmendmentNum);
            try {
                SaveAmdAttach(amd, pathImportFrom, amdFolder);
            }
            catch {
                //EhrAmendments.Delete(amd.EhrAmendmentNum);
                throw;
            }
            if (PrefC.AtoZfolderUsed)
            {
                amd.DateTAppend = DateTime.Now;
                EhrAmendments.Update(amd);
                CleanAmdAttach(amdFilename);
            }
            return(amd);
        }
コード例 #2
0
ファイル: EhrAmendments.cs プロジェクト: mnisl/OD
		///<summary></summary>
		public static long Insert(EhrAmendment ehrAmendment){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				ehrAmendment.EhrAmendmentNum=Meth.GetLong(MethodBase.GetCurrentMethod(),ehrAmendment);
				return ehrAmendment.EhrAmendmentNum;
			}
			return Crud.EhrAmendmentCrud.Insert(ehrAmendment);
		}
コード例 #3
0
ファイル: EhrAmendments.cs プロジェクト: mnisl/OD
		///<summary></summary>
		public static void Update(EhrAmendment ehrAmendment){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				Meth.GetVoid(MethodBase.GetCurrentMethod(),ehrAmendment);
				return;
			}
			Crud.EhrAmendmentCrud.Update(ehrAmendment);
		}
コード例 #4
0
ファイル: EhrAmendments.cs プロジェクト: steev90/opendental
 ///<summary></summary>
 public static long Insert(EhrAmendment ehrAmendment)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         ehrAmendment.EhrAmendmentNum = Meth.GetLong(MethodBase.GetCurrentMethod(), ehrAmendment);
         return(ehrAmendment.EhrAmendmentNum);
     }
     return(Crud.EhrAmendmentCrud.Insert(ehrAmendment));
 }
コード例 #5
0
ファイル: FormEhrAmendments.cs プロジェクト: mnisl/OD
		private void butAdd_Click(object sender,EventArgs e) {
			EhrAmendment ehrAmd=new EhrAmendment();
			ehrAmd.PatNum=PatCur.PatNum;
			ehrAmd.IsNew=true;
			EhrAmendments.Insert(ehrAmd);
			FormEhrAmendmentEdit FormEAE=new FormEhrAmendmentEdit(ehrAmd);
			FormEAE.ShowDialog();
			FillGrid();//Always have to refresh grid due to using the images module to update the db.
		}
コード例 #6
0
ファイル: EhrAmendments.cs プロジェクト: steev90/opendental
 ///<summary></summary>
 public static void Update(EhrAmendment ehrAmendment)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), ehrAmendment);
         return;
     }
     Crud.EhrAmendmentCrud.Update(ehrAmendment);
 }
コード例 #7
0
ファイル: ImageStore.cs プロジェクト: steev90/opendental
 ///<summary>If usingAtoZfoler, then eobFolder must be fully qualified and valid.  If not usingAtoZ folder, this fills the eob.RawBase64 which must then be updated to db.</summary>
 public static void SaveAmdAttach(EhrAmendment amd, string pathSourceFile, string amdFolder)
 {
     if (PrefC.AtoZfolderUsed)
     {
         File.Copy(pathSourceFile, ODFileUtils.CombinePaths(amdFolder, amd.FileName));
     }
     else              //saving to db
     {
         byte[] rawData = File.ReadAllBytes(pathSourceFile);
         amd.RawBase64 = Convert.ToBase64String(rawData);
         EhrAmendments.Update(amd);
     }
 }
コード例 #8
0
ファイル: ImageStore.cs プロジェクト: steev90/opendental
 ///<summary>If usingAtoZfolder, then patFolder must be fully qualified and valid.  If not usingAtoZ folder, this fills the eob.RawBase64 which must then be updated to db.</summary>
 public static void SaveAmdAttach(EhrAmendment amd, Bitmap image, ImageCodecInfo codec, EncoderParameters encoderParameters, string amdFolder)
 {
     if (PrefC.AtoZfolderUsed)
     {
         image.Save(ODFileUtils.CombinePaths(amdFolder, amd.FileName), codec, encoderParameters);
     }
     else              //saving to db
     {
         using (MemoryStream stream = new MemoryStream()) {
             image.Save(stream, codec, encoderParameters);
             byte[] rawData = stream.ToArray();
             amd.RawBase64 = Convert.ToBase64String(rawData);
             EhrAmendments.Update(amd);
         }
     }
 }
コード例 #9
0
ファイル: FormEhrAmendmentEdit.cs プロジェクト: mnisl/OD
		private void butScan_Click(object sender,EventArgs e) {
			FormImages FormI=new FormImages();
			EhrAmendment amendmentOld=EhrAmendmentCur;
			FormI.EhrAmendmentCur=EhrAmendmentCur;
			FormI.ShowDialog();
			EhrAmendmentCur=EhrAmendments.GetOne(EhrAmendmentCur.EhrAmendmentNum);
			if(EhrAmendmentCur.FileName!="") {
				labelScan.Visible=true;
				butScan.Text="View";
				textDateApp.Text=DateTime.Now.ToShortDateString()+" "+DateTime.Now.ToShortTimeString();
			}
			else {
				labelScan.Visible=false;
				butScan.Text="Scan";
				textDateApp.Text="";
			}
		}
コード例 #10
0
ファイル: ImageStore.cs プロジェクト: steev90/opendental
 ///<summary> Save an Eob to another location on the disk (outside of Open Dental). </summary>
 public static void ExportAmdAttach(string saveToPath, EhrAmendment amd)
 {
     if (PrefC.AtoZfolderUsed)
     {
         string amdFolder = GetAmdFolder();
         File.Copy(ODFileUtils.CombinePaths(amdFolder, amd.FileName), saveToPath);
     }
     else              //image is in database
     {
         byte[] rawData = Convert.FromBase64String(amd.RawBase64);
         Image  image   = null;
         using (MemoryStream stream = new MemoryStream()) {
             stream.Read(rawData, 0, rawData.Length);
             image = Image.FromStream(stream);
         }
         image.Save(saveToPath);
     }
 }
コード例 #11
0
ファイル: ImageStore.cs プロジェクト: steev90/opendental
        public static EhrAmendment ImportAmdAttach(Bitmap image, EhrAmendment amd)
        {
            string amdFolder = "";

            if (PrefC.AtoZfolderUsed)
            {
                amdFolder = GetAmdFolder();
            }
            amd.FileName    = DateTime.Now.ToString("yyyyMMdd_HHmmss_") + amd.EhrAmendmentNum;
            amd.FileName   += ".jpg";
            amd.DateTAppend = DateTime.Now;
            EhrAmendments.Update(amd);
            amd = EhrAmendments.GetOne(amd.EhrAmendmentNum);
            long           qualityL = (long)ComputerPrefs.LocalComputer.ScanDocQuality;
            ImageCodecInfo myImageCodecInfo;

            ImageCodecInfo[] encoders;
            encoders         = ImageCodecInfo.GetImageEncoders();
            myImageCodecInfo = null;
            for (int j = 0; j < encoders.Length; j++)
            {
                if (encoders[j].MimeType == "image/jpeg")
                {
                    myImageCodecInfo = encoders[j];
                }
            }
            EncoderParameters myEncoderParameters = new EncoderParameters(1);
            EncoderParameter  myEncoderParameter  = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, qualityL);

            myEncoderParameters.Param[0] = myEncoderParameter;
            try {
                SaveAmdAttach(amd, image, myImageCodecInfo, myEncoderParameters, amdFolder);
            }
            catch {
                //EhrAmendments.Delete(amd.EhrAmendmentNum);
                throw;
            }
            if (!PrefC.AtoZfolderUsed)
            {
                //EhrAmendments.Update(amd);
                //no thumbnail
            }
            return(amd);
        }
コード例 #12
0
ファイル: ImageStore.cs プロジェクト: steev90/opendental
 ///<summary>Also handles deletion of db object.</summary>
 public static void DeleteAmdAttach(EhrAmendment amendment)
 {
     if (PrefC.AtoZfolderUsed)
     {
         string amdFolder = GetAmdFolder();
         string filePath  = ODFileUtils.CombinePaths(amdFolder, amendment.FileName);
         if (File.Exists(filePath))
         {
             try {
                 File.Delete(filePath);
             }
             catch {
                 MessageBox.Show("Delete was unsuccessful. The file may be in use.");
                 return;
             }                    //file seems to be frequently locked.
         }
     }
     //db
     amendment.DateTAppend = DateTime.MinValue;
     amendment.FileName    = "";
     amendment.RawBase64   = "";
     EhrAmendments.Update(amendment);
 }
コード例 #13
0
ファイル: ImageStore.cs プロジェクト: steev90/opendental
 public static Bitmap[] OpenImagesAmd(EhrAmendment amd)
 {
     Bitmap[] values = new Bitmap[1];
     if (PrefC.AtoZfolderUsed)
     {
         string amdFolder   = GetAmdFolder();
         string srcFileName = ODFileUtils.CombinePaths(amdFolder, amd.FileName);
         if (HasImageExtension(srcFileName))
         {
             if (File.Exists(srcFileName))
             {
                 values[0] = new Bitmap(srcFileName);
             }
             else
             {
                 //throw new Exception();
                 values[0] = null;
             }
         }
         else
         {
             values[0] = null;
         }
     }
     else
     {
         if (HasImageExtension(amd.FileName))
         {
             values[0] = PIn.Bitmap(amd.RawBase64);
         }
         else
         {
             values[0] = null;
         }
     }
     return(values);
 }
コード例 #14
0
		///<summary>Also handles deletion of db object.</summary>
		public static void DeleteAmdAttach(EhrAmendment amendment) {
			if(PrefC.AtoZfolderUsed) {
				string amdFolder=GetAmdFolder();
				string filePath=ODFileUtils.CombinePaths(amdFolder,amendment.FileName);
				if(File.Exists(filePath)) {
					try {
						File.Delete(filePath);
					}
					catch {
						MessageBox.Show("Delete was unsuccessful. The file may be in use.");
						return;
					}//file seems to be frequently locked.
				}
			}
			//db
			amendment.DateTAppend=DateTime.MinValue;
			amendment.FileName="";
			amendment.RawBase64="";
			EhrAmendments.Update(amendment);
		}
コード例 #15
0
		///<summary>If usingAtoZfoler, then eobFolder must be fully qualified and valid.  If not usingAtoZ folder, this fills the eob.RawBase64 which must then be updated to db.</summary>
		public static void SaveAmdAttach(EhrAmendment amd,string pathSourceFile,string amdFolder) {
			if(PrefC.AtoZfolderUsed) {
				File.Copy(pathSourceFile,ODFileUtils.CombinePaths(amdFolder,amd.FileName));
			}
			else {//saving to db
				byte[] rawData=File.ReadAllBytes(pathSourceFile);
				amd.RawBase64=Convert.ToBase64String(rawData);
				EhrAmendments.Update(amd);
			}
		}
コード例 #16
0
		///<summary>If usingAtoZfolder, then patFolder must be fully qualified and valid.  If not usingAtoZ folder, this fills the eob.RawBase64 which must then be updated to db.</summary>
		public static void SaveAmdAttach(EhrAmendment amd,Bitmap image,ImageCodecInfo codec,EncoderParameters encoderParameters,string amdFolder) {
			if(PrefC.AtoZfolderUsed) {
				image.Save(ODFileUtils.CombinePaths(amdFolder,amd.FileName),codec,encoderParameters);
			}
			else {//saving to db
				using(MemoryStream stream=new MemoryStream()) {
					image.Save(stream,codec,encoderParameters);
					byte[] rawData=stream.ToArray();
					amd.RawBase64=Convert.ToBase64String(rawData);
					EhrAmendments.Update(amd);
				}
			}
		}
コード例 #17
0
		///<summary> Save an Eob to another location on the disk (outside of Open Dental). </summary>
		public static void ExportAmdAttach(string saveToPath,EhrAmendment amd) {
			if(PrefC.AtoZfolderUsed) {
				string amdFolder=GetAmdFolder();
				File.Copy(ODFileUtils.CombinePaths(amdFolder,amd.FileName),saveToPath);
			}
			else {//image is in database
				byte[] rawData=Convert.FromBase64String(amd.RawBase64);
				Image image=null;
				using(MemoryStream stream=new MemoryStream()) {
					stream.Read(rawData,0,rawData.Length);
					image=Image.FromStream(stream);
				}
				image.Save(saveToPath);
			}
		}
コード例 #18
0
		public static EhrAmendment ImportAmdAttach(string pathImportFrom,EhrAmendment amd) {
			string amdFolder="";
			string amdFilename="";
			if(PrefC.AtoZfolderUsed) {
				amdFolder=GetAmdFolder();
				amdFilename=amd.FileName;
			}
			amd.FileName=DateTime.Now.ToString("yyyyMMdd_HHmmss_")+amd.EhrAmendmentNum+Path.GetExtension(pathImportFrom);
			if(Path.GetExtension(pathImportFrom)=="") {//If the file has no extension
				amd.FileName+=".jpg";
			}
			//EhrAmendments.Update(amd);
			//amd=EhrAmendments.GetOne(amd.EhrAmendmentNum);
			try {
				SaveAmdAttach(amd,pathImportFrom,amdFolder);
			}
			catch {
				//EhrAmendments.Delete(amd.EhrAmendmentNum);
				throw;
			}
			if(PrefC.AtoZfolderUsed) {
				amd.DateTAppend=DateTime.Now;
				EhrAmendments.Update(amd);
				CleanAmdAttach(amdFilename);
			}
			return amd;
		}
コード例 #19
0
		public static EhrAmendment ImportAmdAttach(Bitmap image,EhrAmendment amd) {
			string amdFolder="";
			if(PrefC.AtoZfolderUsed) {
				amdFolder=GetAmdFolder();
			}
			amd.FileName=DateTime.Now.ToString("yyyyMMdd_HHmmss_")+amd.EhrAmendmentNum;
			amd.FileName+=".jpg";
			amd.DateTAppend=DateTime.Now;
			EhrAmendments.Update(amd);
			amd=EhrAmendments.GetOne(amd.EhrAmendmentNum);
			long qualityL=(long)ComputerPrefs.LocalComputer.ScanDocQuality;
			ImageCodecInfo myImageCodecInfo;
			ImageCodecInfo[] encoders;
			encoders = ImageCodecInfo.GetImageEncoders();
			myImageCodecInfo = null;
			for(int j = 0;j < encoders.Length;j++) {
				if(encoders[j].MimeType == "image/jpeg") {
					myImageCodecInfo = encoders[j];
				}
			}
			EncoderParameters myEncoderParameters = new EncoderParameters(1);
			EncoderParameter myEncoderParameter = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality,qualityL);
			myEncoderParameters.Param[0] = myEncoderParameter;
			try {
				SaveAmdAttach(amd,image,myImageCodecInfo,myEncoderParameters,amdFolder);
			}
			catch {
				//EhrAmendments.Delete(amd.EhrAmendmentNum);
				throw;
			}
			if(!PrefC.AtoZfolderUsed) {
				//EhrAmendments.Update(amd);
				//no thumbnail
			}
			return amd;
		}
コード例 #20
0
		public static Bitmap[] OpenImagesAmd(EhrAmendment amd) {
			Bitmap[] values = new Bitmap[1];
			if(PrefC.AtoZfolderUsed) {
				string amdFolder=GetAmdFolder();
				string srcFileName = ODFileUtils.CombinePaths(amdFolder,amd.FileName);
				if(HasImageExtension(srcFileName)) {
					if(File.Exists(srcFileName)) {
						values[0]=new Bitmap(srcFileName);
					}
					else {
						//throw new Exception();
						values[0]= null;
					}
				}
				else {
					values[0]= null;
				}
			}
			else {
				if(HasImageExtension(amd.FileName)) {
					values[0]= PIn.Bitmap(amd.RawBase64);
				}
				else {
					values[0]= null;
				}
			}
			return values;
		}
コード例 #21
0
ファイル: FormEhrAmendmentEdit.cs プロジェクト: mnisl/OD
		public FormEhrAmendmentEdit(EhrAmendment ehrAmdCur) {
			InitializeComponent();
			EhrAmendmentCur=ehrAmdCur;
		}
コード例 #22
0
		private void ToolBarImport_Click() {
			if(EhrAmendmentCur!=null) {
				if(EhrAmendmentCur.FileName!=null && EhrAmendmentCur.FileName!="") {
					if(!MsgBox.Show(this,true,"This will delete your old file. Proceed?")) {
						return;
					}
				}
			}
			OpenFileDialog openFileDialog=new OpenFileDialog();
			openFileDialog.Multiselect=false;
			if(openFileDialog.ShowDialog()!=DialogResult.OK) {
				return;
			}
			string[] fileNames=openFileDialog.FileNames;
			if(fileNames.Length<1) {
				return;
			}
			ImageNodeId nodeId=new ImageNodeId();
			bool copied=true;
			if(ClaimPaymentNum!=0) {//eob
				EobAttach eob=null;
				for(int i=0;i<fileNames.Length;i++) {
					try {
						eob=ImageStore.ImportEobAttach(fileNames[i],ClaimPaymentNum);
					}
					catch(Exception ex) {
						MessageBox.Show(Lan.g(this,"Unable to copy file, May be in use: ")+ex.Message+": "+openFileDialog.FileName);
						copied = false;
					}
				}
				if(copied) {
					FillDocList(false);
				}
				if(eob!=null) {
					SelectTreeNode(GetNodeById(MakeIdEob(eob.EobAttachNum)));
				}
			}
			else if(EhrAmendmentCur!=null) {
				string amdFilename=EhrAmendmentCur.FileName;
				for(int i=0;i<fileNames.Length;i++) {
					try {
						EhrAmendmentCur=ImageStore.ImportAmdAttach(fileNames[i],EhrAmendmentCur);
						SelectTreeNode(null);
						ImageStore.CleanAmdAttach(amdFilename);
					}
					catch(Exception ex) {
						MessageBox.Show(Lan.g(this,"Unable to copy file, May be in use: ")+ex.Message+": "+openFileDialog.FileName);
						copied = false;
					}
				}
				if(copied) {
					FillDocList(false);
				}
				if(EhrAmendmentCur!=null) {
					SelectTreeNode(GetNodeById(MakeIdAmd(EhrAmendmentCur.EhrAmendmentNum)));
				}
			}
			else {//regular Images module
				Document doc=null;
				for(int i=0;i<fileNames.Length;i++) {
					try {
						doc=ImageStore.Import(fileNames[i],GetCurrentCategory(),PatCur);
					}
					catch(Exception ex) {
						MessageBox.Show(Lan.g(this,"Unable to copy file, May be in use: ")+ex.Message+": "+openFileDialog.FileName);
						copied = false;
					}
					if(copied) {
						FillDocList(false);
						SelectTreeNode(GetNodeById(MakeIdDoc(doc.DocNum)));
						FormDocInfo FormD=new FormDocInfo(PatCur,doc,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(doc.DocNum);
							DocSelected=doc.Copy();
						}
					}
				}
				//Reselect the last successfully added node when necessary.
				if(doc!=null && !MakeIdDoc(doc.DocNum).Equals(nodeId)) {
					SelectTreeNode(GetNodeById(MakeIdDoc(doc.DocNum)));
				}
				FillDocList(true);
			}
		}
コード例 #23
0
		///<summary>This overload is for amendment images.  Loads the one image for this amendment.</summary>
		public void ModuleSelectedAmendment(EhrAmendment amendment) {
			EhrAmendmentCur=amendment;
			LayoutAmendmentToolBar();
			sliderBrightnessContrast.Visible=false;
			//ToolBarPaint.Location=new Point(pictureBoxMain.Left,ToolBarPaint.Top);//happens in ResizeAll().
			ResizeAll();
			//RefreshModuleData-----------------------------------------------------------------------
			SelectTreeNode(null);//Clear selection and image and reset visibilities.
			//PatFolder=ImageStore.GetPatientFolder(PatCur);//This is where the pat folder gets created if it does not yet exist.
			//RefreshModuleScreen---------------------------------------------------------------------
			EnableAllTools(true);
			EnableAllTreeItemTools(false);
			ToolBarMain.Invalidate();
			ToolBarPaint.Invalidate();
			FillDocList(false);
			if(treeDocuments.Nodes.Count>0) {
				SelectTreeNode(treeDocuments.Nodes[0]);
			}
		}
コード例 #24
0
ファイル: ImageStore.cs プロジェクト: mnisl/OD
		///<summary>If using AtoZfolder, then patFolder must be fully qualified and valid.  If not using AtoZfolder, this fills the eob.RawBase64 which must then be updated to db.</summary>
		public static void SaveAmdAttach(EhrAmendment amd,string pathSourceFile,string amdFolder) {
			if(PrefC.AtoZfolderUsed) {
				File.Copy(pathSourceFile,ODFileUtils.CombinePaths(amdFolder,amd.FileName));
			}
			else {//saving to db
				byte[] rawData=File.ReadAllBytes(pathSourceFile);
				amd.RawBase64=Convert.ToBase64String(rawData);
				EhrAmendments.Update(amd);
			}
			//No security log for creation of AMD Attaches because they don't show up in the images module
		}