예제 #1
0
        ///<summary>Updates one Signalod in the database.</summary>
        public static void Update(Signalod signalod)
        {
            string command = "UPDATE signalod SET "
                             + "DateViewing=  " + POut.Date(signalod.DateViewing) + ", "
                             + "SigDateTime=  " + POut.DateT(signalod.SigDateTime) + ", "
                             + "FKey       =  " + POut.Long(signalod.FKey) + ", "
                             + "FKeyType   = '" + POut.String(signalod.FKeyType.ToString()) + "', "
                             + "IType      =  " + POut.Int((int)signalod.IType) + ", "
                             + "RemoteRole =  " + POut.Int((int)signalod.RemoteRole) + ", "
                             + "MsgValue   =  " + DbHelper.ParamChar + "paramMsgValue "
                             + "WHERE SignalNum = " + POut.Long(signalod.SignalNum);

            if (signalod.MsgValue == null)
            {
                signalod.MsgValue = "";
            }
            OdSqlParameter paramMsgValue = new OdSqlParameter("paramMsgValue", OdDbType.Text, POut.StringParam(signalod.MsgValue));

            Db.NonQ(command, paramMsgValue);
        }
예제 #2
0
        ///<summary>Updates one LabResult 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.</summary>
        public static void Update(LabResult labResult, LabResult oldLabResult)
        {
            string command = "";

            if (labResult.LabPanelNum != oldLabResult.LabPanelNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LabPanelNum = " + POut.Long(labResult.LabPanelNum) + "";
            }
            if (labResult.DateTimeTest != oldLabResult.DateTimeTest)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTimeTest = " + POut.DateT(labResult.DateTimeTest) + "";
            }
            if (labResult.TestName != oldLabResult.TestName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TestName = '" + POut.String(labResult.TestName) + "'";
            }
            //DateTStamp can only be set by MySQL
            if (labResult.TestID != oldLabResult.TestID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TestID = '" + POut.String(labResult.TestID) + "'";
            }
            if (labResult.ObsValue != oldLabResult.ObsValue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ObsValue = '" + POut.String(labResult.ObsValue) + "'";
            }
            if (labResult.ObsUnits != oldLabResult.ObsUnits)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ObsUnits = '" + POut.String(labResult.ObsUnits) + "'";
            }
            if (labResult.ObsRange != oldLabResult.ObsRange)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ObsRange = '" + POut.String(labResult.ObsRange) + "'";
            }
            if (labResult.AbnormalFlag != oldLabResult.AbnormalFlag)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AbnormalFlag = " + POut.Int((int)labResult.AbnormalFlag) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE labresult SET " + command
                      + " WHERE LabResultNum = " + POut.Long(labResult.LabResultNum);
            Db.NonQ(command);
        }
예제 #3
0
        ///<summary>Inserts one Signalod into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Signalod signalod, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO signalod (";

            if (!useExistingPK && isRandomKeys)
            {
                signalod.SignalNum = ReplicationServers.GetKeyNoCache("signalod", "SignalNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "SignalNum,";
            }
            command += "DateViewing,SigDateTime,FKey,FKeyType,IType,RemoteRole,MsgValue) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(signalod.SignalNum) + ",";
            }
            command +=
                POut.Date(signalod.DateViewing) + ","
                + POut.DateT(signalod.SigDateTime) + ","
                + POut.Long(signalod.FKey) + ","
                + "'" + POut.String(signalod.FKeyType.ToString()) + "',"
                + POut.Int((int)signalod.IType) + ","
                + POut.Int((int)signalod.RemoteRole) + ","
                + DbHelper.ParamChar + "paramMsgValue)";
            if (signalod.MsgValue == null)
            {
                signalod.MsgValue = "";
            }
            OdSqlParameter paramMsgValue = new OdSqlParameter("paramMsgValue", OdDbType.Text, POut.StringParam(signalod.MsgValue));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramMsgValue);
            }
            else
            {
                signalod.SignalNum = Db.NonQ(command, true, "SignalNum", "signalod", paramMsgValue);
            }
            return(signalod.SignalNum);
        }
예제 #4
0
        ///<summary>Inserts one HL7Msg into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(HL7Msg hL7Msg, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO hl7msg (";

            if (!useExistingPK && isRandomKeys)
            {
                hL7Msg.HL7MsgNum = ReplicationServers.GetKeyNoCache("hl7msg", "HL7MsgNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "HL7MsgNum,";
            }
            command += "HL7Status,MsgText,AptNum,PatNum,Note) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(hL7Msg.HL7MsgNum) + ",";
            }
            command +=
                POut.Int((int)hL7Msg.HL7Status) + ","
                + DbHelper.ParamChar + "paramMsgText,"
                + POut.Long(hL7Msg.AptNum) + ","
                //DateTStamp can only be set by MySQL
                + POut.Long(hL7Msg.PatNum) + ","
                + DbHelper.ParamChar + "paramNote)";
            if (hL7Msg.MsgText == null)
            {
                hL7Msg.MsgText = "";
            }
            OdSqlParameter paramMsgText = new OdSqlParameter("paramMsgText", OdDbType.Text, POut.StringParam(hL7Msg.MsgText));

            if (hL7Msg.Note == null)
            {
                hL7Msg.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(hL7Msg.Note));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramMsgText, paramNote);
            }
            else
            {
                hL7Msg.HL7MsgNum = Db.NonQ(command, true, "HL7MsgNum", "hL7Msg", paramMsgText, paramNote);
            }
            return(hL7Msg.HL7MsgNum);
        }
예제 #5
0
        ///<summary>Updates one Provider 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.</summary>
        public static void Update(Provider provider, Provider oldProvider)
        {
            string command = "";

            if (provider.Abbr != oldProvider.Abbr)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Abbr = '" + POut.String(provider.Abbr) + "'";
            }
            if (provider.ItemOrder != oldProvider.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(provider.ItemOrder) + "";
            }
            if (provider.LName != oldProvider.LName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LName = '" + POut.String(provider.LName) + "'";
            }
            if (provider.FName != oldProvider.FName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FName = '" + POut.String(provider.FName) + "'";
            }
            if (provider.MI != oldProvider.MI)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MI = '" + POut.String(provider.MI) + "'";
            }
            if (provider.Suffix != oldProvider.Suffix)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Suffix = '" + POut.String(provider.Suffix) + "'";
            }
            if (provider.FeeSched != oldProvider.FeeSched)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeSched = " + POut.Long(provider.FeeSched) + "";
            }
            if (provider.Specialty != oldProvider.Specialty)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Specialty = " + POut.Int((int)provider.Specialty) + "";
            }
            if (provider.SSN != oldProvider.SSN)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SSN = '" + POut.String(provider.SSN) + "'";
            }
            if (provider.StateLicense != oldProvider.StateLicense)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StateLicense = '" + POut.String(provider.StateLicense) + "'";
            }
            if (provider.DEANum != oldProvider.DEANum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DEANum = '" + POut.String(provider.DEANum) + "'";
            }
            if (provider.IsSecondary != oldProvider.IsSecondary)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsSecondary = " + POut.Bool(provider.IsSecondary) + "";
            }
            if (provider.ProvColor != oldProvider.ProvColor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvColor = " + POut.Int(provider.ProvColor.ToArgb()) + "";
            }
            if (provider.IsHidden != oldProvider.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(provider.IsHidden) + "";
            }
            if (provider.UsingTIN != oldProvider.UsingTIN)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UsingTIN = " + POut.Bool(provider.UsingTIN) + "";
            }
            if (provider.BlueCrossID != oldProvider.BlueCrossID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BlueCrossID = '" + POut.String(provider.BlueCrossID) + "'";
            }
            if (provider.SigOnFile != oldProvider.SigOnFile)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SigOnFile = " + POut.Bool(provider.SigOnFile) + "";
            }
            if (provider.MedicaidID != oldProvider.MedicaidID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicaidID = '" + POut.String(provider.MedicaidID) + "'";
            }
            if (provider.OutlineColor != oldProvider.OutlineColor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OutlineColor = " + POut.Int(provider.OutlineColor.ToArgb()) + "";
            }
            if (provider.SchoolClassNum != oldProvider.SchoolClassNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchoolClassNum = " + POut.Long(provider.SchoolClassNum) + "";
            }
            if (provider.NationalProvID != oldProvider.NationalProvID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "NationalProvID = '" + POut.String(provider.NationalProvID) + "'";
            }
            if (provider.CanadianOfficeNum != oldProvider.CanadianOfficeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CanadianOfficeNum = '" + POut.String(provider.CanadianOfficeNum) + "'";
            }
            //DateTStamp can only be set by MySQL
            if (provider.AnesthProvType != oldProvider.AnesthProvType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AnesthProvType = " + POut.Long(provider.AnesthProvType) + "";
            }
            if (provider.TaxonomyCodeOverride != oldProvider.TaxonomyCodeOverride)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TaxonomyCodeOverride = '" + POut.String(provider.TaxonomyCodeOverride) + "'";
            }
            if (provider.IsCDAnet != oldProvider.IsCDAnet)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsCDAnet = " + POut.Bool(provider.IsCDAnet) + "";
            }
            if (provider.EcwID != oldProvider.EcwID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EcwID = '" + POut.String(provider.EcwID) + "'";
            }
            if (provider.EhrKey != oldProvider.EhrKey)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EhrKey = '" + POut.String(provider.EhrKey) + "'";
            }
            if (provider.StateRxID != oldProvider.StateRxID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StateRxID = '" + POut.String(provider.StateRxID) + "'";
            }
            if (provider.EhrHasReportAccess != oldProvider.EhrHasReportAccess)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EhrHasReportAccess = " + POut.Bool(provider.EhrHasReportAccess) + "";
            }
            if (provider.IsNotPerson != oldProvider.IsNotPerson)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsNotPerson = " + POut.Bool(provider.IsNotPerson) + "";
            }
            if (provider.StateWhereLicensed != oldProvider.StateWhereLicensed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StateWhereLicensed = '" + POut.String(provider.StateWhereLicensed) + "'";
            }
            if (provider.EmailAddressNum != oldProvider.EmailAddressNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmailAddressNum = " + POut.Long(provider.EmailAddressNum) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE provider SET " + command
                      + " WHERE ProvNum = " + POut.Long(provider.ProvNum);
            Db.NonQ(command);
        }
        ///<summary>Inserts one CentralConnection into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(CentralConnection centralConnection, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO centralconnection (";

            if (!useExistingPK && isRandomKeys)
            {
                centralConnection.CentralConnectionNum = ReplicationServers.GetKeyNoCache("centralconnection", "CentralConnectionNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "CentralConnectionNum,";
            }
            command += "ServerName,DatabaseName,MySqlUser,MySqlPassword,ServiceURI,OdUser,OdPassword,Note,ItemOrder,WebServiceIsEcw,ConnectionStatus) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(centralConnection.CentralConnectionNum) + ",";
            }
            command +=
                "'" + POut.String(centralConnection.ServerName) + "',"
                + "'" + POut.String(centralConnection.DatabaseName) + "',"
                + "'" + POut.String(centralConnection.MySqlUser) + "',"
                + "'" + POut.String(centralConnection.MySqlPassword) + "',"
                + "'" + POut.String(centralConnection.ServiceURI) + "',"
                + "'" + POut.String(centralConnection.OdUser) + "',"
                + "'" + POut.String(centralConnection.OdPassword) + "',"
                + DbHelper.ParamChar + "paramNote,"
                + POut.Int(centralConnection.ItemOrder) + ","
                + POut.Bool(centralConnection.WebServiceIsEcw) + ","
                + "'" + POut.String(centralConnection.ConnectionStatus) + "')";
            if (centralConnection.Note == null)
            {
                centralConnection.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(centralConnection.Note));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNote);
            }
            else
            {
                centralConnection.CentralConnectionNum = Db.NonQ(command, true, "CentralConnectionNum", "centralConnection", paramNote);
            }
            return(centralConnection.CentralConnectionNum);
        }
        ///<summary>Updates one CentralConnection 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(CentralConnection centralConnection, CentralConnection oldCentralConnection)
        {
            string command = "";

            if (centralConnection.ServerName != oldCentralConnection.ServerName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ServerName = '" + POut.String(centralConnection.ServerName) + "'";
            }
            if (centralConnection.DatabaseName != oldCentralConnection.DatabaseName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DatabaseName = '" + POut.String(centralConnection.DatabaseName) + "'";
            }
            if (centralConnection.MySqlUser != oldCentralConnection.MySqlUser)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MySqlUser = '******'";
            }
            if (centralConnection.MySqlPassword != oldCentralConnection.MySqlPassword)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MySqlPassword = '******'";
            }
            if (centralConnection.ServiceURI != oldCentralConnection.ServiceURI)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ServiceURI = '" + POut.String(centralConnection.ServiceURI) + "'";
            }
            if (centralConnection.OdUser != oldCentralConnection.OdUser)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OdUser = '******'";
            }
            if (centralConnection.OdPassword != oldCentralConnection.OdPassword)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OdPassword = '******'";
            }
            if (centralConnection.Note != oldCentralConnection.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (centralConnection.ItemOrder != oldCentralConnection.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(centralConnection.ItemOrder) + "";
            }
            if (centralConnection.WebServiceIsEcw != oldCentralConnection.WebServiceIsEcw)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "WebServiceIsEcw = " + POut.Bool(centralConnection.WebServiceIsEcw) + "";
            }
            if (centralConnection.ConnectionStatus != oldCentralConnection.ConnectionStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ConnectionStatus = '" + POut.String(centralConnection.ConnectionStatus) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            if (centralConnection.Note == null)
            {
                centralConnection.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(centralConnection.Note));

            command = "UPDATE centralconnection SET " + command
                      + " WHERE CentralConnectionNum = " + POut.Long(centralConnection.CentralConnectionNum);
            Db.NonQ(command, paramNote);
            return(true);
        }
예제 #8
0
        ///<summary>Inserts one SigElementDef into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(SigElementDef sigElementDef, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO sigelementdef (";

            if (!useExistingPK && isRandomKeys)
            {
                sigElementDef.SigElementDefNum = ReplicationServers.GetKeyNoCache("sigelementdef", "SigElementDefNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "SigElementDefNum,";
            }
            command += "LightRow,LightColor,SigElementType,SigText,Sound,ItemOrder) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(sigElementDef.SigElementDefNum) + ",";
            }
            command +=
                POut.Byte(sigElementDef.LightRow) + ","
                + POut.Int(sigElementDef.LightColor.ToArgb()) + ","
                + POut.Int((int)sigElementDef.SigElementType) + ","
                + "'" + POut.String(sigElementDef.SigText) + "',"
                + DbHelper.ParamChar + "paramSound,"
                + POut.Int(sigElementDef.ItemOrder) + ")";
            if (sigElementDef.Sound == null)
            {
                sigElementDef.Sound = "";
            }
            OdSqlParameter paramSound = new OdSqlParameter("paramSound", OdDbType.Text, POut.StringParam(sigElementDef.Sound));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramSound);
            }
            else
            {
                sigElementDef.SigElementDefNum = Db.NonQ(command, true, "SigElementDefNum", "sigElementDef", paramSound);
            }
            return(sigElementDef.SigElementDefNum);
        }
예제 #9
0
        ///<summary>Updates one SigElementDef in the database.</summary>
        public static void Update(SigElementDef sigElementDef)
        {
            string command = "UPDATE sigelementdef SET "
                             + "LightRow        =  " + POut.Byte(sigElementDef.LightRow) + ", "
                             + "LightColor      =  " + POut.Int(sigElementDef.LightColor.ToArgb()) + ", "
                             + "SigElementType  =  " + POut.Int((int)sigElementDef.SigElementType) + ", "
                             + "SigText         = '" + POut.String(sigElementDef.SigText) + "', "
                             + "Sound           =  " + DbHelper.ParamChar + "paramSound, "
                             + "ItemOrder       =  " + POut.Int(sigElementDef.ItemOrder) + " "
                             + "WHERE SigElementDefNum = " + POut.Long(sigElementDef.SigElementDefNum);

            if (sigElementDef.Sound == null)
            {
                sigElementDef.Sound = "";
            }
            OdSqlParameter paramSound = new OdSqlParameter("paramSound", OdDbType.Text, POut.StringParam(sigElementDef.Sound));

            Db.NonQ(command, paramSound);
        }
예제 #10
0
        ///<summary>Updates one EhrQuarterlyKey in the database.</summary>
        public static void Update(EhrQuarterlyKey ehrQuarterlyKey)
        {
            string command = "UPDATE ehrquarterlykey SET "
                             + "YearValue         =  " + POut.Int(ehrQuarterlyKey.YearValue) + ", "
                             + "QuarterValue      =  " + POut.Int(ehrQuarterlyKey.QuarterValue) + ", "
                             + "PracticeName      = '" + POut.String(ehrQuarterlyKey.PracticeName) + "', "
                             + "KeyValue          = '" + POut.String(ehrQuarterlyKey.KeyValue) + "', "
                             + "PatNum            =  " + POut.Long(ehrQuarterlyKey.PatNum) + ", "
                             + "Notes             =  " + DbHelper.ParamChar + "paramNotes "
                             + "WHERE EhrQuarterlyKeyNum = " + POut.Long(ehrQuarterlyKey.EhrQuarterlyKeyNum);

            if (ehrQuarterlyKey.Notes == null)
            {
                ehrQuarterlyKey.Notes = "";
            }
            OdSqlParameter paramNotes = new OdSqlParameter("paramNotes", OdDbType.Text, POut.StringParam(ehrQuarterlyKey.Notes));

            Db.NonQ(command, paramNotes);
        }
예제 #11
0
        ///<summary>Updates one EhrQuarterlyKey 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(EhrQuarterlyKey ehrQuarterlyKey, EhrQuarterlyKey oldEhrQuarterlyKey)
        {
            string command = "";

            if (ehrQuarterlyKey.YearValue != oldEhrQuarterlyKey.YearValue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "YearValue = " + POut.Int(ehrQuarterlyKey.YearValue) + "";
            }
            if (ehrQuarterlyKey.QuarterValue != oldEhrQuarterlyKey.QuarterValue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "QuarterValue = " + POut.Int(ehrQuarterlyKey.QuarterValue) + "";
            }
            if (ehrQuarterlyKey.PracticeName != oldEhrQuarterlyKey.PracticeName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PracticeName = '" + POut.String(ehrQuarterlyKey.PracticeName) + "'";
            }
            if (ehrQuarterlyKey.KeyValue != oldEhrQuarterlyKey.KeyValue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "KeyValue = '" + POut.String(ehrQuarterlyKey.KeyValue) + "'";
            }
            if (ehrQuarterlyKey.PatNum != oldEhrQuarterlyKey.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(ehrQuarterlyKey.PatNum) + "";
            }
            if (ehrQuarterlyKey.Notes != oldEhrQuarterlyKey.Notes)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Notes = " + DbHelper.ParamChar + "paramNotes";
            }
            if (command == "")
            {
                return(false);
            }
            if (ehrQuarterlyKey.Notes == null)
            {
                ehrQuarterlyKey.Notes = "";
            }
            OdSqlParameter paramNotes = new OdSqlParameter("paramNotes", OdDbType.Text, POut.StringParam(ehrQuarterlyKey.Notes));

            command = "UPDATE ehrquarterlykey SET " + command
                      + " WHERE EhrQuarterlyKeyNum = " + POut.Long(ehrQuarterlyKey.EhrQuarterlyKeyNum);
            Db.NonQ(command, paramNotes);
            return(true);
        }
예제 #12
0
        ///<summary>Inserts one EhrQuarterlyKey into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(EhrQuarterlyKey ehrQuarterlyKey, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO ehrquarterlykey (";

            if (!useExistingPK && isRandomKeys)
            {
                ehrQuarterlyKey.EhrQuarterlyKeyNum = ReplicationServers.GetKeyNoCache("ehrquarterlykey", "EhrQuarterlyKeyNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "EhrQuarterlyKeyNum,";
            }
            command += "YearValue,QuarterValue,PracticeName,KeyValue,PatNum,Notes) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(ehrQuarterlyKey.EhrQuarterlyKeyNum) + ",";
            }
            command +=
                POut.Int(ehrQuarterlyKey.YearValue) + ","
                + POut.Int(ehrQuarterlyKey.QuarterValue) + ","
                + "'" + POut.String(ehrQuarterlyKey.PracticeName) + "',"
                + "'" + POut.String(ehrQuarterlyKey.KeyValue) + "',"
                + POut.Long(ehrQuarterlyKey.PatNum) + ","
                + DbHelper.ParamChar + "paramNotes)";
            if (ehrQuarterlyKey.Notes == null)
            {
                ehrQuarterlyKey.Notes = "";
            }
            OdSqlParameter paramNotes = new OdSqlParameter("paramNotes", OdDbType.Text, POut.StringParam(ehrQuarterlyKey.Notes));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNotes);
            }
            else
            {
                ehrQuarterlyKey.EhrQuarterlyKeyNum = Db.NonQ(command, true, "EhrQuarterlyKeyNum", "ehrQuarterlyKey", paramNotes);
            }
            return(ehrQuarterlyKey.EhrQuarterlyKeyNum);
        }
예제 #13
0
        ///<summary>Updates one HL7Msg 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(HL7Msg hL7Msg, HL7Msg oldHL7Msg)
        {
            string command = "";

            if (hL7Msg.HL7Status != oldHL7Msg.HL7Status)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HL7Status = " + POut.Int((int)hL7Msg.HL7Status) + "";
            }
            if (hL7Msg.MsgText != oldHL7Msg.MsgText)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MsgText = " + DbHelper.ParamChar + "paramMsgText";
            }
            if (hL7Msg.AptNum != oldHL7Msg.AptNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AptNum = " + POut.Long(hL7Msg.AptNum) + "";
            }
            //DateTStamp can only be set by MySQL
            if (hL7Msg.PatNum != oldHL7Msg.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(hL7Msg.PatNum) + "";
            }
            if (hL7Msg.Note != oldHL7Msg.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (command == "")
            {
                return(false);
            }
            if (hL7Msg.MsgText == null)
            {
                hL7Msg.MsgText = "";
            }
            OdSqlParameter paramMsgText = new OdSqlParameter("paramMsgText", OdDbType.Text, POut.StringParam(hL7Msg.MsgText));

            if (hL7Msg.Note == null)
            {
                hL7Msg.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(hL7Msg.Note));

            command = "UPDATE hl7msg SET " + command
                      + " WHERE HL7MsgNum = " + POut.Long(hL7Msg.HL7MsgNum);
            Db.NonQ(command, paramMsgText, paramNote);
            return(true);
        }
예제 #14
0
        ///<summary>Updates one HL7Msg in the database.</summary>
        public static void Update(HL7Msg hL7Msg)
        {
            string command = "UPDATE hl7msg SET "
                             + "HL7Status =  " + POut.Int((int)hL7Msg.HL7Status) + ", "
                             + "MsgText   =  " + DbHelper.ParamChar + "paramMsgText, "
                             + "AptNum    =  " + POut.Long(hL7Msg.AptNum) + ", "
                             //DateTStamp can only be set by MySQL
                             + "PatNum    =  " + POut.Long(hL7Msg.PatNum) + ", "
                             + "Note      =  " + DbHelper.ParamChar + "paramNote "
                             + "WHERE HL7MsgNum = " + POut.Long(hL7Msg.HL7MsgNum);

            if (hL7Msg.MsgText == null)
            {
                hL7Msg.MsgText = "";
            }
            OdSqlParameter paramMsgText = new OdSqlParameter("paramMsgText", OdDbType.Text, POut.StringParam(hL7Msg.MsgText));

            if (hL7Msg.Note == null)
            {
                hL7Msg.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(hL7Msg.Note));

            Db.NonQ(command, paramMsgText, paramNote);
        }
예제 #15
0
        ///<summary>Updates one Signalod 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(Signalod signalod, Signalod oldSignalod)
        {
            string command = "";

            if (signalod.DateViewing.Date != oldSignalod.DateViewing.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateViewing = " + POut.Date(signalod.DateViewing) + "";
            }
            if (signalod.SigDateTime != oldSignalod.SigDateTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SigDateTime = " + POut.DateT(signalod.SigDateTime) + "";
            }
            if (signalod.FKey != oldSignalod.FKey)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FKey = " + POut.Long(signalod.FKey) + "";
            }
            if (signalod.FKeyType != oldSignalod.FKeyType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FKeyType = '" + POut.String(signalod.FKeyType.ToString()) + "'";
            }
            if (signalod.IType != oldSignalod.IType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IType = " + POut.Int((int)signalod.IType) + "";
            }
            if (signalod.RemoteRole != oldSignalod.RemoteRole)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RemoteRole = " + POut.Int((int)signalod.RemoteRole) + "";
            }
            if (signalod.MsgValue != oldSignalod.MsgValue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MsgValue = " + DbHelper.ParamChar + "paramMsgValue";
            }
            if (command == "")
            {
                return(false);
            }
            if (signalod.MsgValue == null)
            {
                signalod.MsgValue = "";
            }
            OdSqlParameter paramMsgValue = new OdSqlParameter("paramMsgValue", OdDbType.Text, POut.StringParam(signalod.MsgValue));

            command = "UPDATE signalod SET " + command
                      + " WHERE SignalNum = " + POut.Long(signalod.SignalNum);
            Db.NonQ(command, paramMsgValue);
            return(true);
        }
예제 #16
0
        ///<summary>Updates one SigElementDef 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(SigElementDef sigElementDef, SigElementDef oldSigElementDef)
        {
            string command = "";

            if (sigElementDef.LightRow != oldSigElementDef.LightRow)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LightRow = " + POut.Byte(sigElementDef.LightRow) + "";
            }
            if (sigElementDef.LightColor != oldSigElementDef.LightColor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LightColor = " + POut.Int(sigElementDef.LightColor.ToArgb()) + "";
            }
            if (sigElementDef.SigElementType != oldSigElementDef.SigElementType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SigElementType = " + POut.Int((int)sigElementDef.SigElementType) + "";
            }
            if (sigElementDef.SigText != oldSigElementDef.SigText)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SigText = '" + POut.String(sigElementDef.SigText) + "'";
            }
            if (sigElementDef.Sound != oldSigElementDef.Sound)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Sound = " + DbHelper.ParamChar + "paramSound";
            }
            if (sigElementDef.ItemOrder != oldSigElementDef.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(sigElementDef.ItemOrder) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (sigElementDef.Sound == null)
            {
                sigElementDef.Sound = "";
            }
            OdSqlParameter paramSound = new OdSqlParameter("paramSound", OdDbType.Text, POut.StringParam(sigElementDef.Sound));

            command = "UPDATE sigelementdef SET " + command
                      + " WHERE SigElementDefNum = " + POut.Long(sigElementDef.SigElementDefNum);
            Db.NonQ(command, paramSound);
            return(true);
        }
예제 #17
0
        ///<summary>Updates one ClaimCondCodeLog 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.</summary>
        internal static void Update(ClaimCondCodeLog claimCondCodeLog, ClaimCondCodeLog oldClaimCondCodeLog)
        {
            string command = "";

            if (claimCondCodeLog.ClaimNum != oldClaimCondCodeLog.ClaimNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClaimNum = " + POut.Long(claimCondCodeLog.ClaimNum) + "";
            }
            if (claimCondCodeLog.Code0 != oldClaimCondCodeLog.Code0)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code0 = '" + POut.String(claimCondCodeLog.Code0) + "'";
            }
            if (claimCondCodeLog.Code1 != oldClaimCondCodeLog.Code1)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code1 = '" + POut.String(claimCondCodeLog.Code1) + "'";
            }
            if (claimCondCodeLog.Code2 != oldClaimCondCodeLog.Code2)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code2 = '" + POut.String(claimCondCodeLog.Code2) + "'";
            }
            if (claimCondCodeLog.Code3 != oldClaimCondCodeLog.Code3)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code3 = '" + POut.String(claimCondCodeLog.Code3) + "'";
            }
            if (claimCondCodeLog.Code4 != oldClaimCondCodeLog.Code4)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code4 = '" + POut.String(claimCondCodeLog.Code4) + "'";
            }
            if (claimCondCodeLog.Code5 != oldClaimCondCodeLog.Code5)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code5 = '" + POut.String(claimCondCodeLog.Code5) + "'";
            }
            if (claimCondCodeLog.Code6 != oldClaimCondCodeLog.Code6)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code6 = '" + POut.String(claimCondCodeLog.Code6) + "'";
            }
            if (claimCondCodeLog.Code7 != oldClaimCondCodeLog.Code7)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code7 = '" + POut.String(claimCondCodeLog.Code7) + "'";
            }
            if (claimCondCodeLog.Code8 != oldClaimCondCodeLog.Code8)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code8 = '" + POut.String(claimCondCodeLog.Code8) + "'";
            }
            if (claimCondCodeLog.Code9 != oldClaimCondCodeLog.Code9)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code9 = '" + POut.String(claimCondCodeLog.Code9) + "'";
            }
            if (claimCondCodeLog.Code10 != oldClaimCondCodeLog.Code10)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Code10 = '" + POut.String(claimCondCodeLog.Code10) + "'";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE claimcondcodelog SET " + command
                      + " WHERE ClaimCondCodeLogNum = " + POut.Long(claimCondCodeLog.ClaimCondCodeLogNum);
            Db.NonQ(command);
        }
예제 #18
0
		///<summary>Deletes one AutomationCondition from the database.</summary>
		public static void Delete(long automationConditionNum){
			string command="DELETE FROM automationcondition "
				+"WHERE AutomationConditionNum = "+POut.Long(automationConditionNum);
			Db.NonQ(command);
		}
        ///<summary>Updates one CentralConnection in the database.</summary>
        public static void Update(CentralConnection centralConnection)
        {
            string command = "UPDATE centralconnection SET "
                             + "ServerName          = '" + POut.String(centralConnection.ServerName) + "', "
                             + "DatabaseName        = '" + POut.String(centralConnection.DatabaseName) + "', "
                             + "MySqlUser           = '******', "
                             + "MySqlPassword       = '******', "
                             + "ServiceURI          = '" + POut.String(centralConnection.ServiceURI) + "', "
                             + "OdUser              = '******', "
                             + "OdPassword          = '******', "
                             + "Note                =  " + DbHelper.ParamChar + "paramNote, "
                             + "ItemOrder           =  " + POut.Int(centralConnection.ItemOrder) + ", "
                             + "WebServiceIsEcw     =  " + POut.Bool(centralConnection.WebServiceIsEcw) + ", "
                             + "ConnectionStatus    = '" + POut.String(centralConnection.ConnectionStatus) + "' "
                             + "WHERE CentralConnectionNum = " + POut.Long(centralConnection.CentralConnectionNum);

            if (centralConnection.Note == null)
            {
                centralConnection.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(centralConnection.Note));

            Db.NonQ(command, paramNote);
        }
예제 #20
0
        ///<summary>Inserts one Provider into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Provider provider, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                provider.ProvNum = ReplicationServers.GetKey("provider", "ProvNum");
            }
            string command = "INSERT INTO provider (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ProvNum,";
            }
            command += "Abbr,ItemOrder,LName,FName,MI,Suffix,FeeSched,Specialty,SSN,StateLicense,DEANum,IsSecondary,ProvColor,IsHidden,UsingTIN,BlueCrossID,SigOnFile,MedicaidID,OutlineColor,SchoolClassNum,NationalProvID,CanadianOfficeNum,AnesthProvType,TaxonomyCodeOverride,IsCDAnet,EcwID,EhrKey,StateRxID,EhrHasReportAccess,IsNotPerson,StateWhereLicensed,EmailAddressNum) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(provider.ProvNum) + ",";
            }
            command +=
                "'" + POut.String(provider.Abbr) + "',"
                + POut.Int(provider.ItemOrder) + ","
                + "'" + POut.String(provider.LName) + "',"
                + "'" + POut.String(provider.FName) + "',"
                + "'" + POut.String(provider.MI) + "',"
                + "'" + POut.String(provider.Suffix) + "',"
                + POut.Long(provider.FeeSched) + ","
                + POut.Int((int)provider.Specialty) + ","
                + "'" + POut.String(provider.SSN) + "',"
                + "'" + POut.String(provider.StateLicense) + "',"
                + "'" + POut.String(provider.DEANum) + "',"
                + POut.Bool(provider.IsSecondary) + ","
                + POut.Int(provider.ProvColor.ToArgb()) + ","
                + POut.Bool(provider.IsHidden) + ","
                + POut.Bool(provider.UsingTIN) + ","
                + "'" + POut.String(provider.BlueCrossID) + "',"
                + POut.Bool(provider.SigOnFile) + ","
                + "'" + POut.String(provider.MedicaidID) + "',"
                + POut.Int(provider.OutlineColor.ToArgb()) + ","
                + POut.Long(provider.SchoolClassNum) + ","
                + "'" + POut.String(provider.NationalProvID) + "',"
                + "'" + POut.String(provider.CanadianOfficeNum) + "',"
                //DateTStamp can only be set by MySQL
                + POut.Long(provider.AnesthProvType) + ","
                + "'" + POut.String(provider.TaxonomyCodeOverride) + "',"
                + POut.Bool(provider.IsCDAnet) + ","
                + "'" + POut.String(provider.EcwID) + "',"
                + "'" + POut.String(provider.EhrKey) + "',"
                + "'" + POut.String(provider.StateRxID) + "',"
                + POut.Bool(provider.EhrHasReportAccess) + ","
                + POut.Bool(provider.IsNotPerson) + ","
                + "'" + POut.String(provider.StateWhereLicensed) + "',"
                + POut.Long(provider.EmailAddressNum) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                provider.ProvNum = Db.NonQ(command, true);
            }
            return(provider.ProvNum);
        }
예제 #21
0
        ///<summary>Updates one EmailAddress 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(EmailAddress emailAddress, EmailAddress oldEmailAddress)
        {
            string command = "";

            if (emailAddress.SMTPserver != oldEmailAddress.SMTPserver)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SMTPserver = '" + POut.String(emailAddress.SMTPserver) + "'";
            }
            if (emailAddress.EmailUsername != oldEmailAddress.EmailUsername)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmailUsername = '******'";
            }
            if (emailAddress.EmailPassword != oldEmailAddress.EmailPassword)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmailPassword = '******'";
            }
            if (emailAddress.ServerPort != oldEmailAddress.ServerPort)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ServerPort = " + POut.Int(emailAddress.ServerPort) + "";
            }
            if (emailAddress.UseSSL != oldEmailAddress.UseSSL)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UseSSL = " + POut.Bool(emailAddress.UseSSL) + "";
            }
            if (emailAddress.SenderAddress != oldEmailAddress.SenderAddress)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SenderAddress = '" + POut.String(emailAddress.SenderAddress) + "'";
            }
            if (emailAddress.Pop3ServerIncoming != oldEmailAddress.Pop3ServerIncoming)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Pop3ServerIncoming = '" + POut.String(emailAddress.Pop3ServerIncoming) + "'";
            }
            if (emailAddress.ServerPortIncoming != oldEmailAddress.ServerPortIncoming)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ServerPortIncoming = " + POut.Int(emailAddress.ServerPortIncoming) + "";
            }
            if (emailAddress.UserNum != oldEmailAddress.UserNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UserNum = " + POut.Long(emailAddress.UserNum) + "";
            }
            if (emailAddress.AccessToken != oldEmailAddress.AccessToken)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AccessToken = '" + POut.String(emailAddress.AccessToken) + "'";
            }
            if (emailAddress.RefreshToken != oldEmailAddress.RefreshToken)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RefreshToken = '" + POut.String(emailAddress.RefreshToken) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE emailaddress SET " + command
                      + " WHERE EmailAddressNum = " + POut.Long(emailAddress.EmailAddressNum);
            Db.NonQ(command);
            return(true);
        }
예제 #22
0
		///<summary>Deletes one Letter from the database.</summary>
		public static void Delete(long letterNum){
			string command="DELETE FROM letter "
				+"WHERE LetterNum = "+POut.Long(letterNum);
			Db.NonQ(command);
		}