Ejemplo n.º 1
0
        ///<summary>Inserts one HL7ProcAttach into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(HL7ProcAttach hL7ProcAttach, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                hL7ProcAttach.HL7ProcAttachNum = ReplicationServers.GetKey("hl7procattach", "HL7ProcAttachNum");
            }
            string command = "INSERT INTO hl7procattach (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "HL7ProcAttachNum,";
            }
            command += "HL7MsgNum,ProcNum) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(hL7ProcAttach.HL7ProcAttachNum) + ",";
            }
            command +=
                POut.Long(hL7ProcAttach.HL7MsgNum) + ","
                + POut.Long(hL7ProcAttach.ProcNum) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                hL7ProcAttach.HL7ProcAttachNum = Db.NonQ(command, true, "HL7ProcAttachNum", "hL7ProcAttach");
            }
            return(hL7ProcAttach.HL7ProcAttachNum);
        }
Ejemplo n.º 2
0
        ///<summary>Updates one HL7ProcAttach in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(HL7ProcAttach hL7ProcAttach, HL7ProcAttach oldHL7ProcAttach)
        {
            string command = "";

            if (hL7ProcAttach.HL7MsgNum != oldHL7ProcAttach.HL7MsgNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HL7MsgNum = " + POut.Long(hL7ProcAttach.HL7MsgNum) + "";
            }
            if (hL7ProcAttach.ProcNum != oldHL7ProcAttach.ProcNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNum = " + POut.Long(hL7ProcAttach.ProcNum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE hl7procattach SET " + command
                      + " WHERE HL7ProcAttachNum = " + POut.Long(hL7ProcAttach.HL7ProcAttachNum);
            Db.NonQ(command);
            return(true);
        }
Ejemplo n.º 3
0
        ///<summary>Inserts one HL7ProcAttach into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(HL7ProcAttach hL7ProcAttach, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO hl7procattach (";

            if (!useExistingPK && isRandomKeys)
            {
                hL7ProcAttach.HL7ProcAttachNum = ReplicationServers.GetKeyNoCache("hl7procattach", "HL7ProcAttachNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "HL7ProcAttachNum,";
            }
            command += "HL7MsgNum,ProcNum) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(hL7ProcAttach.HL7ProcAttachNum) + ",";
            }
            command +=
                POut.Long(hL7ProcAttach.HL7MsgNum) + ","
                + POut.Long(hL7ProcAttach.ProcNum) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                hL7ProcAttach.HL7ProcAttachNum = Db.NonQ(command, true, "HL7ProcAttachNum", "hL7ProcAttach");
            }
            return(hL7ProcAttach.HL7ProcAttachNum);
        }
Ejemplo n.º 4
0
        //OD accepts commandline arguments from eCW.  That's handled in FormOpenDental.

        //public static void SendHL7(Appointment apt,Patient pat) {
        //  OpenDentBusiness.HL7.DFT dft=new OpenDentBusiness.HL7.DFT(apt,pat);
        //  HL7Msg msg=new HL7Msg();
        //  msg.AptNum=apt.AptNum;
        //  msg.HL7Status=HL7MessageStatus.OutPending;//it will be marked outSent by the HL7 service.
        //  msg.MsgText=dft.GenerateMessage();
        //  HL7Msgs.Insert(msg);
        //}

        public static void SendHL7(long aptNum, long provNum, Patient pat, string pdfDataBase64, string pdfDescription, bool justPDF, List <Procedure> listProcs)
        {
            OpenDentBusiness.HL7.EcwDFT dft = new OpenDentBusiness.HL7.EcwDFT();
            dft.InitializeEcw(aptNum, provNum, pat, pdfDataBase64, pdfDescription, justPDF, listProcs);
            HL7Msg msg = new HL7Msg();

            if (justPDF)
            {
                msg.AptNum = 0;              //Prevents the appt complete button from changing to the "Revise" button prematurely.
            }
            else
            {
                msg.AptNum = aptNum;
            }
            msg.HL7Status = HL7MessageStatus.OutPending;          //it will be marked outSent by the HL7 service.
            msg.MsgText   = dft.GenerateMessage();
            msg.PatNum    = pat.PatNum;
            HL7ProcAttach hl7ProcAttach = new HL7ProcAttach();

            hl7ProcAttach.HL7MsgNum = HL7Msgs.Insert(msg);
            if (listProcs != null)
            {
                foreach (Procedure proc in listProcs)
                {
                    hl7ProcAttach.ProcNum = proc.ProcNum;
                    HL7ProcAttaches.Insert(hl7ProcAttach);
                }
            }
        }
Ejemplo n.º 5
0
 ///<summary>Inserts one HL7ProcAttach into the database.  Returns the new priKey.</summary>
 public static long Insert(HL7ProcAttach hL7ProcAttach)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         hL7ProcAttach.HL7ProcAttachNum = DbHelper.GetNextOracleKey("hl7procattach", "HL7ProcAttachNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(hL7ProcAttach, true));
             }
             catch (Oracle.ManagedDataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     hL7ProcAttach.HL7ProcAttachNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(hL7ProcAttach, false));
     }
 }
Ejemplo n.º 6
0
        ///<summary>Updates one HL7ProcAttach in the database.</summary>
        public static void Update(HL7ProcAttach hL7ProcAttach)
        {
            string command = "UPDATE hl7procattach SET "
                             + "HL7MsgNum       =  " + POut.Long(hL7ProcAttach.HL7MsgNum) + ", "
                             + "ProcNum         =  " + POut.Long(hL7ProcAttach.ProcNum) + " "
                             + "WHERE HL7ProcAttachNum = " + POut.Long(hL7ProcAttach.HL7ProcAttachNum);

            Db.NonQ(command);
        }
Ejemplo n.º 7
0
 ///<summary>Returns true if Update(HL7ProcAttach,HL7ProcAttach) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(HL7ProcAttach hL7ProcAttach, HL7ProcAttach oldHL7ProcAttach)
 {
     if (hL7ProcAttach.HL7MsgNum != oldHL7ProcAttach.HL7MsgNum)
     {
         return(true);
     }
     if (hL7ProcAttach.ProcNum != oldHL7ProcAttach.ProcNum)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 8
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <HL7ProcAttach> TableToList(DataTable table)
        {
            List <HL7ProcAttach> retVal = new List <HL7ProcAttach>();
            HL7ProcAttach        hL7ProcAttach;

            foreach (DataRow row in table.Rows)
            {
                hL7ProcAttach = new HL7ProcAttach();
                hL7ProcAttach.HL7ProcAttachNum = PIn.Long(row["HL7ProcAttachNum"].ToString());
                hL7ProcAttach.HL7MsgNum        = PIn.Long(row["HL7MsgNum"].ToString());
                hL7ProcAttach.ProcNum          = PIn.Long(row["ProcNum"].ToString());
                retVal.Add(hL7ProcAttach);
            }
            return(retVal);
        }
Ejemplo n.º 9
0
 ///<summary>Inserts one HL7ProcAttach into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(HL7ProcAttach hL7ProcAttach)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(hL7ProcAttach, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             hL7ProcAttach.HL7ProcAttachNum = DbHelper.GetNextOracleKey("hl7procattach", "HL7ProcAttachNum");                  //Cacheless method
         }
         return(InsertNoCache(hL7ProcAttach, true));
     }
 }
Ejemplo n.º 10
0
 ///<summary>Inserts one HL7ProcAttach into the database.  Returns the new priKey.</summary>
 public static long Insert(HL7ProcAttach hL7ProcAttach)
 {
     return(Insert(hL7ProcAttach, false));
 }