///<summary>Updates one EhrNotPerformed in the database.</summary>
        public static void Update(EhrNotPerformed ehrNotPerformed)
        {
            string command = "UPDATE ehrnotperformed SET "
                             + "PatNum            =  " + POut.Long(ehrNotPerformed.PatNum) + ", "
                             + "ProvNum           =  " + POut.Long(ehrNotPerformed.ProvNum) + ", "
                             + "CodeValue         = '" + POut.String(ehrNotPerformed.CodeValue) + "', "
                             + "CodeSystem        = '" + POut.String(ehrNotPerformed.CodeSystem) + "', "
                             + "CodeValueReason   = '" + POut.String(ehrNotPerformed.CodeValueReason) + "', "
                             + "CodeSystemReason  = '" + POut.String(ehrNotPerformed.CodeSystemReason) + "', "
                             + "Note              =  " + DbHelper.ParamChar + "paramNote, "
                             + "DateEntry         =  " + POut.Date(ehrNotPerformed.DateEntry) + " "
                             + "WHERE EhrNotPerformedNum = " + POut.Long(ehrNotPerformed.EhrNotPerformedNum);

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

            Db.NonQ(command, paramNote);
        }
        ///<summary>Updates one SiteLink in the database.</summary>
        public static void Update(SiteLink siteLink)
        {
            string command = "UPDATE sitelink SET "
                             + "SiteNum                      =  " + POut.Long(siteLink.SiteNum) + ", "
                             + "OctetStart                   = '" + POut.String(siteLink.OctetStart) + "', "
                             + "EmployeeNum                  =  " + POut.Long(siteLink.EmployeeNum) + ", "
                             + "SiteColor                    =  " + POut.Int(siteLink.SiteColor.ToArgb()) + ", "
                             + "ForeColor                    =  " + POut.Int(siteLink.ForeColor.ToArgb()) + ", "
                             + "InnerColor                   =  " + POut.Int(siteLink.InnerColor.ToArgb()) + ", "
                             + "OuterColor                   =  " + POut.Int(siteLink.OuterColor.ToArgb()) + ", "
                             + "ConnectionSettingsHQOverrides=  " + DbHelper.ParamChar + "paramConnectionSettingsHQOverrides "
                             + "WHERE SiteLinkNum = " + POut.Long(siteLink.SiteLinkNum);

            if (siteLink.ConnectionSettingsHQOverrides == null)
            {
                siteLink.ConnectionSettingsHQOverrides = "";
            }
            OdSqlParameter paramConnectionSettingsHQOverrides = new OdSqlParameter("paramConnectionSettingsHQOverrides", OdDbType.Text, POut.StringParam(siteLink.ConnectionSettingsHQOverrides));

            Db.NonQ(command, paramConnectionSettingsHQOverrides);
        }
Beispiel #3
0
        ///<summary>Updates one Intervention in the database.</summary>
        public static void Update(Intervention intervention)
        {
            string command = "UPDATE intervention SET "
                             + "PatNum         =  " + POut.Long(intervention.PatNum) + ", "
                             + "ProvNum        =  " + POut.Long(intervention.ProvNum) + ", "
                             + "CodeValue      = '" + POut.String(intervention.CodeValue) + "', "
                             + "CodeSystem     = '" + POut.String(intervention.CodeSystem) + "', "
                             + "Note           =  " + DbHelper.ParamChar + "paramNote, "
                             + "DateEntry      =  " + POut.Date(intervention.DateEntry) + ", "
                             + "CodeSet        =  " + POut.Int((int)intervention.CodeSet) + ", "
                             + "IsPatDeclined  =  " + POut.Bool(intervention.IsPatDeclined) + " "
                             + "WHERE InterventionNum = " + POut.Long(intervention.InterventionNum);

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

            Db.NonQ(command, paramNote);
        }
        ///<summary>Updates one ConnectionGroup 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(ConnectionGroup connectionGroup, ConnectionGroup oldConnectionGroup)
        {
            string command = "";

            if (connectionGroup.Description != oldConnectionGroup.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(connectionGroup.Description) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE connectiongroup SET " + command
                      + " WHERE ConnectionGroupNum = " + POut.Long(connectionGroup.ConnectionGroupNum);
            Db.NonQ(command);
            return(true);
        }
Beispiel #5
0
        ///<summary>Updates one Phone in the database.</summary>
        internal static void Update(Phone phone)
        {
            string command = "UPDATE phone SET "
                             + "Extension      =  " + POut.Int(phone.Extension) + ", "
                             + "EmployeeName   = '" + POut.String(phone.EmployeeName) + "', "
                             + "ClockStatus    =  " + POut.String(phone.ClockStatus.ToString()) + ", "
                             + "Description    = '" + POut.String(phone.Description) + "', "
                             + "ColorBar       =  " + POut.Int(phone.ColorBar.ToArgb()) + ", "
                             + "ColorText      =  " + POut.Int(phone.ColorText.ToArgb()) + ", "
                             + "EmployeeNum    =  " + POut.Long(phone.EmployeeNum) + ", "
                             + "CustomerNumber = '" + POut.String(phone.CustomerNumber) + "', "
                             + "InOrOut        = '" + POut.String(phone.InOrOut) + "', "
                             + "PatNum         =  " + POut.Long(phone.PatNum) + ", "
                             + "DateTimeStart  =  " + POut.DateT(phone.DateTimeStart) + ", "
                             + "WebCamImage    = '" + POut.String(phone.WebCamImage) + "', "
                             + "ScreenshotPath = '" + POut.String(phone.ScreenshotPath) + "', "
                             + "ScreenshotImage= '" + POut.String(phone.ScreenshotImage) + "' "
                             + "WHERE PhoneNum = " + POut.Long(phone.PhoneNum);

            Db.NonQ(command);
        }
Beispiel #6
0
        ///<summary>Updates one DictCustom 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(DictCustom dictCustom, DictCustom oldDictCustom)
        {
            string command = "";

            if (dictCustom.WordText != oldDictCustom.WordText)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "WordText = '" + POut.String(dictCustom.WordText) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE dictcustom SET " + command
                      + " WHERE DictCustomNum = " + POut.Long(dictCustom.DictCustomNum);
            Db.NonQ(command);
            return(true);
        }
Beispiel #7
0
        ///<summary>Inserts one ToothInitial into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(ToothInitial toothInitial, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                toothInitial.ToothInitialNum = ReplicationServers.GetKey("toothinitial", "ToothInitialNum");
            }
            string command = "INSERT INTO toothinitial (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ToothInitialNum,";
            }
            command += "PatNum,ToothNum,InitialType,Movement,DrawingSegment,ColorDraw) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(toothInitial.ToothInitialNum) + ",";
            }
            command +=
                POut.Long(toothInitial.PatNum) + ","
                + "'" + POut.String(toothInitial.ToothNum) + "',"
                + POut.Int((int)toothInitial.InitialType) + ","
                + POut.Float(toothInitial.Movement) + ","
                + DbHelper.ParamChar + "paramDrawingSegment,"
                + POut.Int(toothInitial.ColorDraw.ToArgb()) + ")";
            if (toothInitial.DrawingSegment == null)
            {
                toothInitial.DrawingSegment = "";
            }
            OdSqlParameter paramDrawingSegment = new OdSqlParameter("paramDrawingSegment", OdDbType.Text, POut.StringParam(toothInitial.DrawingSegment));

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramDrawingSegment);
            }
            else
            {
                toothInitial.ToothInitialNum = Db.NonQ(command, true, "ToothInitialNum", "toothInitial", paramDrawingSegment);
            }
            return(toothInitial.ToothInitialNum);
        }
Beispiel #8
0
        ///<summary>Inserts one WikiPageHist into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(WikiPageHist wikiPageHist, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO wikipagehist (";

            if (!useExistingPK && isRandomKeys)
            {
                wikiPageHist.WikiPageNum = ReplicationServers.GetKeyNoCache("wikipagehist", "WikiPageNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "WikiPageNum,";
            }
            command += "UserNum,PageTitle,PageContent,DateTimeSaved,IsDeleted) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(wikiPageHist.WikiPageNum) + ",";
            }
            command +=
                POut.Long(wikiPageHist.UserNum) + ","
                + "'" + POut.String(wikiPageHist.PageTitle) + "',"
                + DbHelper.ParamChar + "paramPageContent,"
                + POut.DateT(wikiPageHist.DateTimeSaved) + ","
                + POut.Bool(wikiPageHist.IsDeleted) + ")";
            if (wikiPageHist.PageContent == null)
            {
                wikiPageHist.PageContent = "";
            }
            OdSqlParameter paramPageContent = new OdSqlParameter("paramPageContent", OdDbType.Text, POut.StringParam(wikiPageHist.PageContent));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramPageContent);
            }
            else
            {
                wikiPageHist.WikiPageNum = Db.NonQ(command, true, "WikiPageNum", "wikiPageHist", paramPageContent);
            }
            return(wikiPageHist.WikiPageNum);
        }
Beispiel #9
0
        ///<summary>Inserts one ProcCodeNote into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ProcCodeNote procCodeNote, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO proccodenote (";

            if (!useExistingPK && isRandomKeys)
            {
                procCodeNote.ProcCodeNoteNum = ReplicationServers.GetKeyNoCache("proccodenote", "ProcCodeNoteNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ProcCodeNoteNum,";
            }
            command += "CodeNum,ProvNum,Note,ProcTime,ProcStatus) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(procCodeNote.ProcCodeNoteNum) + ",";
            }
            command +=
                POut.Long(procCodeNote.CodeNum) + ","
                + POut.Long(procCodeNote.ProvNum) + ","
                + DbHelper.ParamChar + "paramNote,"
                + "'" + POut.String(procCodeNote.ProcTime) + "',"
                + POut.Int((int)procCodeNote.ProcStatus) + ")";
            if (procCodeNote.Note == null)
            {
                procCodeNote.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(procCodeNote.Note));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNote);
            }
            else
            {
                procCodeNote.ProcCodeNoteNum = Db.NonQ(command, true, "ProcCodeNoteNum", "procCodeNote", paramNote);
            }
            return(procCodeNote.ProcCodeNoteNum);
        }
        ///<summary>Inserts one SigMessage into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(SigMessage sigMessage, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO sigmessage (";

            if (!useExistingPK && isRandomKeys)
            {
                sigMessage.SigMessageNum = ReplicationServers.GetKeyNoCache("sigmessage", "SigMessageNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "SigMessageNum,";
            }
            command += "ButtonText,ButtonIndex,SynchIcon,FromUser,ToUser,MessageDateTime,AckDateTime,SigText,SigElementDefNumUser,SigElementDefNumExtra,SigElementDefNumMsg) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(sigMessage.SigMessageNum) + ",";
            }
            command +=
                "'" + POut.String(sigMessage.ButtonText) + "',"
                + POut.Int(sigMessage.ButtonIndex) + ","
                + POut.Byte(sigMessage.SynchIcon) + ","
                + "'" + POut.String(sigMessage.FromUser) + "',"
                + "'" + POut.String(sigMessage.ToUser) + "',"
                + DbHelper.Now() + ","
                + POut.DateT(sigMessage.AckDateTime) + ","
                + "'" + POut.String(sigMessage.SigText) + "',"
                + POut.Long(sigMessage.SigElementDefNumUser) + ","
                + POut.Long(sigMessage.SigElementDefNumExtra) + ","
                + POut.Long(sigMessage.SigElementDefNumMsg) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                sigMessage.SigMessageNum = Db.NonQ(command, true, "SigMessageNum", "sigMessage");
            }
            return(sigMessage.SigMessageNum);
        }
Beispiel #11
0
        ///<summary>Inserts one Recall into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(Recall recall, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                recall.RecallNum = ReplicationServers.GetKey("recall", "RecallNum");
            }
            string command = "INSERT INTO recall (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "RecallNum,";
            }
            command += "PatNum,DateDueCalc,DateDue,DatePrevious,RecallInterval,RecallStatus,Note,IsDisabled,RecallTypeNum,DisableUntilBalance,DisableUntilDate) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(recall.RecallNum) + ",";
            }
            command +=
                POut.Long(recall.PatNum) + ","
                + POut.Date(recall.DateDueCalc) + ","
                + POut.Date(recall.DateDue) + ","
                + POut.Date(recall.DatePrevious) + ","
                + POut.Int(recall.RecallInterval.ToInt()) + ","
                + POut.Long(recall.RecallStatus) + ","
                + "'" + POut.String(recall.Note) + "',"
                + POut.Bool(recall.IsDisabled) + ","
                //DateTStamp can only be set by MySQL
                + POut.Long(recall.RecallTypeNum) + ","
                + "'" + POut.Double(recall.DisableUntilBalance) + "',"
                + POut.Date(recall.DisableUntilDate) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                recall.RecallNum = Db.NonQ(command, true);
            }
            return(recall.RecallNum);
        }
Beispiel #12
0
        ///<summary>Inserts one EhrMeasureEvent into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(EhrMeasureEvent ehrMeasureEvent, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO ehrmeasureevent (";

            if (!useExistingPK && isRandomKeys)
            {
                ehrMeasureEvent.EhrMeasureEventNum = ReplicationServers.GetKeyNoCache("ehrmeasureevent", "EhrMeasureEventNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "EhrMeasureEventNum,";
            }
            command += "DateTEvent,EventType,PatNum,MoreInfo,CodeValueEvent,CodeSystemEvent,CodeValueResult,CodeSystemResult,FKey,DateStartTobacco,TobaccoCessationDesire) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(ehrMeasureEvent.EhrMeasureEventNum) + ",";
            }
            command +=
                POut.DateT(ehrMeasureEvent.DateTEvent) + ","
                + POut.Int((int)ehrMeasureEvent.EventType) + ","
                + POut.Long(ehrMeasureEvent.PatNum) + ","
                + "'" + POut.String(ehrMeasureEvent.MoreInfo) + "',"
                + "'" + POut.String(ehrMeasureEvent.CodeValueEvent) + "',"
                + "'" + POut.String(ehrMeasureEvent.CodeSystemEvent) + "',"
                + "'" + POut.String(ehrMeasureEvent.CodeValueResult) + "',"
                + "'" + POut.String(ehrMeasureEvent.CodeSystemResult) + "',"
                + POut.Long(ehrMeasureEvent.FKey) + ","
                + POut.Date(ehrMeasureEvent.DateStartTobacco) + ","
                + POut.Byte(ehrMeasureEvent.TobaccoCessationDesire) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                ehrMeasureEvent.EhrMeasureEventNum = Db.NonQ(command, true, "EhrMeasureEventNum", "ehrMeasureEvent");
            }
            return(ehrMeasureEvent.EhrMeasureEventNum);
        }
Beispiel #13
0
        ///<summary>Inserts one Clinic into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Clinic clinic, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                clinic.ClinicNum = ReplicationServers.GetKey("clinic", "ClinicNum");
            }
            string command = "INSERT INTO clinic (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ClinicNum,";
            }
            command += "Description,Address,Address2,City,State,Zip,Phone,BankNumber,DefaultPlaceService,InsBillingProv,Fax,EmailAddressNum) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(clinic.ClinicNum) + ",";
            }
            command +=
                "'" + POut.String(clinic.Description) + "',"
                + "'" + POut.String(clinic.Address) + "',"
                + "'" + POut.String(clinic.Address2) + "',"
                + "'" + POut.String(clinic.City) + "',"
                + "'" + POut.String(clinic.State) + "',"
                + "'" + POut.String(clinic.Zip) + "',"
                + "'" + POut.String(clinic.Phone) + "',"
                + "'" + POut.String(clinic.BankNumber) + "',"
                + POut.Int((int)clinic.DefaultPlaceService) + ","
                + POut.Long(clinic.InsBillingProv) + ","
                + "'" + POut.String(clinic.Fax) + "',"
                + POut.Long(clinic.EmailAddressNum) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                clinic.ClinicNum = Db.NonQ(command, true);
            }
            return(clinic.ClinicNum);
        }
Beispiel #14
0
        ///<summary>Inserts one Fee into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Fee fee, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO fee (";

            if (!useExistingPK && isRandomKeys)
            {
                fee.FeeNum = ReplicationServers.GetKeyNoCache("fee", "FeeNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "FeeNum,";
            }
            command += "Amount,OldCode,FeeSched,UseDefaultFee,UseDefaultCov,CodeNum,ClinicNum,ProvNum,SecUserNumEntry,SecDateEntry) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(fee.FeeNum) + ",";
            }
            command +=
                "'" + POut.Double(fee.Amount) + "',"
                + "'" + POut.String(fee.OldCode) + "',"
                + POut.Long(fee.FeeSched) + ","
                + POut.Bool(fee.UseDefaultFee) + ","
                + POut.Bool(fee.UseDefaultCov) + ","
                + POut.Long(fee.CodeNum) + ","
                + POut.Long(fee.ClinicNum) + ","
                + POut.Long(fee.ProvNum) + ","
                + POut.Long(fee.SecUserNumEntry) + ","
                + DbHelper.Now() + ")";
            //SecDateTEdit can only be set by MySQL
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                fee.FeeNum = Db.NonQ(command, true, "FeeNum", "fee");
            }
            return(fee.FeeNum);
        }
Beispiel #15
0
        ///<summary>Inserts one Encounter into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Encounter encounter, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                encounter.EncounterNum = ReplicationServers.GetKey("encounter", "EncounterNum");
            }
            string command = "INSERT INTO encounter (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "EncounterNum,";
            }
            command += "PatNum,ProvNum,CodeValue,CodeSystem,Note,DateEncounter) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(encounter.EncounterNum) + ",";
            }
            command +=
                POut.Long(encounter.PatNum) + ","
                + POut.Long(encounter.ProvNum) + ","
                + "'" + POut.String(encounter.CodeValue) + "',"
                + "'" + POut.String(encounter.CodeSystem) + "',"
                + DbHelper.ParamChar + "paramNote,"
                + POut.Date(encounter.DateEncounter) + ")";
            if (encounter.Note == null)
            {
                encounter.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(encounter.Note));

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramNote);
            }
            else
            {
                encounter.EncounterNum = Db.NonQ(command, true, "EncounterNum", "encounter", paramNote);
            }
            return(encounter.EncounterNum);
        }
        ///<summary>Inserts one EhrLabResultsCopyTo into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(EhrLabResultsCopyTo ehrLabResultsCopyTo, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                ehrLabResultsCopyTo.EhrLabResultsCopyToNum = ReplicationServers.GetKey("ehrlabresultscopyto", "EhrLabResultsCopyToNum");
            }
            string command = "INSERT INTO ehrlabresultscopyto (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "EhrLabResultsCopyToNum,";
            }
            command += "EhrLabNum,CopyToID,CopyToLName,CopyToFName,CopyToMiddleNames,CopyToSuffix,CopyToPrefix,CopyToAssigningAuthorityNamespaceID,CopyToAssigningAuthorityUniversalID,CopyToAssigningAuthorityIDType,CopyToNameTypeCode,CopyToIdentifierTypeCode) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(ehrLabResultsCopyTo.EhrLabResultsCopyToNum) + ",";
            }
            command +=
                POut.Long(ehrLabResultsCopyTo.EhrLabNum) + ","
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToID) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToLName) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToFName) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToMiddleNames) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToSuffix) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToPrefix) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToAssigningAuthorityNamespaceID) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToAssigningAuthorityUniversalID) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToAssigningAuthorityIDType) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToNameTypeCode.ToString()) + "',"
                + "'" + POut.String(ehrLabResultsCopyTo.CopyToIdentifierTypeCode.ToString()) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                ehrLabResultsCopyTo.EhrLabResultsCopyToNum = Db.NonQ(command, true);
            }
            return(ehrLabResultsCopyTo.EhrLabResultsCopyToNum);
        }
Beispiel #17
0
        ///<summary>Inserts one HL7DefField into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(HL7DefField hL7DefField, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                hL7DefField.HL7DefFieldNum = ReplicationServers.GetKey("hl7deffield", "HL7DefFieldNum");
            }
            string command = "INSERT INTO hl7deffield (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "HL7DefFieldNum,";
            }
            command += "HL7DefSegmentNum,OrdinalPos,TableId,DataType,FieldName,FixedText) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(hL7DefField.HL7DefFieldNum) + ",";
            }
            command +=
                POut.Long(hL7DefField.HL7DefSegmentNum) + ","
                + POut.Int(hL7DefField.OrdinalPos) + ","
                + "'" + POut.String(hL7DefField.TableId) + "',"
                + "'" + POut.String(hL7DefField.DataType.ToString()) + "',"
                + "'" + POut.String(hL7DefField.FieldName) + "',"
                + DbHelper.ParamChar + "paramFixedText)";
            if (hL7DefField.FixedText == null)
            {
                hL7DefField.FixedText = "";
            }
            OdSqlParameter paramFixedText = new OdSqlParameter("paramFixedText", OdDbType.Text, POut.StringParam(hL7DefField.FixedText));

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramFixedText);
            }
            else
            {
                hL7DefField.HL7DefFieldNum = Db.NonQ(command, true, "HL7DefFieldNum", "hL7DefField", paramFixedText);
            }
            return(hL7DefField.HL7DefFieldNum);
        }
Beispiel #18
0
        public RegistrationKey GetByKey(string regKey)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <RegistrationKey>(MethodBase.GetCurrentMethod(), regKey));
            }
            if (!Regex.IsMatch(regKey, @"^[A-Z0-9]{16}$"))
            {
                throw new ApplicationException("Invalid registration key format.");
            }
            string    command = "SELECT * FROM  registrationkey WHERE RegKey='" + POut.String(regKey) + "'";
            DataTable table   = db.GetTable(command);

            if (table.Rows.Count == 0)
            {
                throw new ApplicationException("Invalid registration key.");
            }
            RegistrationKey key = null;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                key = new RegistrationKey();
                key.RegistrationKeyNum = PIn.Int(table.Rows[i][0].ToString());
                key.PatNum             = PIn.Int(table.Rows[i][1].ToString());
                key.RegKey             = PIn.String(table.Rows[i][2].ToString());
                key.Note         = PIn.String(table.Rows[i][3].ToString());
                key.DateStarted  = PIn.Date(table.Rows[i][4].ToString());
                key.DateDisabled = PIn.Date(table.Rows[i][5].ToString());
                key.DateEnded    = PIn.Date(table.Rows[i][6].ToString());
                key.IsForeign    = PIn.Bool(table.Rows[i][7].ToString());
                //key.UsesServerVersion     =PIn.PBool(table.Rows[i][8].ToString());
                key.IsFreeVersion    = PIn.Bool(table.Rows[i][9].ToString());
                key.IsOnlyForTesting = PIn.Bool(table.Rows[i][10].ToString());
                //key.VotesAllotted         =PIn.PInt(table.Rows[i][11].ToString());
            }
            //if(key.DateDisabled.Year>1880){
            //	throw new ApplicationException("This key has been disabled.  Please call for assistance.");
            //}
            return(key);
        }
Beispiel #19
0
        ///<summary>Inserts one CreditCard into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(CreditCard creditCard, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                creditCard.CreditCardNum = ReplicationServers.GetKey("creditcard", "CreditCardNum");
            }
            string command = "INSERT INTO creditcard (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "CreditCardNum,";
            }
            command += "PatNum,Address,Zip,XChargeToken,CCNumberMasked,CCExpiration,ItemOrder,ChargeAmt,DateStart,DateStop,Note,PayPlanNum) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(creditCard.CreditCardNum) + ",";
            }
            command +=
                POut.Long(creditCard.PatNum) + ","
                + "'" + POut.String(creditCard.Address) + "',"
                + "'" + POut.String(creditCard.Zip) + "',"
                + "'" + POut.String(creditCard.XChargeToken) + "',"
                + "'" + POut.String(creditCard.CCNumberMasked) + "',"
                + POut.Date(creditCard.CCExpiration) + ","
                + POut.Int(creditCard.ItemOrder) + ","
                + "'" + POut.Double(creditCard.ChargeAmt) + "',"
                + POut.Date(creditCard.DateStart) + ","
                + POut.Date(creditCard.DateStop) + ","
                + "'" + POut.String(creditCard.Note) + "',"
                + POut.Long(creditCard.PayPlanNum) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                creditCard.CreditCardNum = Db.NonQ(command, true);
            }
            return(creditCard.CreditCardNum);
        }
Beispiel #20
0
        ///<summary>Inserts one SigElementDef into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(SigElementDef sigElementDef, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                sigElementDef.SigElementDefNum = ReplicationServers.GetKey("sigelementdef", "SigElementDefNum");
            }
            string command = "INSERT INTO sigelementdef (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "SigElementDefNum,";
            }
            command += "LightRow,LightColor,SigElementType,SigText,Sound,ItemOrder) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                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, sigElementDef.Sound);

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramSound);
            }
            else
            {
                sigElementDef.SigElementDefNum = Db.NonQ(command, true, paramSound);
            }
            return(sigElementDef.SigElementDefNum);
        }
Beispiel #21
0
        ///<summary>Inserts one PatientNote into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(PatientNote patientNote, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                patientNote.PatNum = ReplicationServers.GetKey("patientnote", "PatNum");
            }
            string command = "INSERT INTO patientnote (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "PatNum,";
            }
            command += "FamFinancial,ApptPhone,Medical,Service,MedicalComp,Treatment) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(patientNote.PatNum) + ",";
            }
            command +=
                "'" + POut.String(patientNote.FamFinancial) + "',"
                + "'" + POut.String(patientNote.ApptPhone) + "',"
                + "'" + POut.String(patientNote.Medical) + "',"
                + "'" + POut.String(patientNote.Service) + "',"
                + DbHelper.ParamChar + "paramMedicalComp,"
                + "'" + POut.String(patientNote.Treatment) + "')";
            if (patientNote.MedicalComp == null)
            {
                patientNote.MedicalComp = "";
            }
            OdSqlParameter paramMedicalComp = new OdSqlParameter("paramMedicalComp", OdDbType.Text, patientNote.MedicalComp);

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramMedicalComp);
            }
            else
            {
                patientNote.PatNum = Db.NonQ(command, true, paramMedicalComp);
            }
            return(patientNote.PatNum);
        }
Beispiel #22
0
        ///<summary>Inserts one HL7DefSegment into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(HL7DefSegment hL7DefSegment, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                hL7DefSegment.HL7DefSegmentNum = ReplicationServers.GetKey("hl7defsegment", "HL7DefSegmentNum");
            }
            string command = "INSERT INTO hl7defsegment (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "HL7DefSegmentNum,";
            }
            command += "HL7DefMessageNum,ItemOrder,CanRepeat,IsOptional,SegmentName,Note) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(hL7DefSegment.HL7DefSegmentNum) + ",";
            }
            command +=
                POut.Long(hL7DefSegment.HL7DefMessageNum) + ","
                + POut.Int(hL7DefSegment.ItemOrder) + ","
                + POut.Bool(hL7DefSegment.CanRepeat) + ","
                + POut.Bool(hL7DefSegment.IsOptional) + ","
                + "'" + POut.String(hL7DefSegment.SegmentName.ToString()) + "',"
                + DbHelper.ParamChar + "paramNote)";
            if (hL7DefSegment.Note == null)
            {
                hL7DefSegment.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, hL7DefSegment.Note);

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramNote);
            }
            else
            {
                hL7DefSegment.HL7DefSegmentNum = Db.NonQ(command, true, paramNote);
            }
            return(hL7DefSegment.HL7DefSegmentNum);
        }
Beispiel #23
0
        ///<summary>Inserts one Operatory into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Operatory operatory, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                operatory.OperatoryNum = ReplicationServers.GetKey("operatory", "OperatoryNum");
            }
            string command = "INSERT INTO operatory (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "OperatoryNum,";
            }
            command += "OpName,Abbrev,ItemOrder,IsHidden,ProvDentist,ProvHygienist,IsHygiene,ClinicNum,SetProspective,IsWebSched,IsNewPatAppt) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(operatory.OperatoryNum) + ",";
            }
            command +=
                "'" + POut.String(operatory.OpName) + "',"
                + "'" + POut.String(operatory.Abbrev) + "',"
                + POut.Int(operatory.ItemOrder) + ","
                + POut.Bool(operatory.IsHidden) + ","
                + POut.Long(operatory.ProvDentist) + ","
                + POut.Long(operatory.ProvHygienist) + ","
                + POut.Bool(operatory.IsHygiene) + ","
                + POut.Long(operatory.ClinicNum) + ","
                + POut.Bool(operatory.SetProspective) + ","
                //DateTStamp can only be set by MySQL
                + POut.Bool(operatory.IsWebSched) + ","
                + POut.Bool(operatory.IsNewPatAppt) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                operatory.OperatoryNum = Db.NonQ(command, true, "OperatoryNum", "operatory");
            }
            return(operatory.OperatoryNum);
        }
Beispiel #24
0
        ///<summary>Inserts one ElectID into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ElectID electID, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO electid (";

            if (!useExistingPK && isRandomKeys)
            {
                electID.ElectIDNum = ReplicationServers.GetKeyNoCache("electid", "ElectIDNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ElectIDNum,";
            }
            command += "PayorID,CarrierName,IsMedicaid,ProviderTypes,Comments) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(electID.ElectIDNum) + ",";
            }
            command +=
                "'" + POut.String(electID.PayorID) + "',"
                + "'" + POut.String(electID.CarrierName) + "',"
                + POut.Bool(electID.IsMedicaid) + ","
                + "'" + POut.String(electID.ProviderTypes) + "',"
                + DbHelper.ParamChar + "paramComments)";
            if (electID.Comments == null)
            {
                electID.Comments = "";
            }
            OdSqlParameter paramComments = new OdSqlParameter("paramComments", OdDbType.Text, POut.StringParam(electID.Comments));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramComments);
            }
            else
            {
                electID.ElectIDNum = Db.NonQ(command, true, "ElectIDNum", "electID", paramComments);
            }
            return(electID.ElectIDNum);
        }
Beispiel #25
0
        ///<summary>Usually set useExistingPK=true.  Inserts one Patientm into the database.</summary>
        internal static long Insert(Patientm patientm, bool useExistingPK)
        {
            if (!useExistingPK)
            {
                patientm.PatNum = ReplicationServers.GetKey("patientm", "PatNum");
            }
            string command = "INSERT INTO patientm (";

            command += "PatNum,";
            command += "CustomerNum,LName,FName,MiddleI,Preferred,PatStatus,Gender,Position,Birthdate,Address,Address2,City,State,Zip,HmPhone,WkPhone,WirelessPhone,Guarantor,Email,AddrNote,ClinicNum,InsEst,BalTotal,PreferContactMethod,OnlinePassword) VALUES(";
            command += POut.Long(patientm.PatNum) + ",";
            command +=
                POut.Long(patientm.CustomerNum) + ","
                + "'" + POut.String(patientm.LName) + "',"
                + "'" + POut.String(patientm.FName) + "',"
                + "'" + POut.String(patientm.MiddleI) + "',"
                + "'" + POut.String(patientm.Preferred) + "',"
                + POut.Int((int)patientm.PatStatus) + ","
                + POut.Int((int)patientm.Gender) + ","
                + POut.Int((int)patientm.Position) + ","
                + POut.Date(patientm.Birthdate) + ","
                + "'" + POut.String(patientm.Address) + "',"
                + "'" + POut.String(patientm.Address2) + "',"
                + "'" + POut.String(patientm.City) + "',"
                + "'" + POut.String(patientm.State) + "',"
                + "'" + POut.String(patientm.Zip) + "',"
                + "'" + POut.String(patientm.HmPhone) + "',"
                + "'" + POut.String(patientm.WkPhone) + "',"
                + "'" + POut.String(patientm.WirelessPhone) + "',"
                + POut.Long(patientm.Guarantor) + ","
                + "'" + POut.String(patientm.Email) + "',"
                + "'" + POut.String(patientm.AddrNote) + "',"
                + POut.Long(patientm.ClinicNum) + ","
                + "'" + POut.Double(patientm.InsEst) + "',"
                + "'" + POut.Double(patientm.BalTotal) + "',"
                + POut.Int((int)patientm.PreferContactMethod) + ","
                + "'" + POut.String(patientm.OnlinePassword) + "')";
            Db.NonQ(command);            //There is no autoincrement in the mobile server.
            return(patientm.PatNum);
        }
Beispiel #26
0
        ///<summary>Inserts one ApptView into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(ApptView apptView, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                apptView.ApptViewNum = ReplicationServers.GetKey("apptview", "ApptViewNum");
            }
            string command = "INSERT INTO apptview (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ApptViewNum,";
            }
            command += "Description,ItemOrder,RowsPerIncr,OnlyScheduledProvs,OnlySchedBeforeTime,OnlySchedAfterTime,StackBehavUR,StackBehavLR,ClinicNum,ApptTimeScrollStart,IsScrollStartDynamic,IsApptBubblesDisabled) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(apptView.ApptViewNum) + ",";
            }
            command +=
                "'" + POut.String(apptView.Description) + "',"
                + POut.Int(apptView.ItemOrder) + ","
                + POut.Byte(apptView.RowsPerIncr) + ","
                + POut.Bool(apptView.OnlyScheduledProvs) + ","
                + POut.Time(apptView.OnlySchedBeforeTime) + ","
                + POut.Time(apptView.OnlySchedAfterTime) + ","
                + POut.Int((int)apptView.StackBehavUR) + ","
                + POut.Int((int)apptView.StackBehavLR) + ","
                + POut.Long(apptView.ClinicNum) + ","
                + POut.Time(apptView.ApptTimeScrollStart) + ","
                + POut.Bool(apptView.IsScrollStartDynamic) + ","
                + POut.Bool(apptView.IsApptBubblesDisabled) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                apptView.ApptViewNum = Db.NonQ(command, true, "ApptViewNum", "apptView");
            }
            return(apptView.ApptViewNum);
        }
Beispiel #27
0
        ///<summary>Inserts one EhrLabSpecimen into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(EhrLabSpecimen ehrLabSpecimen, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO ehrlabspecimen (";

            if (!useExistingPK && isRandomKeys)
            {
                ehrLabSpecimen.EhrLabSpecimenNum = ReplicationServers.GetKeyNoCache("ehrlabspecimen", "EhrLabSpecimenNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "EhrLabSpecimenNum,";
            }
            command += "EhrLabNum,SetIdSPM,SpecimenTypeID,SpecimenTypeText,SpecimenTypeCodeSystemName,SpecimenTypeIDAlt,SpecimenTypeTextAlt,SpecimenTypeCodeSystemNameAlt,SpecimenTypeTextOriginal,CollectionDateTimeStart,CollectionDateTimeEnd) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(ehrLabSpecimen.EhrLabSpecimenNum) + ",";
            }
            command +=
                POut.Long(ehrLabSpecimen.EhrLabNum) + ","
                + POut.Long(ehrLabSpecimen.SetIdSPM) + ","
                + "'" + POut.String(ehrLabSpecimen.SpecimenTypeID) + "',"
                + "'" + POut.String(ehrLabSpecimen.SpecimenTypeText) + "',"
                + "'" + POut.String(ehrLabSpecimen.SpecimenTypeCodeSystemName) + "',"
                + "'" + POut.String(ehrLabSpecimen.SpecimenTypeIDAlt) + "',"
                + "'" + POut.String(ehrLabSpecimen.SpecimenTypeTextAlt) + "',"
                + "'" + POut.String(ehrLabSpecimen.SpecimenTypeCodeSystemNameAlt) + "',"
                + "'" + POut.String(ehrLabSpecimen.SpecimenTypeTextOriginal) + "',"
                + "'" + POut.String(ehrLabSpecimen.CollectionDateTimeStart) + "',"
                + "'" + POut.String(ehrLabSpecimen.CollectionDateTimeEnd) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                ehrLabSpecimen.EhrLabSpecimenNum = Db.NonQ(command, true, "EhrLabSpecimenNum", "ehrLabSpecimen");
            }
            return(ehrLabSpecimen.EhrLabSpecimenNum);
        }
        ///<summary>Inserts one EhrQuarterlyKey into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(EhrQuarterlyKey ehrQuarterlyKey, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                ehrQuarterlyKey.EhrQuarterlyKeyNum = ReplicationServers.GetKey("ehrquarterlykey", "EhrQuarterlyKeyNum");
            }
            string command = "INSERT INTO ehrquarterlykey (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "EhrQuarterlyKeyNum,";
            }
            command += "YearValue,QuarterValue,PracticeName,KeyValue,PatNum,Notes) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                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 || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramNotes);
            }
            else
            {
                ehrQuarterlyKey.EhrQuarterlyKeyNum = Db.NonQ(command, true, "EhrQuarterlyKeyNum", "ehrQuarterlyKey", paramNotes);
            }
            return(ehrQuarterlyKey.EhrQuarterlyKeyNum);
        }
Beispiel #29
0
        ///<summary>Inserts one HL7DefMessage into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(HL7DefMessage hL7DefMessage, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                hL7DefMessage.HL7DefMessageNum = ReplicationServers.GetKey("hl7defmessage", "HL7DefMessageNum");
            }
            string command = "INSERT INTO hl7defmessage (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "HL7DefMessageNum,";
            }
            command += "HL7DefNum,MessageType,EventType,InOrOut,ItemOrder,Note) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(hL7DefMessage.HL7DefMessageNum) + ",";
            }
            command +=
                POut.Long(hL7DefMessage.HL7DefNum) + ","
                + "'" + POut.String(hL7DefMessage.MessageType.ToString()) + "',"
                + "'" + POut.String(hL7DefMessage.EventType.ToString()) + "',"
                + POut.Int((int)hL7DefMessage.InOrOut) + ","
                + POut.Int(hL7DefMessage.ItemOrder) + ","
                + DbHelper.ParamChar + "paramNote)";
            if (hL7DefMessage.Note == null)
            {
                hL7DefMessage.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, hL7DefMessage.Note);

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramNote);
            }
            else
            {
                hL7DefMessage.HL7DefMessageNum = Db.NonQ(command, true, paramNote);
            }
            return(hL7DefMessage.HL7DefMessageNum);
        }
Beispiel #30
0
        ///<summary>Inserts one Userod into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Userod userod, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                userod.UserNum = ReplicationServers.GetKey("userod", "UserNum");
            }
            string command = "INSERT INTO userod (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "UserNum,";
            }
            command += "UserName,Password,UserGroupNum,EmployeeNum,ClinicNum,ProvNum,IsHidden,TaskListInBox,AnesthProvType,DefaultHidePopups,PasswordIsStrong,ClinicIsRestricted) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(userod.UserNum) + ",";
            }
            command +=
                "'" + POut.String(userod.UserName) + "',"
                + "'" + POut.String(userod.Password) + "',"
                + POut.Long(userod.UserGroupNum) + ","
                + POut.Long(userod.EmployeeNum) + ","
                + POut.Long(userod.ClinicNum) + ","
                + POut.Long(userod.ProvNum) + ","
                + POut.Bool(userod.IsHidden) + ","
                + POut.Long(userod.TaskListInBox) + ","
                + POut.Int(userod.AnesthProvType) + ","
                + POut.Bool(userod.DefaultHidePopups) + ","
                + POut.Bool(userod.PasswordIsStrong) + ","
                + POut.Bool(userod.ClinicIsRestricted) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                userod.UserNum = Db.NonQ(command, true);
            }
            return(userod.UserNum);
        }