Ejemplo n.º 1
0
        /// <summary></summary>
        public static EobAttach ImportEobAttach(string pathImportFrom, long claimPaymentNum)
        {
            string eobFolder = "";

            if (PrefC.UsingAtoZfolder)
            {
                eobFolder = GetEobFolder();
            }
            EobAttach eob = new EobAttach();

            if (Path.GetExtension(pathImportFrom) == "")           //If the file has no extension
            {
                eob.FileName = ".jpg";
            }
            else
            {
                eob.FileName = Path.GetExtension(pathImportFrom);
            }
            eob.DateTCreated    = File.GetLastWriteTime(pathImportFrom);
            eob.ClaimPaymentNum = claimPaymentNum;
            EobAttaches.Insert(eob);            //creates filename and saves to db
            eob = EobAttaches.GetOne(eob.EobAttachNum);
            try {
                SaveEobAttach(eob, pathImportFrom, eobFolder);
                if (PrefC.UsingAtoZfolder)
                {
                    EobAttaches.Update(eob);
                }
            }
            catch {
                EobAttaches.Delete(eob.EobAttachNum);
                throw;
            }
            return(eob);
        }
Ejemplo n.º 2
0
		///<summary></summary>
		public static void Update(EobAttach eobAttach) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),eobAttach);
				return;
			}
			Crud.EobAttachCrud.Update(eobAttach);
		}
Ejemplo n.º 3
0
 ///<summary></summary>
 public static void Update(EobAttach eobAttach)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), eobAttach);
         return;
     }
     Crud.EobAttachCrud.Update(eobAttach);
 }
Ejemplo n.º 4
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 SaveEobAttach(EobAttach eob, string pathSourceFile, string eobFolder)
 {
     if (PrefC.UsingAtoZfolder)
     {
         File.Copy(pathSourceFile, ODFileUtils.CombinePaths(eobFolder, eob.FileName));
     }
     else              //saving to db
     {
         byte[] rawData = File.ReadAllBytes(pathSourceFile);
         eob.RawBase64 = Convert.ToBase64String(rawData);
     }
 }
Ejemplo n.º 5
0
		///<summary>Set the extension before calling.  Inserts a new eobattach into db, creates a filename based on EobAttachNum, and then updates the db with this filename.  Should always refresh the eobattach after calling this method in order to get the correct filename for RemotingRole.ClientWeb.</summary>
		public static long Insert(EobAttach eobAttach) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				eobAttach.EobAttachNum=Meth.GetLong(MethodBase.GetCurrentMethod(),eobAttach);
				return eobAttach.EobAttachNum;
			}
			eobAttach.EobAttachNum=Crud.EobAttachCrud.Insert(eobAttach);
			//If the current filename is just an extension, then assign it a unique name.
			if(eobAttach.FileName==Path.GetExtension(eobAttach.FileName)) {
				string extension=eobAttach.FileName;
				eobAttach.FileName=DateTime.Now.ToString("yyyyMMdd_HHmmss_")+eobAttach.EobAttachNum.ToString()+extension;
				Update(eobAttach);
			}
			return eobAttach.EobAttachNum;
		}
Ejemplo n.º 6
0
 ///<summary>If usingAtoZfoler, 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 SaveEobAttach(EobAttach eob, Bitmap image, ImageCodecInfo codec, EncoderParameters encoderParameters, string eobFolder)
 {
     if (PrefC.UsingAtoZfolder)
     {
         image.Save(ODFileUtils.CombinePaths(eobFolder, eob.FileName), codec, encoderParameters);
     }
     else              //saving to db
     {
         using (MemoryStream stream = new MemoryStream()) {
             image.Save(stream, codec, encoderParameters);
             byte[] rawData = stream.ToArray();
             eob.RawBase64 = Convert.ToBase64String(rawData);
         }
     }
 }
Ejemplo n.º 7
0
 ///<summary>Also handles deletion of db object.</summary>
 public static void DeleteEobAttach(EobAttach eob)
 {
     if(PrefC.UsingAtoZfolder) {
         string eobFolder=GetEobFolder();
         string filePath=ODFileUtils.CombinePaths(eobFolder,eob.FileName);
         if(File.Exists(filePath)) {
             try {
                 File.Delete(filePath);
             }
             catch { }//file seems to be frequently locked.
         }
     }
     //db
     EobAttaches.Delete(eob.EobAttachNum);
 }
Ejemplo n.º 8
0
 ///<summary>Also handles deletion of db object.</summary>
 public static void DeleteEobAttach(EobAttach eob)
 {
     if (PrefC.UsingAtoZfolder)
     {
         string eobFolder = GetEobFolder();
         string filePath  = ODFileUtils.CombinePaths(eobFolder, eob.FileName);
         if (File.Exists(filePath))
         {
             try {
                 File.Delete(filePath);
             }
             catch { }                    //file seems to be frequently locked.
         }
     }
     //db
     EobAttaches.Delete(eob.EobAttachNum);
 }
Ejemplo n.º 9
0
        /// <summary>Saves to either AtoZ folder or to db.  Saves image as a jpg.  Compression will be according to user setting.</summary>
        public static EobAttach ImportEobAttach(Bitmap image, long claimPaymentNum)
        {
            string eobFolder = "";

            if (PrefC.UsingAtoZfolder)
            {
                eobFolder = GetEobFolder();
            }
            EobAttach eob = new EobAttach();

            eob.FileName        = ".jpg";
            eob.DateTCreated    = DateTime.Now;
            eob.ClaimPaymentNum = claimPaymentNum;
            EobAttaches.Insert(eob);            //creates filename and saves to db
            eob = EobAttaches.GetOne(eob.EobAttachNum);
            long           qualityL = PrefC.GetLong(PrefName.ScannerCompression);
            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 {
                SaveEobAttach(eob, image, myImageCodecInfo, myEncoderParameters, eobFolder);
                if (!PrefC.UsingAtoZfolder)
                {
                    EobAttaches.Update(eob);                    //because SaveEobAttach stuck the image in eob.RawBase64.
                    //no thumbnail
                }
            }
            catch {
                EobAttaches.Delete(eob.EobAttachNum);
                throw;
            }
            return(eob);
        }
Ejemplo n.º 10
0
 ///<summary>Set the extension before calling.  Inserts a new eobattach into db, creates a filename based on EobAttachNum, and then updates the db with this filename.  Should always refresh the eobattach after calling this method in order to get the correct filename for RemotingRole.ClientWeb.</summary>
 public static long Insert(EobAttach eobAttach)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         eobAttach.EobAttachNum = Meth.GetLong(MethodBase.GetCurrentMethod(), eobAttach);
         return(eobAttach.EobAttachNum);
     }
     eobAttach.EobAttachNum = Crud.EobAttachCrud.Insert(eobAttach);
     //If the current filename is just an extension, then assign it a unique name.
     if (eobAttach.FileName == Path.GetExtension(eobAttach.FileName))
     {
         string extension = eobAttach.FileName;
         eobAttach.FileName = DateTime.Now.ToString("yyyyMMdd_HHmmss_") + eobAttach.EobAttachNum.ToString() + extension;
         Update(eobAttach);
     }
     return(eobAttach.EobAttachNum);
 }
Ejemplo n.º 11
0
 ///<summary> Save an Eob to another location on the disk (outside of Open Dental). </summary>
 public static void ExportEobAttach(string saveToPath, EobAttach eob)
 {
     if (PrefC.UsingAtoZfolder)
     {
         string eobFolder = GetEobFolder();
         File.Copy(ODFileUtils.CombinePaths(eobFolder, eob.FileName), saveToPath);
     }
     else              //image is in database
     {
         byte[] rawData = Convert.FromBase64String(eob.RawBase64);
         Image  image   = null;
         using (MemoryStream stream = new MemoryStream()) {
             stream.Read(rawData, 0, rawData.Length);
             image = Image.FromStream(stream);
         }
         image.Save(saveToPath);
     }
 }
Ejemplo n.º 12
0
 public static Bitmap[] OpenImagesEob(EobAttach eob)
 {
     Bitmap[] values = new Bitmap[1];
     if (PrefC.UsingAtoZfolder)
     {
         string eobFolder   = GetEobFolder();
         string srcFileName = ODFileUtils.CombinePaths(eobFolder, eob.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(eob.FileName))
         {
             values[0] = PIn.Bitmap(eob.RawBase64);
         }
         else
         {
             values[0] = null;
         }
     }
     return(values);
 }
Ejemplo n.º 13
0
		///<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 SaveEobAttach(EobAttach eob,string pathSourceFile,string eobFolder) {
			if(PrefC.AtoZfolderUsed) {
				File.Copy(pathSourceFile,ODFileUtils.CombinePaths(eobFolder,eob.FileName));
			}
			else {//saving to db
				byte[] rawData=File.ReadAllBytes(pathSourceFile);
				eob.RawBase64=Convert.ToBase64String(rawData);
			}
			//No security log for creation of EOB because they don't show up in the images module
		}
Ejemplo n.º 14
0
		///<summary>If usingAtoZfolder, 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 SaveEobAttach(EobAttach eob,string pathSourceFile,string eobFolder) {
			if(PrefC.AtoZfolderUsed) {
				File.Copy(pathSourceFile,ODFileUtils.CombinePaths(eobFolder,eob.FileName));
			}
			else {//saving to db
				byte[] rawData=File.ReadAllBytes(pathSourceFile);
				eob.RawBase64=Convert.ToBase64String(rawData);
			}
		}
Ejemplo n.º 15
0
		///<summary>If usingAtoZfoler, 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 SaveEobAttach(EobAttach eob,Bitmap image,ImageCodecInfo codec,EncoderParameters encoderParameters,string eobFolder) {
			if(PrefC.AtoZfolderUsed) {
				image.Save(ODFileUtils.CombinePaths(eobFolder,eob.FileName),codec,encoderParameters);
			}
			else {//saving to db
				using(MemoryStream stream=new MemoryStream()) {
					image.Save(stream,codec,encoderParameters);
					byte[] rawData=stream.ToArray();
					eob.RawBase64=Convert.ToBase64String(rawData);
				}
			}
		}
Ejemplo n.º 16
0
		///<summary> Save an Eob to another location on the disk (outside of Open Dental). </summary>
		public static void ExportEobAttach(string saveToPath,EobAttach eob) {
			if(PrefC.AtoZfolderUsed) {
				string eobFolder=GetEobFolder();
				File.Copy(ODFileUtils.CombinePaths(eobFolder,eob.FileName),saveToPath);
			}
			else {//image is in database
				byte[] rawData=Convert.FromBase64String(eob.RawBase64);
				Image image=null;
				using(MemoryStream stream=new MemoryStream()) {
					stream.Read(rawData,0,rawData.Length);
					image=Image.FromStream(stream);
				}
				image.Save(saveToPath);
			}
		}
Ejemplo n.º 17
0
		/// <summary></summary>
		public static EobAttach ImportEobAttach(string pathImportFrom,long claimPaymentNum) {
			string eobFolder="";
			if(PrefC.AtoZfolderUsed) {
				eobFolder=GetEobFolder();
			}
			EobAttach eob=new EobAttach();
			if(Path.GetExtension(pathImportFrom)=="") {//If the file has no extension
				eob.FileName=".jpg";
			}
			else {
				eob.FileName=Path.GetExtension(pathImportFrom);
			}
			eob.DateTCreated=File.GetLastWriteTime(pathImportFrom);
			eob.ClaimPaymentNum=claimPaymentNum;
			EobAttaches.Insert(eob);//creates filename and saves to db
			eob=EobAttaches.GetOne(eob.EobAttachNum);
			try {
				SaveEobAttach(eob,pathImportFrom,eobFolder);
				if(PrefC.AtoZfolderUsed) {
					EobAttaches.Update(eob);
				}
			}
			catch {
				EobAttaches.Delete(eob.EobAttachNum);
				throw;
			}
			return eob;
		}
Ejemplo n.º 18
0
		/// <summary>Saves to either AtoZ folder or to db.  Saves image as a jpg.  Compression will be according to user setting.</summary>
		public static EobAttach ImportEobAttach(Bitmap image,long claimPaymentNum) {
			string eobFolder="";
			if(PrefC.AtoZfolderUsed) {
				eobFolder=GetEobFolder();
			}
			EobAttach eob=new EobAttach();
			eob.FileName=".jpg";
			eob.DateTCreated = DateTime.Now;
			eob.ClaimPaymentNum=claimPaymentNum;
			EobAttaches.Insert(eob);//creates filename and saves to db
			eob=EobAttaches.GetOne(eob.EobAttachNum);
			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 {
				SaveEobAttach(eob,image,myImageCodecInfo,myEncoderParameters,eobFolder);
				if(!PrefC.AtoZfolderUsed) {
					EobAttaches.Update(eob);//because SaveEobAttach stuck the image in EobAttach.RawBase64.
					//no thumbnail
				}
			}
			catch {
				EobAttaches.Delete(eob.EobAttachNum);
				throw;
			}
			return eob;
		}
Ejemplo n.º 19
0
		public static Bitmap[] OpenImagesEob(EobAttach eob) {
			Bitmap[] values = new Bitmap[1];
			if(PrefC.AtoZfolderUsed) {
				string eobFolder=GetEobFolder();
				string srcFileName = ODFileUtils.CombinePaths(eobFolder,eob.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(eob.FileName)) {
					values[0]= PIn.Bitmap(eob.RawBase64);
				}
				else {
					values[0]= null;
				}
			}
			return values;
		}
Ejemplo n.º 20
0
		///<summary>Also handles deletion of db object.</summary>
		public static void DeleteEobAttach(EobAttach eob) {
			if(PrefC.AtoZfolderUsed) {
				string eobFolder=GetEobFolder();
				string filePath=ODFileUtils.CombinePaths(eobFolder,eob.FileName);
				if(File.Exists(filePath)) {
					try {
						File.Delete(filePath);
						//No security log for deletion of EOB's because they don't show up in the images module.
					}
					catch { }//file seems to be frequently locked.
				}
			}
			//db
			EobAttaches.Delete(eob.EobAttachNum);
		}