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

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "DiseaseDefNum,";
            }
            command += "DiseaseName,ItemOrder,IsHidden,ICD9Code,SnomedCode,Icd10Code) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(diseaseDef.DiseaseDefNum) + ",";
            }
            command +=
                "'" + POut.StringNote(diseaseDef.DiseaseName, true) + "',"
                + POut.Int(diseaseDef.ItemOrder) + ","
                + POut.Bool(diseaseDef.IsHidden) + ","
                //DateTStamp can only be set by MySQL
                + "'" + POut.String(diseaseDef.ICD9Code) + "',"
                + "'" + POut.String(diseaseDef.SnomedCode) + "',"
                + "'" + POut.String(diseaseDef.Icd10Code) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                diseaseDef.DiseaseDefNum = Db.NonQ(command, true, "DiseaseDefNum", "diseaseDef");
            }
            return(diseaseDef.DiseaseDefNum);
        }
Exemplo n.º 2
0
        ///<summary>Inserts one Def into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Def def, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO definition (";

            if (!useExistingPK && isRandomKeys)
            {
                def.DefNum = ReplicationServers.GetKeyNoCache("definition", "DefNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "DefNum,";
            }
            command += "Category,ItemOrder,ItemName,ItemValue,ItemColor,IsHidden) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(def.DefNum) + ",";
            }
            command +=
                POut.Int((int)def.Category) + ","
                + POut.Int(def.ItemOrder) + ","
                + "'" + POut.StringNote(def.ItemName, true) + "',"
                + "'" + POut.String(def.ItemValue) + "',"
                + POut.Int(def.ItemColor.ToArgb()) + ","
                + POut.Bool(def.IsHidden) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                def.DefNum = Db.NonQ(command, true, "DefNum", "def");
            }
            return(def.DefNum);
        }
Exemplo n.º 3
0
        ///<summary>Updates one Def in the database.</summary>
        public static void Update(Def def)
        {
            string command = "UPDATE definition SET "
                             + "Category =  " + POut.Int((int)def.Category) + ", "
                             + "ItemOrder=  " + POut.Int(def.ItemOrder) + ", "
                             + "ItemName = '" + POut.StringNote(def.ItemName, true) + "', "
                             + "ItemValue= '" + POut.String(def.ItemValue) + "', "
                             + "ItemColor=  " + POut.Int(def.ItemColor.ToArgb()) + ", "
                             + "IsHidden =  " + POut.Bool(def.IsHidden) + " "
                             + "WHERE DefNum = " + POut.Long(def.DefNum);

            Db.NonQ(command);
        }
Exemplo n.º 4
0
        ///<summary>Updates one DiseaseDef in the database.</summary>
        public static void Update(DiseaseDef diseaseDef)
        {
            string command = "UPDATE diseasedef SET "
                             + "DiseaseName  = '" + POut.StringNote(diseaseDef.DiseaseName, true) + "', "
                             + "ItemOrder    =  " + POut.Int(diseaseDef.ItemOrder) + ", "
                             + "IsHidden     =  " + POut.Bool(diseaseDef.IsHidden) + ", "
                             //DateTStamp can only be set by MySQL
                             + "ICD9Code     = '" + POut.String(diseaseDef.ICD9Code) + "', "
                             + "SnomedCode   = '" + POut.String(diseaseDef.SnomedCode) + "', "
                             + "Icd10Code    = '" + POut.String(diseaseDef.Icd10Code) + "' "
                             + "WHERE DiseaseDefNum = " + POut.Long(diseaseDef.DiseaseDefNum);

            Db.NonQ(command);
        }
Exemplo n.º 5
0
        ///<summary>Updates one PatientNote 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(PatientNote patientNote, PatientNote oldPatientNote)
        {
            string command = "";

            //FamFinancial excluded from update
            if (patientNote.ApptPhone != oldPatientNote.ApptPhone)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ApptPhone = " + DbHelper.ParamChar + "paramApptPhone";
            }
            if (patientNote.Medical != oldPatientNote.Medical)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Medical = " + DbHelper.ParamChar + "paramMedical";
            }
            if (patientNote.Service != oldPatientNote.Service)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Service = " + DbHelper.ParamChar + "paramService";
            }
            if (patientNote.MedicalComp != oldPatientNote.MedicalComp)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicalComp = " + DbHelper.ParamChar + "paramMedicalComp";
            }
            if (patientNote.Treatment != oldPatientNote.Treatment)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Treatment = " + DbHelper.ParamChar + "paramTreatment";
            }
            if (patientNote.ICEName != oldPatientNote.ICEName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ICEName = '" + POut.String(patientNote.ICEName) + "'";
            }
            if (patientNote.ICEPhone != oldPatientNote.ICEPhone)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ICEPhone = '" + POut.String(patientNote.ICEPhone) + "'";
            }
            if (patientNote.OrthoMonthsTreatOverride != oldPatientNote.OrthoMonthsTreatOverride)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OrthoMonthsTreatOverride = " + POut.Int(patientNote.OrthoMonthsTreatOverride) + "";
            }
            if (patientNote.DateOrthoPlacementOverride.Date != oldPatientNote.DateOrthoPlacementOverride.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateOrthoPlacementOverride = " + POut.Date(patientNote.DateOrthoPlacementOverride) + "";
            }
            //SecDateTEntry not allowed to change
            //SecDateTEdit can only be set by MySQL
            if (patientNote.Consent != oldPatientNote.Consent)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Consent = " + POut.Int((int)patientNote.Consent) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (patientNote.FamFinancial == null)
            {
                patientNote.FamFinancial = "";
            }
            OdSqlParameter paramFamFinancial = new OdSqlParameter("paramFamFinancial", OdDbType.Text, POut.StringNote(patientNote.FamFinancial));

            if (patientNote.ApptPhone == null)
            {
                patientNote.ApptPhone = "";
            }
            OdSqlParameter paramApptPhone = new OdSqlParameter("paramApptPhone", OdDbType.Text, POut.StringParam(patientNote.ApptPhone));

            if (patientNote.Medical == null)
            {
                patientNote.Medical = "";
            }
            OdSqlParameter paramMedical = new OdSqlParameter("paramMedical", OdDbType.Text, POut.StringNote(patientNote.Medical));

            if (patientNote.Service == null)
            {
                patientNote.Service = "";
            }
            OdSqlParameter paramService = new OdSqlParameter("paramService", OdDbType.Text, POut.StringNote(patientNote.Service));

            if (patientNote.MedicalComp == null)
            {
                patientNote.MedicalComp = "";
            }
            OdSqlParameter paramMedicalComp = new OdSqlParameter("paramMedicalComp", OdDbType.Text, POut.StringNote(patientNote.MedicalComp));

            if (patientNote.Treatment == null)
            {
                patientNote.Treatment = "";
            }
            OdSqlParameter paramTreatment = new OdSqlParameter("paramTreatment", OdDbType.Text, POut.StringNote(patientNote.Treatment));

            command = "UPDATE patientnote SET " + command
                      + " WHERE PatNum = " + POut.Long(patientNote.PatNum);
            Db.NonQ(command, paramFamFinancial, paramApptPhone, paramMedical, paramService, paramMedicalComp, paramTreatment);
            return(true);
        }
Exemplo n.º 6
0
        ///<summary>Updates one DispSupply in the database.</summary>
        public static void Update(DispSupply dispSupply)
        {
            string command = "UPDATE dispsupply SET "
                             + "SupplyNum    =  " + POut.Long(dispSupply.SupplyNum) + ", "
                             + "ProvNum      =  " + POut.Long(dispSupply.ProvNum) + ", "
                             + "DateDispensed=  " + POut.Date(dispSupply.DateDispensed) + ", "
                             + "DispQuantity =  " + POut.Float(dispSupply.DispQuantity) + ", "
                             + "Note         =  " + DbHelper.ParamChar + "paramNote "
                             + "WHERE DispSupplyNum = " + POut.Long(dispSupply.DispSupplyNum);

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

            Db.NonQ(command, paramNote);
        }
Exemplo n.º 7
0
        ///<summary>Updates one WebChatSession 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(WebChatSession webChatSession, WebChatSession oldWebChatSession)
        {
            string command = "";

            if (webChatSession.UserName != oldWebChatSession.UserName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UserName = '******'";
            }
            if (webChatSession.PracticeName != oldWebChatSession.PracticeName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PracticeName = '" + POut.String(webChatSession.PracticeName) + "'";
            }
            if (webChatSession.EmailAddress != oldWebChatSession.EmailAddress)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmailAddress = '" + POut.String(webChatSession.EmailAddress) + "'";
            }
            if (webChatSession.PhoneNumber != oldWebChatSession.PhoneNumber)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PhoneNumber = '" + POut.String(webChatSession.PhoneNumber) + "'";
            }
            if (webChatSession.IsCustomer != oldWebChatSession.IsCustomer)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsCustomer = " + POut.Bool(webChatSession.IsCustomer) + "";
            }
            if (webChatSession.QuestionText != oldWebChatSession.QuestionText)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "QuestionText = '" + POut.String(webChatSession.QuestionText) + "'";
            }
            if (webChatSession.TechName != oldWebChatSession.TechName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TechName = '" + POut.String(webChatSession.TechName) + "'";
            }
            if (webChatSession.DateTcreated != oldWebChatSession.DateTcreated)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTcreated = " + POut.DateT(webChatSession.DateTcreated) + "";
            }
            if (webChatSession.DateTend != oldWebChatSession.DateTend)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTend = " + POut.DateT(webChatSession.DateTend) + "";
            }
            if (webChatSession.PatNum != oldWebChatSession.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(webChatSession.PatNum) + "";
            }
            if (webChatSession.Note != oldWebChatSession.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (command == "")
            {
                return(false);
            }
            if (webChatSession.Note == null)
            {
                webChatSession.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(webChatSession.Note));

            command = "UPDATE webchatsession SET " + command
                      + " WHERE WebChatSessionNum = " + POut.Long(webChatSession.WebChatSessionNum);
            Db.NonQ(command, paramNote);
            return(true);
        }
Exemplo n.º 8
0
        ///<summary>Inserts one WebChatSession into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(WebChatSession webChatSession, bool useExistingPK)
        {
            string command = "INSERT INTO webchatsession (";

            if (useExistingPK)
            {
                command += "WebChatSessionNum,";
            }
            command += "UserName,PracticeName,EmailAddress,PhoneNumber,IsCustomer,QuestionText,TechName,DateTcreated,DateTend,PatNum,Note) VALUES(";
            if (useExistingPK)
            {
                command += POut.Long(webChatSession.WebChatSessionNum) + ",";
            }
            command +=
                "'" + POut.String(webChatSession.UserName) + "',"
                + "'" + POut.String(webChatSession.PracticeName) + "',"
                + "'" + POut.String(webChatSession.EmailAddress) + "',"
                + "'" + POut.String(webChatSession.PhoneNumber) + "',"
                + POut.Bool(webChatSession.IsCustomer) + ","
                + "'" + POut.String(webChatSession.QuestionText) + "',"
                + "'" + POut.String(webChatSession.TechName) + "',"
                + POut.DateT(webChatSession.DateTcreated) + ","
                + POut.DateT(webChatSession.DateTend) + ","
                + POut.Long(webChatSession.PatNum) + ","
                + DbHelper.ParamChar + "paramNote)";
            if (webChatSession.Note == null)
            {
                webChatSession.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(webChatSession.Note));

            if (useExistingPK)
            {
                Db.NonQ(command, paramNote);
            }
            else
            {
                webChatSession.WebChatSessionNum = Db.NonQ(command, true, "WebChatSessionNum", "webChatSession", paramNote);
            }
            return(webChatSession.WebChatSessionNum);
        }
Exemplo n.º 9
0
        ///<summary>Updates one InsVerify in the database.</summary>
        public static void Update(InsVerify insVerify)
        {
            string command = "UPDATE insverify SET "
                             + "DateLastVerified             =  " + POut.Date(insVerify.DateLastVerified) + ", "
                             + "UserNum                      =  " + POut.Long(insVerify.UserNum) + ", "
                             + "VerifyType                   =  " + POut.Int((int)insVerify.VerifyType) + ", "
                             + "FKey                         =  " + POut.Long(insVerify.FKey) + ", "
                             + "DefNum                       =  " + POut.Long(insVerify.DefNum) + ", "
                             + "DateLastAssigned             =  " + POut.Date(insVerify.DateLastAssigned) + ", "
                             + "Note                         =  " + DbHelper.ParamChar + "paramNote, "
                             //DateTimeEntry not allowed to change
                             + "HoursAvailableForVerification= '" + POut.Double(insVerify.HoursAvailableForVerification) + "' "
                             + "WHERE InsVerifyNum = " + POut.Long(insVerify.InsVerifyNum);

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

            Db.NonQ(command, paramNote);
        }
Exemplo n.º 10
0
        ///<summary>Updates one Adjustment 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(Adjustment adjustment, Adjustment oldAdjustment)
        {
            string command = "";

            if (adjustment.AdjDate.Date != oldAdjustment.AdjDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AdjDate = " + POut.Date(adjustment.AdjDate) + "";
            }
            if (adjustment.AdjAmt != oldAdjustment.AdjAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AdjAmt = '" + POut.Double(adjustment.AdjAmt) + "'";
            }
            if (adjustment.PatNum != oldAdjustment.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(adjustment.PatNum) + "";
            }
            if (adjustment.AdjType != oldAdjustment.AdjType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AdjType = " + POut.Long(adjustment.AdjType) + "";
            }
            if (adjustment.ProvNum != oldAdjustment.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(adjustment.ProvNum) + "";
            }
            if (adjustment.AdjNote != oldAdjustment.AdjNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AdjNote = " + DbHelper.ParamChar + "paramAdjNote";
            }
            if (adjustment.ProcDate.Date != oldAdjustment.ProcDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcDate = " + POut.Date(adjustment.ProcDate) + "";
            }
            if (adjustment.ProcNum != oldAdjustment.ProcNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNum = " + POut.Long(adjustment.ProcNum) + "";
            }
            //DateEntry not allowed to change
            if (adjustment.ClinicNum != oldAdjustment.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(adjustment.ClinicNum) + "";
            }
            if (adjustment.StatementNum != oldAdjustment.StatementNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StatementNum = " + POut.Long(adjustment.StatementNum) + "";
            }
            //SecUserNumEntry excluded from update
            //SecDateTEdit can only be set by MySQL
            if (adjustment.TaxTransID != oldAdjustment.TaxTransID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TaxTransID = " + POut.Long(adjustment.TaxTransID) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (adjustment.AdjNote == null)
            {
                adjustment.AdjNote = "";
            }
            OdSqlParameter paramAdjNote = new OdSqlParameter("paramAdjNote", OdDbType.Text, POut.StringNote(adjustment.AdjNote));

            command = "UPDATE adjustment SET " + command
                      + " WHERE AdjNum = " + POut.Long(adjustment.AdjNum);
            Db.NonQ(command, paramAdjNote);
            return(true);
        }
Exemplo n.º 11
0
        ///<summary>Inserts one Adjustment into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Adjustment adjustment, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO adjustment (";

            if (!useExistingPK && isRandomKeys)
            {
                adjustment.AdjNum = ReplicationServers.GetKeyNoCache("adjustment", "AdjNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "AdjNum,";
            }
            command += "AdjDate,AdjAmt,PatNum,AdjType,ProvNum,AdjNote,ProcDate,ProcNum,DateEntry,ClinicNum,StatementNum,SecUserNumEntry,TaxTransID) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(adjustment.AdjNum) + ",";
            }
            command +=
                POut.Date(adjustment.AdjDate) + ","
                + "'" + POut.Double(adjustment.AdjAmt) + "',"
                + POut.Long(adjustment.PatNum) + ","
                + POut.Long(adjustment.AdjType) + ","
                + POut.Long(adjustment.ProvNum) + ","
                + DbHelper.ParamChar + "paramAdjNote,"
                + POut.Date(adjustment.ProcDate) + ","
                + POut.Long(adjustment.ProcNum) + ","
                + DbHelper.Now() + ","
                + POut.Long(adjustment.ClinicNum) + ","
                + POut.Long(adjustment.StatementNum) + ","
                + POut.Long(adjustment.SecUserNumEntry) + ","
                //SecDateTEdit can only be set by MySQL
                + POut.Long(adjustment.TaxTransID) + ")";
            if (adjustment.AdjNote == null)
            {
                adjustment.AdjNote = "";
            }
            OdSqlParameter paramAdjNote = new OdSqlParameter("paramAdjNote", OdDbType.Text, POut.StringNote(adjustment.AdjNote));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramAdjNote);
            }
            else
            {
                adjustment.AdjNum = Db.NonQ(command, true, "AdjNum", "adjustment", paramAdjNote);
            }
            return(adjustment.AdjNum);
        }
Exemplo n.º 12
0
        ///<summary>Inserts one HistAppointment into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(HistAppointment histAppointment, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO histappointment (";

            if (!useExistingPK && isRandomKeys)
            {
                histAppointment.HistApptNum = ReplicationServers.GetKeyNoCache("histappointment", "HistApptNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "HistApptNum,";
            }
            command += "HistUserNum,HistDateTStamp,HistApptAction,ApptSource,AptNum,PatNum,AptStatus,Pattern,Confirmed,TimeLocked,Op,Note,ProvNum,ProvHyg,AptDateTime,NextAptNum,UnschedStatus,IsNewPatient,ProcDescript,Assistant,ClinicNum,IsHygiene,DateTStamp,DateTimeArrived,DateTimeSeated,DateTimeDismissed,InsPlan1,InsPlan2,DateTimeAskedToArrive,ProcsColored,ColorOverride,AppointmentTypeNum,SecUserNumEntry,SecDateTEntry,Priority,ProvBarText,PatternSecondary) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(histAppointment.HistApptNum) + ",";
            }
            command +=
                POut.Long(histAppointment.HistUserNum) + ","
                + DbHelper.Now() + ","
                + POut.Int((int)histAppointment.HistApptAction) + ","
                + POut.Int((int)histAppointment.ApptSource) + ","
                + POut.Long(histAppointment.AptNum) + ","
                + POut.Long(histAppointment.PatNum) + ","
                + POut.Int((int)histAppointment.AptStatus) + ","
                + "'" + POut.String(histAppointment.Pattern) + "',"
                + POut.Long(histAppointment.Confirmed) + ","
                + POut.Bool(histAppointment.TimeLocked) + ","
                + POut.Long(histAppointment.Op) + ","
                + DbHelper.ParamChar + "paramNote,"
                + POut.Long(histAppointment.ProvNum) + ","
                + POut.Long(histAppointment.ProvHyg) + ","
                + POut.DateT(histAppointment.AptDateTime) + ","
                + POut.Long(histAppointment.NextAptNum) + ","
                + POut.Long(histAppointment.UnschedStatus) + ","
                + POut.Bool(histAppointment.IsNewPatient) + ","
                + "'" + POut.String(histAppointment.ProcDescript) + "',"
                + POut.Long(histAppointment.Assistant) + ","
                + POut.Long(histAppointment.ClinicNum) + ","
                + POut.Bool(histAppointment.IsHygiene) + ","
                + POut.DateT(histAppointment.DateTStamp) + ","
                + POut.DateT(histAppointment.DateTimeArrived) + ","
                + POut.DateT(histAppointment.DateTimeSeated) + ","
                + POut.DateT(histAppointment.DateTimeDismissed) + ","
                + POut.Long(histAppointment.InsPlan1) + ","
                + POut.Long(histAppointment.InsPlan2) + ","
                + POut.DateT(histAppointment.DateTimeAskedToArrive) + ","
                + DbHelper.ParamChar + "paramProcsColored,"
                + POut.Int(histAppointment.ColorOverride.ToArgb()) + ","
                + POut.Long(histAppointment.AppointmentTypeNum) + ","
                + POut.Long(histAppointment.SecUserNumEntry) + ","
                + POut.DateT(histAppointment.SecDateTEntry) + ","
                + POut.Int((int)histAppointment.Priority) + ","
                + "'" + POut.String(histAppointment.ProvBarText) + "',"
                + "'" + POut.String(histAppointment.PatternSecondary) + "')";
            if (histAppointment.Note == null)
            {
                histAppointment.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(histAppointment.Note));

            if (histAppointment.ProcsColored == null)
            {
                histAppointment.ProcsColored = "";
            }
            OdSqlParameter paramProcsColored = new OdSqlParameter("paramProcsColored", OdDbType.Text, POut.StringParam(histAppointment.ProcsColored));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNote, paramProcsColored);
            }
            else
            {
                histAppointment.HistApptNum = Db.NonQ(command, true, "HistApptNum", "histAppointment", paramNote, paramProcsColored);
            }
            return(histAppointment.HistApptNum);
        }
Exemplo n.º 13
0
        ///<summary>Updates one SmsFromMobile 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(SmsFromMobile smsFromMobile, SmsFromMobile oldSmsFromMobile)
        {
            string command = "";

            if (smsFromMobile.PatNum != oldSmsFromMobile.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(smsFromMobile.PatNum) + "";
            }
            if (smsFromMobile.ClinicNum != oldSmsFromMobile.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(smsFromMobile.ClinicNum) + "";
            }
            if (smsFromMobile.CommlogNum != oldSmsFromMobile.CommlogNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CommlogNum = " + POut.Long(smsFromMobile.CommlogNum) + "";
            }
            if (smsFromMobile.MsgText != oldSmsFromMobile.MsgText)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MsgText = " + DbHelper.ParamChar + "paramMsgText";
            }
            if (smsFromMobile.DateTimeReceived != oldSmsFromMobile.DateTimeReceived)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTimeReceived = " + POut.DateT(smsFromMobile.DateTimeReceived) + "";
            }
            if (smsFromMobile.SmsPhoneNumber != oldSmsFromMobile.SmsPhoneNumber)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SmsPhoneNumber = '" + POut.String(smsFromMobile.SmsPhoneNumber) + "'";
            }
            if (smsFromMobile.MobilePhoneNumber != oldSmsFromMobile.MobilePhoneNumber)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MobilePhoneNumber = '" + POut.String(smsFromMobile.MobilePhoneNumber) + "'";
            }
            if (smsFromMobile.MsgPart != oldSmsFromMobile.MsgPart)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MsgPart = " + POut.Int(smsFromMobile.MsgPart) + "";
            }
            if (smsFromMobile.MsgTotal != oldSmsFromMobile.MsgTotal)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MsgTotal = " + POut.Int(smsFromMobile.MsgTotal) + "";
            }
            if (smsFromMobile.MsgRefID != oldSmsFromMobile.MsgRefID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MsgRefID = '" + POut.String(smsFromMobile.MsgRefID) + "'";
            }
            if (smsFromMobile.SmsStatus != oldSmsFromMobile.SmsStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SmsStatus = " + POut.Int((int)smsFromMobile.SmsStatus) + "";
            }
            if (smsFromMobile.Flags != oldSmsFromMobile.Flags)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Flags = '" + POut.String(smsFromMobile.Flags) + "'";
            }
            if (smsFromMobile.IsHidden != oldSmsFromMobile.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(smsFromMobile.IsHidden) + "";
            }
            if (smsFromMobile.MatchCount != oldSmsFromMobile.MatchCount)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MatchCount = " + POut.Int(smsFromMobile.MatchCount) + "";
            }
            if (smsFromMobile.GuidMessage != oldSmsFromMobile.GuidMessage)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "GuidMessage = '" + POut.String(smsFromMobile.GuidMessage) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            if (smsFromMobile.MsgText == null)
            {
                smsFromMobile.MsgText = "";
            }
            OdSqlParameter paramMsgText = new OdSqlParameter("paramMsgText", OdDbType.Text, POut.StringNote(smsFromMobile.MsgText));

            command = "UPDATE smsfrommobile SET " + command
                      + " WHERE SmsFromMobileNum = " + POut.Long(smsFromMobile.SmsFromMobileNum);
            Db.NonQ(command, paramMsgText);
            return(true);
        }
Exemplo n.º 14
0
        ///<summary>Updates one SmsFromMobile in the database.</summary>
        public static void Update(SmsFromMobile smsFromMobile)
        {
            string command = "UPDATE smsfrommobile SET "
                             + "PatNum           =  " + POut.Long(smsFromMobile.PatNum) + ", "
                             + "ClinicNum        =  " + POut.Long(smsFromMobile.ClinicNum) + ", "
                             + "CommlogNum       =  " + POut.Long(smsFromMobile.CommlogNum) + ", "
                             + "MsgText          =  " + DbHelper.ParamChar + "paramMsgText, "
                             + "DateTimeReceived =  " + POut.DateT(smsFromMobile.DateTimeReceived) + ", "
                             + "SmsPhoneNumber   = '" + POut.String(smsFromMobile.SmsPhoneNumber) + "', "
                             + "MobilePhoneNumber= '" + POut.String(smsFromMobile.MobilePhoneNumber) + "', "
                             + "MsgPart          =  " + POut.Int(smsFromMobile.MsgPart) + ", "
                             + "MsgTotal         =  " + POut.Int(smsFromMobile.MsgTotal) + ", "
                             + "MsgRefID         = '" + POut.String(smsFromMobile.MsgRefID) + "', "
                             + "SmsStatus        =  " + POut.Int((int)smsFromMobile.SmsStatus) + ", "
                             + "Flags            = '" + POut.String(smsFromMobile.Flags) + "', "
                             + "IsHidden         =  " + POut.Bool(smsFromMobile.IsHidden) + ", "
                             + "MatchCount       =  " + POut.Int(smsFromMobile.MatchCount) + ", "
                             + "GuidMessage      = '" + POut.String(smsFromMobile.GuidMessage) + "' "
                             + "WHERE SmsFromMobileNum = " + POut.Long(smsFromMobile.SmsFromMobileNum);

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

            Db.NonQ(command, paramMsgText);
        }
Exemplo n.º 15
0
        ///<summary>Inserts one SmsFromMobile into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(SmsFromMobile smsFromMobile, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO smsfrommobile (";

            if (!useExistingPK && isRandomKeys)
            {
                smsFromMobile.SmsFromMobileNum = ReplicationServers.GetKeyNoCache("smsfrommobile", "SmsFromMobileNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "SmsFromMobileNum,";
            }
            command += "PatNum,ClinicNum,CommlogNum,MsgText,DateTimeReceived,SmsPhoneNumber,MobilePhoneNumber,MsgPart,MsgTotal,MsgRefID,SmsStatus,Flags,IsHidden,MatchCount,GuidMessage) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(smsFromMobile.SmsFromMobileNum) + ",";
            }
            command +=
                POut.Long(smsFromMobile.PatNum) + ","
                + POut.Long(smsFromMobile.ClinicNum) + ","
                + POut.Long(smsFromMobile.CommlogNum) + ","
                + DbHelper.ParamChar + "paramMsgText,"
                + POut.DateT(smsFromMobile.DateTimeReceived) + ","
                + "'" + POut.String(smsFromMobile.SmsPhoneNumber) + "',"
                + "'" + POut.String(smsFromMobile.MobilePhoneNumber) + "',"
                + POut.Int(smsFromMobile.MsgPart) + ","
                + POut.Int(smsFromMobile.MsgTotal) + ","
                + "'" + POut.String(smsFromMobile.MsgRefID) + "',"
                + POut.Int((int)smsFromMobile.SmsStatus) + ","
                + "'" + POut.String(smsFromMobile.Flags) + "',"
                + POut.Bool(smsFromMobile.IsHidden) + ","
                + POut.Int(smsFromMobile.MatchCount) + ","
                + "'" + POut.String(smsFromMobile.GuidMessage) + "')";
            if (smsFromMobile.MsgText == null)
            {
                smsFromMobile.MsgText = "";
            }
            OdSqlParameter paramMsgText = new OdSqlParameter("paramMsgText", OdDbType.Text, POut.StringNote(smsFromMobile.MsgText));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramMsgText);
            }
            else
            {
                smsFromMobile.SmsFromMobileNum = Db.NonQ(command, true, "SmsFromMobileNum", "smsFromMobile", paramMsgText);
            }
            return(smsFromMobile.SmsFromMobileNum);
        }
Exemplo n.º 16
0
        ///<summary>Updates one DiseaseDef 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(DiseaseDef diseaseDef, DiseaseDef oldDiseaseDef)
        {
            string command = "";

            if (diseaseDef.DiseaseName != oldDiseaseDef.DiseaseName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DiseaseName = '" + POut.StringNote(diseaseDef.DiseaseName, true) + "'";
            }
            if (diseaseDef.ItemOrder != oldDiseaseDef.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(diseaseDef.ItemOrder) + "";
            }
            if (diseaseDef.IsHidden != oldDiseaseDef.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(diseaseDef.IsHidden) + "";
            }
            //DateTStamp can only be set by MySQL
            if (diseaseDef.ICD9Code != oldDiseaseDef.ICD9Code)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ICD9Code = '" + POut.String(diseaseDef.ICD9Code) + "'";
            }
            if (diseaseDef.SnomedCode != oldDiseaseDef.SnomedCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SnomedCode = '" + POut.String(diseaseDef.SnomedCode) + "'";
            }
            if (diseaseDef.Icd10Code != oldDiseaseDef.Icd10Code)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Icd10Code = '" + POut.String(diseaseDef.Icd10Code) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE diseasedef SET " + command
                      + " WHERE DiseaseDefNum = " + POut.Long(diseaseDef.DiseaseDefNum);
            Db.NonQ(command);
            return(true);
        }
Exemplo n.º 17
0
        ///<summary>Updates one Def 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(Def def, Def oldDef)
        {
            string command = "";

            if (def.Category != oldDef.Category)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Category = " + POut.Int((int)def.Category) + "";
            }
            if (def.ItemOrder != oldDef.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(def.ItemOrder) + "";
            }
            if (def.ItemName != oldDef.ItemName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemName = '" + POut.StringNote(def.ItemName, true) + "'";
            }
            if (def.ItemValue != oldDef.ItemValue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemValue = '" + POut.String(def.ItemValue) + "'";
            }
            if (def.ItemColor != oldDef.ItemColor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemColor = " + POut.Int(def.ItemColor.ToArgb()) + "";
            }
            if (def.IsHidden != oldDef.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(def.IsHidden) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE definition SET " + command
                      + " WHERE DefNum = " + POut.Long(def.DefNum);
            Db.NonQ(command);
            return(true);
        }
Exemplo n.º 18
0
        ///<summary>Inserts one Payment into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Payment payment, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO payment (";

            if (!useExistingPK && isRandomKeys)
            {
                payment.PayNum = ReplicationServers.GetKeyNoCache("payment", "PayNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "PayNum,";
            }
            command += "PayType,PayDate,PayAmt,CheckNum,BankBranch,PayNote,IsSplit,PatNum,ClinicNum,DateEntry,DepositNum,Receipt,IsRecurringCC,SecUserNumEntry,PaymentSource,ProcessStatus,RecurringChargeDate) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(payment.PayNum) + ",";
            }
            command +=
                POut.Long(payment.PayType) + ","
                + POut.Date(payment.PayDate) + ","
                + "'" + POut.Double(payment.PayAmt) + "',"
                + "'" + POut.String(payment.CheckNum) + "',"
                + "'" + POut.String(payment.BankBranch) + "',"
                + DbHelper.ParamChar + "paramPayNote,"
                + POut.Bool(payment.IsSplit) + ","
                + POut.Long(payment.PatNum) + ","
                + POut.Long(payment.ClinicNum) + ","
                + DbHelper.Now() + ","
                + POut.Long(payment.DepositNum) + ","
                + DbHelper.ParamChar + "paramReceipt,"
                + POut.Bool(payment.IsRecurringCC) + ","
                + POut.Long(payment.SecUserNumEntry) + ","
                //SecDateTEdit can only be set by MySQL
                + POut.Int((int)payment.PaymentSource) + ","
                + POut.Int((int)payment.ProcessStatus) + ","
                + POut.Date(payment.RecurringChargeDate) + ")";
            if (payment.PayNote == null)
            {
                payment.PayNote = "";
            }
            OdSqlParameter paramPayNote = new OdSqlParameter("paramPayNote", OdDbType.Text, POut.StringNote(payment.PayNote));

            if (payment.Receipt == null)
            {
                payment.Receipt = "";
            }
            OdSqlParameter paramReceipt = new OdSqlParameter("paramReceipt", OdDbType.Text, POut.StringParam(payment.Receipt));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramPayNote, paramReceipt);
            }
            else
            {
                payment.PayNum = Db.NonQ(command, true, "PayNum", "payment", paramPayNote, paramReceipt);
            }
            return(payment.PayNum);
        }
Exemplo n.º 19
0
        ///<summary>Updates one Adjustment in the database.</summary>
        public static void Update(Adjustment adjustment)
        {
            string command = "UPDATE adjustment SET "
                             + "AdjDate        =  " + POut.Date(adjustment.AdjDate) + ", "
                             + "AdjAmt         = '" + POut.Double(adjustment.AdjAmt) + "', "
                             + "PatNum         =  " + POut.Long(adjustment.PatNum) + ", "
                             + "AdjType        =  " + POut.Long(adjustment.AdjType) + ", "
                             + "ProvNum        =  " + POut.Long(adjustment.ProvNum) + ", "
                             + "AdjNote        =  " + DbHelper.ParamChar + "paramAdjNote, "
                             + "ProcDate       =  " + POut.Date(adjustment.ProcDate) + ", "
                             + "ProcNum        =  " + POut.Long(adjustment.ProcNum) + ", "
                             //DateEntry not allowed to change
                             + "ClinicNum      =  " + POut.Long(adjustment.ClinicNum) + ", "
                             + "StatementNum   =  " + POut.Long(adjustment.StatementNum) + ", "
                             //SecUserNumEntry excluded from update
                             //SecDateTEdit can only be set by MySQL
                             + "TaxTransID     =  " + POut.Long(adjustment.TaxTransID) + " "
                             + "WHERE AdjNum = " + POut.Long(adjustment.AdjNum);

            if (adjustment.AdjNote == null)
            {
                adjustment.AdjNote = "";
            }
            OdSqlParameter paramAdjNote = new OdSqlParameter("paramAdjNote", OdDbType.Text, POut.StringNote(adjustment.AdjNote));

            Db.NonQ(command, paramAdjNote);
        }
Exemplo n.º 20
0
        ///<summary>Updates one Payment in the database.</summary>
        public static void Update(Payment payment)
        {
            string command = "UPDATE payment SET "
                             + "PayType            =  " + POut.Long(payment.PayType) + ", "
                             + "PayDate            =  " + POut.Date(payment.PayDate) + ", "
                             + "PayAmt             = '" + POut.Double(payment.PayAmt) + "', "
                             + "CheckNum           = '" + POut.String(payment.CheckNum) + "', "
                             + "BankBranch         = '" + POut.String(payment.BankBranch) + "', "
                             + "PayNote            =  " + DbHelper.ParamChar + "paramPayNote, "
                             + "IsSplit            =  " + POut.Bool(payment.IsSplit) + ", "
                             + "PatNum             =  " + POut.Long(payment.PatNum) + ", "
                             + "ClinicNum          =  " + POut.Long(payment.ClinicNum) + ", "
                             //DateEntry not allowed to change
                             //DepositNum excluded from update
                             + "Receipt            =  " + DbHelper.ParamChar + "paramReceipt, "
                             + "IsRecurringCC      =  " + POut.Bool(payment.IsRecurringCC) + ", "
                             //SecUserNumEntry excluded from update
                             //SecDateTEdit can only be set by MySQL
                             + "PaymentSource      =  " + POut.Int((int)payment.PaymentSource) + ", "
                             + "ProcessStatus      =  " + POut.Int((int)payment.ProcessStatus) + ", "
                             + "RecurringChargeDate=  " + POut.Date(payment.RecurringChargeDate) + " "
                             + "WHERE PayNum = " + POut.Long(payment.PayNum);

            if (payment.PayNote == null)
            {
                payment.PayNote = "";
            }
            OdSqlParameter paramPayNote = new OdSqlParameter("paramPayNote", OdDbType.Text, POut.StringNote(payment.PayNote));

            if (payment.Receipt == null)
            {
                payment.Receipt = "";
            }
            OdSqlParameter paramReceipt = new OdSqlParameter("paramReceipt", OdDbType.Text, POut.StringParam(payment.Receipt));

            Db.NonQ(command, paramPayNote, paramReceipt);
        }
Exemplo n.º 21
0
        ///<summary>Inserts one InsVerify into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(InsVerify insVerify, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO insverify (";

            if (!useExistingPK && isRandomKeys)
            {
                insVerify.InsVerifyNum = ReplicationServers.GetKeyNoCache("insverify", "InsVerifyNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "InsVerifyNum,";
            }
            command += "DateLastVerified,UserNum,VerifyType,FKey,DefNum,DateLastAssigned,Note,DateTimeEntry,HoursAvailableForVerification) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(insVerify.InsVerifyNum) + ",";
            }
            command +=
                POut.Date(insVerify.DateLastVerified) + ","
                + POut.Long(insVerify.UserNum) + ","
                + POut.Int((int)insVerify.VerifyType) + ","
                + POut.Long(insVerify.FKey) + ","
                + POut.Long(insVerify.DefNum) + ","
                + POut.Date(insVerify.DateLastAssigned) + ","
                + DbHelper.ParamChar + "paramNote,"
                + DbHelper.Now() + ","
                + "'" + POut.Double(insVerify.HoursAvailableForVerification) + "')";
            if (insVerify.Note == null)
            {
                insVerify.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(insVerify.Note));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNote);
            }
            else
            {
                insVerify.InsVerifyNum = Db.NonQ(command, true, "InsVerifyNum", "insVerify", paramNote);
            }
            return(insVerify.InsVerifyNum);
        }
Exemplo n.º 22
0
        ///<summary>Updates one Payment 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(Payment payment, Payment oldPayment)
        {
            string command = "";

            if (payment.PayType != oldPayment.PayType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayType = " + POut.Long(payment.PayType) + "";
            }
            if (payment.PayDate.Date != oldPayment.PayDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayDate = " + POut.Date(payment.PayDate) + "";
            }
            if (payment.PayAmt != oldPayment.PayAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayAmt = '" + POut.Double(payment.PayAmt) + "'";
            }
            if (payment.CheckNum != oldPayment.CheckNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CheckNum = '" + POut.String(payment.CheckNum) + "'";
            }
            if (payment.BankBranch != oldPayment.BankBranch)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BankBranch = '" + POut.String(payment.BankBranch) + "'";
            }
            if (payment.PayNote != oldPayment.PayNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayNote = " + DbHelper.ParamChar + "paramPayNote";
            }
            if (payment.IsSplit != oldPayment.IsSplit)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsSplit = " + POut.Bool(payment.IsSplit) + "";
            }
            if (payment.PatNum != oldPayment.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(payment.PatNum) + "";
            }
            if (payment.ClinicNum != oldPayment.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(payment.ClinicNum) + "";
            }
            //DateEntry not allowed to change
            //DepositNum excluded from update
            if (payment.Receipt != oldPayment.Receipt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Receipt = " + DbHelper.ParamChar + "paramReceipt";
            }
            if (payment.IsRecurringCC != oldPayment.IsRecurringCC)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsRecurringCC = " + POut.Bool(payment.IsRecurringCC) + "";
            }
            //SecUserNumEntry excluded from update
            //SecDateTEdit can only be set by MySQL
            if (payment.PaymentSource != oldPayment.PaymentSource)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PaymentSource = " + POut.Int((int)payment.PaymentSource) + "";
            }
            if (payment.ProcessStatus != oldPayment.ProcessStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcessStatus = " + POut.Int((int)payment.ProcessStatus) + "";
            }
            if (payment.RecurringChargeDate.Date != oldPayment.RecurringChargeDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RecurringChargeDate = " + POut.Date(payment.RecurringChargeDate) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (payment.PayNote == null)
            {
                payment.PayNote = "";
            }
            OdSqlParameter paramPayNote = new OdSqlParameter("paramPayNote", OdDbType.Text, POut.StringNote(payment.PayNote));

            if (payment.Receipt == null)
            {
                payment.Receipt = "";
            }
            OdSqlParameter paramReceipt = new OdSqlParameter("paramReceipt", OdDbType.Text, POut.StringParam(payment.Receipt));

            command = "UPDATE payment SET " + command
                      + " WHERE PayNum = " + POut.Long(payment.PayNum);
            Db.NonQ(command, paramPayNote, paramReceipt);
            return(true);
        }
Exemplo n.º 23
0
        ///<summary>Updates one InsVerify 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(InsVerify insVerify, InsVerify oldInsVerify)
        {
            string command = "";

            if (insVerify.DateLastVerified.Date != oldInsVerify.DateLastVerified.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateLastVerified = " + POut.Date(insVerify.DateLastVerified) + "";
            }
            if (insVerify.UserNum != oldInsVerify.UserNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UserNum = " + POut.Long(insVerify.UserNum) + "";
            }
            if (insVerify.VerifyType != oldInsVerify.VerifyType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "VerifyType = " + POut.Int((int)insVerify.VerifyType) + "";
            }
            if (insVerify.FKey != oldInsVerify.FKey)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FKey = " + POut.Long(insVerify.FKey) + "";
            }
            if (insVerify.DefNum != oldInsVerify.DefNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DefNum = " + POut.Long(insVerify.DefNum) + "";
            }
            if (insVerify.DateLastAssigned.Date != oldInsVerify.DateLastAssigned.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateLastAssigned = " + POut.Date(insVerify.DateLastAssigned) + "";
            }
            if (insVerify.Note != oldInsVerify.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            //DateTimeEntry not allowed to change
            if (insVerify.HoursAvailableForVerification != oldInsVerify.HoursAvailableForVerification)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HoursAvailableForVerification = '" + POut.Double(insVerify.HoursAvailableForVerification) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            if (insVerify.Note == null)
            {
                insVerify.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(insVerify.Note));

            command = "UPDATE insverify SET " + command
                      + " WHERE InsVerifyNum = " + POut.Long(insVerify.InsVerifyNum);
            Db.NonQ(command, paramNote);
            return(true);
        }
Exemplo n.º 24
0
        ///<summary>Inserts one ProcNote into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ProcNote procNote, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO procnote (";

            if (!useExistingPK && isRandomKeys)
            {
                procNote.ProcNoteNum = ReplicationServers.GetKeyNoCache("procnote", "ProcNoteNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ProcNoteNum,";
            }
            command += "PatNum,ProcNum,EntryDateTime,UserNum,Note,SigIsTopaz,Signature) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(procNote.ProcNoteNum) + ",";
            }
            command +=
                POut.Long(procNote.PatNum) + ","
                + POut.Long(procNote.ProcNum) + ","
                + DbHelper.Now() + ","
                + POut.Long(procNote.UserNum) + ","
                + DbHelper.ParamChar + "paramNote,"
                + POut.Bool(procNote.SigIsTopaz) + ","
                + DbHelper.ParamChar + "paramSignature)";
            if (procNote.Note == null)
            {
                procNote.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(procNote.Note));

            if (procNote.Signature == null)
            {
                procNote.Signature = "";
            }
            OdSqlParameter paramSignature = new OdSqlParameter("paramSignature", OdDbType.Text, POut.StringParam(procNote.Signature));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNote, paramSignature);
            }
            else
            {
                procNote.ProcNoteNum = Db.NonQ(command, true, "ProcNoteNum", "procNote", paramNote, paramSignature);
            }
            return(procNote.ProcNoteNum);
        }
Exemplo n.º 25
0
        ///<summary>Updates one WebChatSession in the database.</summary>
        public static void Update(WebChatSession webChatSession)
        {
            string command = "UPDATE webchatsession SET "
                             + "UserName         = '******', "
                             + "PracticeName     = '" + POut.String(webChatSession.PracticeName) + "', "
                             + "EmailAddress     = '" + POut.String(webChatSession.EmailAddress) + "', "
                             + "PhoneNumber      = '" + POut.String(webChatSession.PhoneNumber) + "', "
                             + "IsCustomer       =  " + POut.Bool(webChatSession.IsCustomer) + ", "
                             + "QuestionText     = '" + POut.String(webChatSession.QuestionText) + "', "
                             + "TechName         = '" + POut.String(webChatSession.TechName) + "', "
                             + "DateTcreated     =  " + POut.DateT(webChatSession.DateTcreated) + ", "
                             + "DateTend         =  " + POut.DateT(webChatSession.DateTend) + ", "
                             + "PatNum           =  " + POut.Long(webChatSession.PatNum) + ", "
                             + "Note             =  " + DbHelper.ParamChar + "paramNote "
                             + "WHERE WebChatSessionNum = " + POut.Long(webChatSession.WebChatSessionNum);

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

            Db.NonQ(command, paramNote);
        }
Exemplo n.º 26
0
        ///<summary>Updates one ProcNote in the database.</summary>
        public static void Update(ProcNote procNote)
        {
            string command = "UPDATE procnote SET "
                             + "PatNum       =  " + POut.Long(procNote.PatNum) + ", "
                             + "ProcNum      =  " + POut.Long(procNote.ProcNum) + ", "
                             //EntryDateTime not allowed to change
                             + "UserNum      =  " + POut.Long(procNote.UserNum) + ", "
                             + "Note         =  " + DbHelper.ParamChar + "paramNote, "
                             + "SigIsTopaz   =  " + POut.Bool(procNote.SigIsTopaz) + ", "
                             + "Signature    =  " + DbHelper.ParamChar + "paramSignature "
                             + "WHERE ProcNoteNum = " + POut.Long(procNote.ProcNoteNum);

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

            if (procNote.Signature == null)
            {
                procNote.Signature = "";
            }
            OdSqlParameter paramSignature = new OdSqlParameter("paramSignature", OdDbType.Text, POut.StringParam(procNote.Signature));

            Db.NonQ(command, paramNote, paramSignature);
        }
Exemplo n.º 27
0
        ///<summary>Inserts one DispSupply into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(DispSupply dispSupply, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO dispsupply (";

            if (!useExistingPK && isRandomKeys)
            {
                dispSupply.DispSupplyNum = ReplicationServers.GetKeyNoCache("dispsupply", "DispSupplyNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "DispSupplyNum,";
            }
            command += "SupplyNum,ProvNum,DateDispensed,DispQuantity,Note) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(dispSupply.DispSupplyNum) + ",";
            }
            command +=
                POut.Long(dispSupply.SupplyNum) + ","
                + POut.Long(dispSupply.ProvNum) + ","
                + POut.Date(dispSupply.DateDispensed) + ","
                + POut.Float(dispSupply.DispQuantity) + ","
                + DbHelper.ParamChar + "paramNote)";
            if (dispSupply.Note == null)
            {
                dispSupply.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(dispSupply.Note));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNote);
            }
            else
            {
                dispSupply.DispSupplyNum = Db.NonQ(command, true, "DispSupplyNum", "dispSupply", paramNote);
            }
            return(dispSupply.DispSupplyNum);
        }
Exemplo n.º 28
0
        ///<summary>Updates one ProcNote 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(ProcNote procNote, ProcNote oldProcNote)
        {
            string command = "";

            if (procNote.PatNum != oldProcNote.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(procNote.PatNum) + "";
            }
            if (procNote.ProcNum != oldProcNote.ProcNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNum = " + POut.Long(procNote.ProcNum) + "";
            }
            //EntryDateTime not allowed to change
            if (procNote.UserNum != oldProcNote.UserNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UserNum = " + POut.Long(procNote.UserNum) + "";
            }
            if (procNote.Note != oldProcNote.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (procNote.SigIsTopaz != oldProcNote.SigIsTopaz)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SigIsTopaz = " + POut.Bool(procNote.SigIsTopaz) + "";
            }
            if (procNote.Signature != oldProcNote.Signature)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Signature = " + DbHelper.ParamChar + "paramSignature";
            }
            if (command == "")
            {
                return(false);
            }
            if (procNote.Note == null)
            {
                procNote.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(procNote.Note));

            if (procNote.Signature == null)
            {
                procNote.Signature = "";
            }
            OdSqlParameter paramSignature = new OdSqlParameter("paramSignature", OdDbType.Text, POut.StringParam(procNote.Signature));

            command = "UPDATE procnote SET " + command
                      + " WHERE ProcNoteNum = " + POut.Long(procNote.ProcNoteNum);
            Db.NonQ(command, paramNote, paramSignature);
            return(true);
        }
Exemplo n.º 29
0
        ///<summary>Updates one DispSupply 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(DispSupply dispSupply, DispSupply oldDispSupply)
        {
            string command = "";

            if (dispSupply.SupplyNum != oldDispSupply.SupplyNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SupplyNum = " + POut.Long(dispSupply.SupplyNum) + "";
            }
            if (dispSupply.ProvNum != oldDispSupply.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(dispSupply.ProvNum) + "";
            }
            if (dispSupply.DateDispensed.Date != oldDispSupply.DateDispensed.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateDispensed = " + POut.Date(dispSupply.DateDispensed) + "";
            }
            if (dispSupply.DispQuantity != oldDispSupply.DispQuantity)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DispQuantity = " + POut.Float(dispSupply.DispQuantity) + "";
            }
            if (dispSupply.Note != oldDispSupply.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (command == "")
            {
                return(false);
            }
            if (dispSupply.Note == null)
            {
                dispSupply.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(dispSupply.Note));

            command = "UPDATE dispsupply SET " + command
                      + " WHERE DispSupplyNum = " + POut.Long(dispSupply.DispSupplyNum);
            Db.NonQ(command, paramNote);
            return(true);
        }
Exemplo n.º 30
0
        ///<summary>Updates one PatientNote in the database.</summary>
        public static void Update(PatientNote patientNote)
        {
            string command = "UPDATE patientnote SET "
                             //FamFinancial excluded from update
                             + "ApptPhone                 =  " + DbHelper.ParamChar + "paramApptPhone, "
                             + "Medical                   =  " + DbHelper.ParamChar + "paramMedical, "
                             + "Service                   =  " + DbHelper.ParamChar + "paramService, "
                             + "MedicalComp               =  " + DbHelper.ParamChar + "paramMedicalComp, "
                             + "Treatment                 =  " + DbHelper.ParamChar + "paramTreatment, "
                             + "ICEName                   = '" + POut.String(patientNote.ICEName) + "', "
                             + "ICEPhone                  = '" + POut.String(patientNote.ICEPhone) + "', "
                             + "OrthoMonthsTreatOverride  =  " + POut.Int(patientNote.OrthoMonthsTreatOverride) + ", "
                             + "DateOrthoPlacementOverride=  " + POut.Date(patientNote.DateOrthoPlacementOverride) + ", "
                             //SecDateTEntry not allowed to change
                             //SecDateTEdit can only be set by MySQL
                             + "Consent                   =  " + POut.Int((int)patientNote.Consent) + " "
                             + "WHERE PatNum = " + POut.Long(patientNote.PatNum);

            if (patientNote.FamFinancial == null)
            {
                patientNote.FamFinancial = "";
            }
            OdSqlParameter paramFamFinancial = new OdSqlParameter("paramFamFinancial", OdDbType.Text, POut.StringNote(patientNote.FamFinancial));

            if (patientNote.ApptPhone == null)
            {
                patientNote.ApptPhone = "";
            }
            OdSqlParameter paramApptPhone = new OdSqlParameter("paramApptPhone", OdDbType.Text, POut.StringParam(patientNote.ApptPhone));

            if (patientNote.Medical == null)
            {
                patientNote.Medical = "";
            }
            OdSqlParameter paramMedical = new OdSqlParameter("paramMedical", OdDbType.Text, POut.StringNote(patientNote.Medical));

            if (patientNote.Service == null)
            {
                patientNote.Service = "";
            }
            OdSqlParameter paramService = new OdSqlParameter("paramService", OdDbType.Text, POut.StringNote(patientNote.Service));

            if (patientNote.MedicalComp == null)
            {
                patientNote.MedicalComp = "";
            }
            OdSqlParameter paramMedicalComp = new OdSqlParameter("paramMedicalComp", OdDbType.Text, POut.StringNote(patientNote.MedicalComp));

            if (patientNote.Treatment == null)
            {
                patientNote.Treatment = "";
            }
            OdSqlParameter paramTreatment = new OdSqlParameter("paramTreatment", OdDbType.Text, POut.StringNote(patientNote.Treatment));

            Db.NonQ(command, paramFamFinancial, paramApptPhone, paramMedical, paramService, paramMedicalComp, paramTreatment);
        }