Esempio n. 1
0
        ///<summary>Updates one JobReview in the database.</summary>
        public static void Update(JobReview jobReview)
        {
            string command = "UPDATE jobreview SET "
                             + "JobNum      =  " + POut.Long(jobReview.JobNum) + ", "
                             + "ReviewerNum =  " + POut.Long(jobReview.ReviewerNum) + ", "
                             //DateTStamp can only be set by MySQL
                             + "Description =  " + DbHelper.ParamChar + "paramDescription, "
                             + "ReviewStatus= '" + POut.String(jobReview.ReviewStatus.ToString()) + "', "
                             + "TimeReview  =  " + POut.Long(jobReview.TimeReview.Ticks) + " "
                             + "WHERE JobReviewNum = " + POut.Long(jobReview.JobReviewNum);

            if (jobReview.Description == null)
            {
                jobReview.Description = "";
            }
            OdSqlParameter paramDescription = new OdSqlParameter("paramDescription", OdDbType.Text, POut.StringParam(jobReview.Description));

            Db.NonQ(command, paramDescription);
        }
Esempio n. 2
0
        ///<summary>Updates one Disease 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(Disease disease, Disease oldDisease)
        {
            string command = "";

            if (disease.PatNum != oldDisease.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(disease.PatNum) + "";
            }
            if (disease.DiseaseDefNum != oldDisease.DiseaseDefNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DiseaseDefNum = " + POut.Long(disease.DiseaseDefNum) + "";
            }
            if (disease.PatNote != oldDisease.PatNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNote = " + DbHelper.ParamChar + "paramPatNote";
            }
            //DateTStamp can only be set by MySQL
            if (disease.ProbStatus != oldDisease.ProbStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProbStatus = " + POut.Int((int)disease.ProbStatus) + "";
            }
            if (disease.DateStart.Date != oldDisease.DateStart.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateStart = " + POut.Date(disease.DateStart) + "";
            }
            if (disease.DateStop.Date != oldDisease.DateStop.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateStop = " + POut.Date(disease.DateStop) + "";
            }
            if (disease.SnomedProblemType != oldDisease.SnomedProblemType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SnomedProblemType = '" + POut.String(disease.SnomedProblemType) + "'";
            }
            if (disease.FunctionStatus != oldDisease.FunctionStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FunctionStatus = " + POut.Int((int)disease.FunctionStatus) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (disease.PatNote == null)
            {
                disease.PatNote = "";
            }
            OdSqlParameter paramPatNote = new OdSqlParameter("paramPatNote", OdDbType.Text, POut.StringParam(disease.PatNote));

            command = "UPDATE disease SET " + command
                      + " WHERE DiseaseNum = " + POut.Long(disease.DiseaseNum);
            Db.NonQ(command, paramPatNote);
            return(true);
        }
        ///<summary>Updates one ReplicationServer in the database.</summary>
        public static void Update(ReplicationServer replicationServer)
        {
            string command = "UPDATE replicationserver SET "
                             + "Descript            =  " + DbHelper.ParamChar + "paramDescript, "
                             + "ServerId            =  " + POut.Int(replicationServer.ServerId) + ", "
                             + "RangeStart          =  " + POut.Long(replicationServer.RangeStart) + ", "
                             + "RangeEnd            =  " + POut.Long(replicationServer.RangeEnd) + ", "
                             + "AtoZpath            = '" + POut.String(replicationServer.AtoZpath) + "', "
                             + "UpdateBlocked       =  " + POut.Bool(replicationServer.UpdateBlocked) + ", "
                             + "SlaveMonitor        = '" + POut.String(replicationServer.SlaveMonitor) + "' "
                             + "WHERE ReplicationServerNum = " + POut.Long(replicationServer.ReplicationServerNum);

            if (replicationServer.Descript == null)
            {
                replicationServer.Descript = "";
            }
            OdSqlParameter paramDescript = new OdSqlParameter("paramDescript", OdDbType.Text, POut.StringParam(replicationServer.Descript));

            Db.NonQ(command, paramDescript);
        }
        ///<summary>Updates one ApptFieldDef in the database.</summary>
        public static void Update(ApptFieldDef apptFieldDef)
        {
            string command = "UPDATE apptfielddef SET "
                             + "FieldName      = '" + POut.String(apptFieldDef.FieldName) + "', "
                             + "FieldType      =  " + POut.Int((int)apptFieldDef.FieldType) + ", "
                             + "PickList       =  " + DbHelper.ParamChar + "paramPickList "
                             + "WHERE ApptFieldDefNum = " + POut.Long(apptFieldDef.ApptFieldDefNum);

            if (apptFieldDef.PickList == null)
            {
                apptFieldDef.PickList = "";
            }
            OdSqlParameter paramPickList = new OdSqlParameter("paramPickList", OdDbType.Text, POut.StringParam(apptFieldDef.PickList));

            Db.NonQ(command, paramPickList);
        }
Esempio n. 5
0
        ///<summary>Inserts one Disease into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Disease disease, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO disease (";

            if (!useExistingPK && isRandomKeys)
            {
                disease.DiseaseNum = ReplicationServers.GetKeyNoCache("disease", "DiseaseNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "DiseaseNum,";
            }
            command += "PatNum,DiseaseDefNum,PatNote,ProbStatus,DateStart,DateStop,SnomedProblemType,FunctionStatus) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(disease.DiseaseNum) + ",";
            }
            command +=
                POut.Long(disease.PatNum) + ","
                + POut.Long(disease.DiseaseDefNum) + ","
                + DbHelper.ParamChar + "paramPatNote,"
                //DateTStamp can only be set by MySQL
                + POut.Int((int)disease.ProbStatus) + ","
                + POut.Date(disease.DateStart) + ","
                + POut.Date(disease.DateStop) + ","
                + "'" + POut.String(disease.SnomedProblemType) + "',"
                + POut.Int((int)disease.FunctionStatus) + ")";
            if (disease.PatNote == null)
            {
                disease.PatNote = "";
            }
            OdSqlParameter paramPatNote = new OdSqlParameter("paramPatNote", OdDbType.Text, POut.StringParam(disease.PatNote));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramPatNote);
            }
            else
            {
                disease.DiseaseNum = Db.NonQ(command, true, "DiseaseNum", "disease", paramPatNote);
            }
            return(disease.DiseaseNum);
        }
Esempio n. 6
0
        ///<summary>Inserts one Question into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Question question, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO question (";

            if (!useExistingPK && isRandomKeys)
            {
                question.QuestionNum = ReplicationServers.GetKeyNoCache("question", "QuestionNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "QuestionNum,";
            }
            command += "PatNum,ItemOrder,Description,Answer,FormPatNum) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(question.QuestionNum) + ",";
            }
            command +=
                POut.Long(question.PatNum) + ","
                + POut.Int(question.ItemOrder) + ","
                + DbHelper.ParamChar + "paramDescription,"
                + DbHelper.ParamChar + "paramAnswer,"
                + POut.Long(question.FormPatNum) + ")";
            if (question.Description == null)
            {
                question.Description = "";
            }
            OdSqlParameter paramDescription = new OdSqlParameter("paramDescription", OdDbType.Text, POut.StringParam(question.Description));

            if (question.Answer == null)
            {
                question.Answer = "";
            }
            OdSqlParameter paramAnswer = new OdSqlParameter("paramAnswer", OdDbType.Text, POut.StringParam(question.Answer));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramDescription, paramAnswer);
            }
            else
            {
                question.QuestionNum = Db.NonQ(command, true, "QuestionNum", "question", paramDescription, paramAnswer);
            }
            return(question.QuestionNum);
        }
Esempio n. 7
0
        ///<summary>Updates one Question 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(Question question, Question oldQuestion)
        {
            string command = "";

            if (question.PatNum != oldQuestion.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(question.PatNum) + "";
            }
            if (question.ItemOrder != oldQuestion.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(question.ItemOrder) + "";
            }
            if (question.Description != oldQuestion.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = " + DbHelper.ParamChar + "paramDescription";
            }
            if (question.Answer != oldQuestion.Answer)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Answer = " + DbHelper.ParamChar + "paramAnswer";
            }
            if (question.FormPatNum != oldQuestion.FormPatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FormPatNum = " + POut.Long(question.FormPatNum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (question.Description == null)
            {
                question.Description = "";
            }
            OdSqlParameter paramDescription = new OdSqlParameter("paramDescription", OdDbType.Text, POut.StringParam(question.Description));

            if (question.Answer == null)
            {
                question.Answer = "";
            }
            OdSqlParameter paramAnswer = new OdSqlParameter("paramAnswer", OdDbType.Text, POut.StringParam(question.Answer));

            command = "UPDATE question SET " + command
                      + " WHERE QuestionNum = " + POut.Long(question.QuestionNum);
            Db.NonQ(command, paramDescription, paramAnswer);
            return(true);
        }
        ///<summary>Updates one EmailAutograph in the database.</summary>
        public static void Update(EmailAutograph emailAutograph)
        {
            string command = "UPDATE emailautograph SET "
                             + "Description      =  " + DbHelper.ParamChar + "paramDescription, "
                             + "EmailAddress     = '" + POut.String(emailAutograph.EmailAddress) + "', "
                             + "AutographText    =  " + DbHelper.ParamChar + "paramAutographText "
                             + "WHERE EmailAutographNum = " + POut.Long(emailAutograph.EmailAutographNum);

            if (emailAutograph.Description == null)
            {
                emailAutograph.Description = "";
            }
            OdSqlParameter paramDescription = new OdSqlParameter("paramDescription", OdDbType.Text, POut.StringParam(emailAutograph.Description));

            if (emailAutograph.AutographText == null)
            {
                emailAutograph.AutographText = "";
            }
            OdSqlParameter paramAutographText = new OdSqlParameter("paramAutographText", OdDbType.Text, POut.StringParam(emailAutograph.AutographText));

            Db.NonQ(command, paramDescription, paramAutographText);
        }
        ///<summary>Updates one EmailAutograph 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(EmailAutograph emailAutograph, EmailAutograph oldEmailAutograph)
        {
            string command = "";

            if (emailAutograph.Description != oldEmailAutograph.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = " + DbHelper.ParamChar + "paramDescription";
            }
            if (emailAutograph.EmailAddress != oldEmailAutograph.EmailAddress)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmailAddress = '" + POut.String(emailAutograph.EmailAddress) + "'";
            }
            if (emailAutograph.AutographText != oldEmailAutograph.AutographText)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AutographText = " + DbHelper.ParamChar + "paramAutographText";
            }
            if (command == "")
            {
                return(false);
            }
            if (emailAutograph.Description == null)
            {
                emailAutograph.Description = "";
            }
            OdSqlParameter paramDescription = new OdSqlParameter("paramDescription", OdDbType.Text, POut.StringParam(emailAutograph.Description));

            if (emailAutograph.AutographText == null)
            {
                emailAutograph.AutographText = "";
            }
            OdSqlParameter paramAutographText = new OdSqlParameter("paramAutographText", OdDbType.Text, POut.StringParam(emailAutograph.AutographText));

            command = "UPDATE emailautograph SET " + command
                      + " WHERE EmailAutographNum = " + POut.Long(emailAutograph.EmailAutographNum);
            Db.NonQ(command, paramDescription, paramAutographText);
            return(true);
        }
Esempio n. 10
0
        ///<summary>Updates one DocumentMisc 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(DocumentMisc documentMisc, DocumentMisc oldDocumentMisc)
        {
            string command = "";

            if (documentMisc.DateCreated.Date != oldDocumentMisc.DateCreated.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateCreated = " + POut.Date(documentMisc.DateCreated) + "";
            }
            if (documentMisc.FileName != oldDocumentMisc.FileName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FileName = '" + POut.String(documentMisc.FileName) + "'";
            }
            if (documentMisc.DocMiscType != oldDocumentMisc.DocMiscType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DocMiscType = " + POut.Int((int)documentMisc.DocMiscType) + "";
            }
            if (documentMisc.RawBase64 != oldDocumentMisc.RawBase64)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RawBase64 = " + DbHelper.ParamChar + "paramRawBase64";
            }
            if (command == "")
            {
                return(false);
            }
            if (documentMisc.RawBase64 == null)
            {
                documentMisc.RawBase64 = "";
            }
            OdSqlParameter paramRawBase64 = new OdSqlParameter("paramRawBase64", OdDbType.Text, POut.StringParam(documentMisc.RawBase64));

            command = "UPDATE documentmisc SET " + command
                      + " WHERE DocMiscNum = " + POut.Long(documentMisc.DocMiscNum);
            Db.NonQ(command, paramRawBase64);
            return(true);
        }
        ///<summary>Inserts one EmailAutograph into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(EmailAutograph emailAutograph, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO emailautograph (";

            if (!useExistingPK && isRandomKeys)
            {
                emailAutograph.EmailAutographNum = ReplicationServers.GetKeyNoCache("emailautograph", "EmailAutographNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "EmailAutographNum,";
            }
            command += "Description,EmailAddress,AutographText) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(emailAutograph.EmailAutographNum) + ",";
            }
            command +=
                DbHelper.ParamChar + "paramDescription,"
                + "'" + POut.String(emailAutograph.EmailAddress) + "',"
                + DbHelper.ParamChar + "paramAutographText)";
            if (emailAutograph.Description == null)
            {
                emailAutograph.Description = "";
            }
            OdSqlParameter paramDescription = new OdSqlParameter("paramDescription", OdDbType.Text, POut.StringParam(emailAutograph.Description));

            if (emailAutograph.AutographText == null)
            {
                emailAutograph.AutographText = "";
            }
            OdSqlParameter paramAutographText = new OdSqlParameter("paramAutographText", OdDbType.Text, POut.StringParam(emailAutograph.AutographText));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramDescription, paramAutographText);
            }
            else
            {
                emailAutograph.EmailAutographNum = Db.NonQ(command, true, "EmailAutographNum", "emailAutograph", paramDescription, paramAutographText);
            }
            return(emailAutograph.EmailAutographNum);
        }
Esempio n. 12
0
        ///<summary>Updates one DocumentMisc in the database.</summary>
        public static void Update(DocumentMisc documentMisc)
        {
            string command = "UPDATE documentmisc SET "
                             + "DateCreated=  " + POut.Date(documentMisc.DateCreated) + ", "
                             + "FileName   = '" + POut.String(documentMisc.FileName) + "', "
                             + "DocMiscType=  " + POut.Int((int)documentMisc.DocMiscType) + ", "
                             + "RawBase64  =  " + DbHelper.ParamChar + "paramRawBase64 "
                             + "WHERE DocMiscNum = " + POut.Long(documentMisc.DocMiscNum);

            if (documentMisc.RawBase64 == null)
            {
                documentMisc.RawBase64 = "";
            }
            OdSqlParameter paramRawBase64 = new OdSqlParameter("paramRawBase64", OdDbType.Text, POut.StringParam(documentMisc.RawBase64));

            Db.NonQ(command, paramRawBase64);
        }
Esempio n. 13
0
        ///<summary>Inserts one DocumentMisc into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(DocumentMisc documentMisc, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO documentmisc (";

            if (!useExistingPK && isRandomKeys)
            {
                documentMisc.DocMiscNum = ReplicationServers.GetKeyNoCache("documentmisc", "DocMiscNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "DocMiscNum,";
            }
            command += "DateCreated,FileName,DocMiscType,RawBase64) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(documentMisc.DocMiscNum) + ",";
            }
            command +=
                POut.Date(documentMisc.DateCreated) + ","
                + "'" + POut.String(documentMisc.FileName) + "',"
                + POut.Int((int)documentMisc.DocMiscType) + ","
                + DbHelper.ParamChar + "paramRawBase64)";
            if (documentMisc.RawBase64 == null)
            {
                documentMisc.RawBase64 = "";
            }
            OdSqlParameter paramRawBase64 = new OdSqlParameter("paramRawBase64", OdDbType.Text, POut.StringParam(documentMisc.RawBase64));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramRawBase64);
            }
            else
            {
                documentMisc.DocMiscNum = Db.NonQ(command, true, "DocMiscNum", "documentMisc", paramRawBase64);
            }
            return(documentMisc.DocMiscNum);
        }
Esempio n. 14
0
        ///<summary>Updates one JobReview 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(JobReview jobReview, JobReview oldJobReview)
        {
            string command = "";

            if (jobReview.JobNum != oldJobReview.JobNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "JobNum = " + POut.Long(jobReview.JobNum) + "";
            }
            if (jobReview.ReviewerNum != oldJobReview.ReviewerNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ReviewerNum = " + POut.Long(jobReview.ReviewerNum) + "";
            }
            //DateTStamp can only be set by MySQL
            if (jobReview.Description != oldJobReview.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = " + DbHelper.ParamChar + "paramDescription";
            }
            if (jobReview.ReviewStatus != oldJobReview.ReviewStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ReviewStatus = '" + POut.String(jobReview.ReviewStatus.ToString()) + "'";
            }
            if (jobReview.TimeReview != oldJobReview.TimeReview)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TimeReview = '" + POut.Long(jobReview.TimeReview.Ticks) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            if (jobReview.Description == null)
            {
                jobReview.Description = "";
            }
            OdSqlParameter paramDescription = new OdSqlParameter("paramDescription", OdDbType.Text, POut.StringParam(jobReview.Description));

            command = "UPDATE jobreview SET " + command
                      + " WHERE JobReviewNum = " + POut.Long(jobReview.JobReviewNum);
            Db.NonQ(command, paramDescription);
            return(true);
        }
Esempio n. 15
0
        ///<summary>Updates one Recall in the database.</summary>
        public static void Update(Recall recall)
        {
            string command = "UPDATE recall SET "
                             + "PatNum             =  " + POut.Long(recall.PatNum) + ", "
                             + "DateDueCalc        =  " + POut.Date(recall.DateDueCalc) + ", "
                             + "DateDue            =  " + POut.Date(recall.DateDue) + ", "
                             + "DatePrevious       =  " + POut.Date(recall.DatePrevious) + ", "
                             + "RecallInterval     =  " + POut.Int(recall.RecallInterval.ToInt()) + ", "
                             + "RecallStatus       =  " + POut.Long(recall.RecallStatus) + ", "
                             + "Note               =  " + DbHelper.ParamChar + "paramNote, "
                             + "IsDisabled         =  " + POut.Bool(recall.IsDisabled) + ", "
                             //DateTStamp can only be set by MySQL
                             + "RecallTypeNum      =  " + POut.Long(recall.RecallTypeNum) + ", "
                             + "DisableUntilBalance= '" + POut.Double(recall.DisableUntilBalance) + "', "
                             + "DisableUntilDate   =  " + POut.Date(recall.DisableUntilDate) + ", "
                             + "DateScheduled      =  " + POut.Date(recall.DateScheduled) + ", "
                             + "Priority           =  " + POut.Int((int)recall.Priority) + " "
                             + "WHERE RecallNum = " + POut.Long(recall.RecallNum);

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

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

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

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

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNote, paramProcsColored);
            }
            else
            {
                appointment.AptNum = Db.NonQ(command, true, "AptNum", "appointment", paramNote, paramProcsColored);
            }
            return(appointment.AptNum);
        }
Esempio n. 17
0
        ///<summary>Updates one Recall 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(Recall recall, Recall oldRecall)
        {
            string command = "";

            if (recall.PatNum != oldRecall.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(recall.PatNum) + "";
            }
            if (recall.DateDueCalc.Date != oldRecall.DateDueCalc.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateDueCalc = " + POut.Date(recall.DateDueCalc) + "";
            }
            if (recall.DateDue.Date != oldRecall.DateDue.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateDue = " + POut.Date(recall.DateDue) + "";
            }
            if (recall.DatePrevious.Date != oldRecall.DatePrevious.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DatePrevious = " + POut.Date(recall.DatePrevious) + "";
            }
            if (recall.RecallInterval != oldRecall.RecallInterval)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RecallInterval = " + POut.Int(recall.RecallInterval.ToInt()) + "";
            }
            if (recall.RecallStatus != oldRecall.RecallStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RecallStatus = " + POut.Long(recall.RecallStatus) + "";
            }
            if (recall.Note != oldRecall.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (recall.IsDisabled != oldRecall.IsDisabled)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsDisabled = " + POut.Bool(recall.IsDisabled) + "";
            }
            //DateTStamp can only be set by MySQL
            if (recall.RecallTypeNum != oldRecall.RecallTypeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RecallTypeNum = " + POut.Long(recall.RecallTypeNum) + "";
            }
            if (recall.DisableUntilBalance != oldRecall.DisableUntilBalance)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DisableUntilBalance = '" + POut.Double(recall.DisableUntilBalance) + "'";
            }
            if (recall.DisableUntilDate.Date != oldRecall.DisableUntilDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DisableUntilDate = " + POut.Date(recall.DisableUntilDate) + "";
            }
            if (recall.DateScheduled.Date != oldRecall.DateScheduled.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateScheduled = " + POut.Date(recall.DateScheduled) + "";
            }
            if (recall.Priority != oldRecall.Priority)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Priority = " + POut.Int((int)recall.Priority) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (recall.Note == null)
            {
                recall.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(recall.Note));

            command = "UPDATE recall SET " + command
                      + " WHERE RecallNum = " + POut.Long(recall.RecallNum);
            Db.NonQ(command, paramNote);
            return(true);
        }
Esempio n. 18
0
        ///<summary>Updates one Appointment in the database.</summary>
        public static void Update(Appointment appointment)
        {
            string command = "UPDATE appointment SET "
                             + "PatNum               =  " + POut.Long(appointment.PatNum) + ", "
                             + "AptStatus            =  " + POut.Int((int)appointment.AptStatus) + ", "
                             + "Pattern              = '" + POut.String(appointment.Pattern) + "', "
                             + "Confirmed            =  " + POut.Long(appointment.Confirmed) + ", "
                             + "TimeLocked           =  " + POut.Bool(appointment.TimeLocked) + ", "
                             + "Op                   =  " + POut.Long(appointment.Op) + ", "
                             + "Note                 =  " + DbHelper.ParamChar + "paramNote, "
                             + "ProvNum              =  " + POut.Long(appointment.ProvNum) + ", "
                             + "ProvHyg              =  " + POut.Long(appointment.ProvHyg) + ", "
                             + "AptDateTime          =  " + POut.DateT(appointment.AptDateTime) + ", "
                             + "NextAptNum           =  " + POut.Long(appointment.NextAptNum) + ", "
                             + "UnschedStatus        =  " + POut.Long(appointment.UnschedStatus) + ", "
                             + "IsNewPatient         =  " + POut.Bool(appointment.IsNewPatient) + ", "
                             + "ProcDescript         = '" + POut.String(appointment.ProcDescript) + "', "
                             + "Assistant            =  " + POut.Long(appointment.Assistant) + ", "
                             + "ClinicNum            =  " + POut.Long(appointment.ClinicNum) + ", "
                             + "IsHygiene            =  " + POut.Bool(appointment.IsHygiene) + ", "
                             //DateTStamp can only be set by MySQL
                             + "DateTimeArrived      =  " + POut.DateT(appointment.DateTimeArrived) + ", "
                             + "DateTimeSeated       =  " + POut.DateT(appointment.DateTimeSeated) + ", "
                             + "DateTimeDismissed    =  " + POut.DateT(appointment.DateTimeDismissed) + ", "
                             + "InsPlan1             =  " + POut.Long(appointment.InsPlan1) + ", "
                             + "InsPlan2             =  " + POut.Long(appointment.InsPlan2) + ", "
                             + "DateTimeAskedToArrive=  " + POut.DateT(appointment.DateTimeAskedToArrive) + ", "
                             + "ProcsColored         =  " + DbHelper.ParamChar + "paramProcsColored, "
                             + "ColorOverride        =  " + POut.Int(appointment.ColorOverride.ToArgb()) + ", "
                             + "AppointmentTypeNum   =  " + POut.Long(appointment.AppointmentTypeNum) + ", "
                             //SecUserNumEntry excluded from update
                             //SecDateTEntry not allowed to change
                             + "Priority             =  " + POut.Int((int)appointment.Priority) + ", "
                             + "ProvBarText          = '" + POut.String(appointment.ProvBarText) + "', "
                             + "PatternSecondary     = '" + POut.String(appointment.PatternSecondary) + "' "
                             + "WHERE AptNum = " + POut.Long(appointment.AptNum);

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

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

            Db.NonQ(command, paramNote, paramProcsColored);
        }
Esempio n. 19
0
        ///<summary>Updates one Question in the database.</summary>
        public static void Update(Question question)
        {
            string command = "UPDATE question SET "
                             + "PatNum     =  " + POut.Long(question.PatNum) + ", "
                             + "ItemOrder  =  " + POut.Int(question.ItemOrder) + ", "
                             + "Description=  " + DbHelper.ParamChar + "paramDescription, "
                             + "Answer     =  " + DbHelper.ParamChar + "paramAnswer, "
                             + "FormPatNum =  " + POut.Long(question.FormPatNum) + " "
                             + "WHERE QuestionNum = " + POut.Long(question.QuestionNum);

            if (question.Description == null)
            {
                question.Description = "";
            }
            OdSqlParameter paramDescription = new OdSqlParameter("paramDescription", OdDbType.Text, POut.StringParam(question.Description));

            if (question.Answer == null)
            {
                question.Answer = "";
            }
            OdSqlParameter paramAnswer = new OdSqlParameter("paramAnswer", OdDbType.Text, POut.StringParam(question.Answer));

            Db.NonQ(command, paramDescription, paramAnswer);
        }
Esempio n. 20
0
        ///<summary>Updates one Appointment 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(Appointment appointment, Appointment oldAppointment)
        {
            string command = "";

            if (appointment.PatNum != oldAppointment.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(appointment.PatNum) + "";
            }
            if (appointment.AptStatus != oldAppointment.AptStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AptStatus = " + POut.Int((int)appointment.AptStatus) + "";
            }
            if (appointment.Pattern != oldAppointment.Pattern)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Pattern = '" + POut.String(appointment.Pattern) + "'";
            }
            if (appointment.Confirmed != oldAppointment.Confirmed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Confirmed = " + POut.Long(appointment.Confirmed) + "";
            }
            if (appointment.TimeLocked != oldAppointment.TimeLocked)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TimeLocked = " + POut.Bool(appointment.TimeLocked) + "";
            }
            if (appointment.Op != oldAppointment.Op)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Op = " + POut.Long(appointment.Op) + "";
            }
            if (appointment.Note != oldAppointment.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (appointment.ProvNum != oldAppointment.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(appointment.ProvNum) + "";
            }
            if (appointment.ProvHyg != oldAppointment.ProvHyg)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvHyg = " + POut.Long(appointment.ProvHyg) + "";
            }
            if (appointment.AptDateTime != oldAppointment.AptDateTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AptDateTime = " + POut.DateT(appointment.AptDateTime) + "";
            }
            if (appointment.NextAptNum != oldAppointment.NextAptNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "NextAptNum = " + POut.Long(appointment.NextAptNum) + "";
            }
            if (appointment.UnschedStatus != oldAppointment.UnschedStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UnschedStatus = " + POut.Long(appointment.UnschedStatus) + "";
            }
            if (appointment.IsNewPatient != oldAppointment.IsNewPatient)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsNewPatient = " + POut.Bool(appointment.IsNewPatient) + "";
            }
            if (appointment.ProcDescript != oldAppointment.ProcDescript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcDescript = '" + POut.String(appointment.ProcDescript) + "'";
            }
            if (appointment.Assistant != oldAppointment.Assistant)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Assistant = " + POut.Long(appointment.Assistant) + "";
            }
            if (appointment.ClinicNum != oldAppointment.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(appointment.ClinicNum) + "";
            }
            if (appointment.IsHygiene != oldAppointment.IsHygiene)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHygiene = " + POut.Bool(appointment.IsHygiene) + "";
            }
            //DateTStamp can only be set by MySQL
            if (appointment.DateTimeArrived != oldAppointment.DateTimeArrived)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTimeArrived = " + POut.DateT(appointment.DateTimeArrived) + "";
            }
            if (appointment.DateTimeSeated != oldAppointment.DateTimeSeated)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTimeSeated = " + POut.DateT(appointment.DateTimeSeated) + "";
            }
            if (appointment.DateTimeDismissed != oldAppointment.DateTimeDismissed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTimeDismissed = " + POut.DateT(appointment.DateTimeDismissed) + "";
            }
            if (appointment.InsPlan1 != oldAppointment.InsPlan1)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "InsPlan1 = " + POut.Long(appointment.InsPlan1) + "";
            }
            if (appointment.InsPlan2 != oldAppointment.InsPlan2)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "InsPlan2 = " + POut.Long(appointment.InsPlan2) + "";
            }
            if (appointment.DateTimeAskedToArrive != oldAppointment.DateTimeAskedToArrive)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTimeAskedToArrive = " + POut.DateT(appointment.DateTimeAskedToArrive) + "";
            }
            if (appointment.ProcsColored != oldAppointment.ProcsColored)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcsColored = " + DbHelper.ParamChar + "paramProcsColored";
            }
            if (appointment.ColorOverride != oldAppointment.ColorOverride)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ColorOverride = " + POut.Int(appointment.ColorOverride.ToArgb()) + "";
            }
            if (appointment.AppointmentTypeNum != oldAppointment.AppointmentTypeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AppointmentTypeNum = " + POut.Long(appointment.AppointmentTypeNum) + "";
            }
            //SecUserNumEntry excluded from update
            //SecDateTEntry not allowed to change
            if (appointment.Priority != oldAppointment.Priority)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Priority = " + POut.Int((int)appointment.Priority) + "";
            }
            if (appointment.ProvBarText != oldAppointment.ProvBarText)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvBarText = '" + POut.String(appointment.ProvBarText) + "'";
            }
            if (appointment.PatternSecondary != oldAppointment.PatternSecondary)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatternSecondary = '" + POut.String(appointment.PatternSecondary) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            if (appointment.Note == null)
            {
                appointment.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(appointment.Note));

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

            command = "UPDATE appointment SET " + command
                      + " WHERE AptNum = " + POut.Long(appointment.AptNum);
            Db.NonQ(command, paramNote, paramProcsColored);
            return(true);
        }
Esempio n. 21
0
        ///<summary>Inserts one ApptFieldDef into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ApptFieldDef apptFieldDef, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO apptfielddef (";

            if (!useExistingPK && isRandomKeys)
            {
                apptFieldDef.ApptFieldDefNum = ReplicationServers.GetKeyNoCache("apptfielddef", "ApptFieldDefNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ApptFieldDefNum,";
            }
            command += "FieldName,FieldType,PickList) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(apptFieldDef.ApptFieldDefNum) + ",";
            }
            command +=
                "'" + POut.String(apptFieldDef.FieldName) + "',"
                + POut.Int((int)apptFieldDef.FieldType) + ","
                + DbHelper.ParamChar + "paramPickList)";
            if (apptFieldDef.PickList == null)
            {
                apptFieldDef.PickList = "";
            }
            OdSqlParameter paramPickList = new OdSqlParameter("paramPickList", OdDbType.Text, POut.StringParam(apptFieldDef.PickList));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramPickList);
            }
            else
            {
                apptFieldDef.ApptFieldDefNum = Db.NonQ(command, true, "ApptFieldDefNum", "apptFieldDef", paramPickList);
            }
            return(apptFieldDef.ApptFieldDefNum);
        }
Esempio n. 22
0
        ///<summary>Inserts one ProcButton into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ProcButton procButton, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO procbutton (";

            if (!useExistingPK && isRandomKeys)
            {
                procButton.ProcButtonNum = ReplicationServers.GetKeyNoCache("procbutton", "ProcButtonNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ProcButtonNum,";
            }
            command += "Description,ItemOrder,Category,ButtonImage) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(procButton.ProcButtonNum) + ",";
            }
            command +=
                "'" + POut.String(procButton.Description) + "',"
                + POut.Int(procButton.ItemOrder) + ","
                + POut.Long(procButton.Category) + ","
                + DbHelper.ParamChar + "paramButtonImage)";
            if (procButton.ButtonImage == null)
            {
                procButton.ButtonImage = "";
            }
            OdSqlParameter paramButtonImage = new OdSqlParameter("paramButtonImage", OdDbType.Text, POut.StringParam(procButton.ButtonImage));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramButtonImage);
            }
            else
            {
                procButton.ProcButtonNum = Db.NonQ(command, true, "ProcButtonNum", "procButton", paramButtonImage);
            }
            return(procButton.ProcButtonNum);
        }
Esempio n. 23
0
        ///<summary>Updates one ApptFieldDef 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(ApptFieldDef apptFieldDef, ApptFieldDef oldApptFieldDef)
        {
            string command = "";

            if (apptFieldDef.FieldName != oldApptFieldDef.FieldName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FieldName = '" + POut.String(apptFieldDef.FieldName) + "'";
            }
            if (apptFieldDef.FieldType != oldApptFieldDef.FieldType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FieldType = " + POut.Int((int)apptFieldDef.FieldType) + "";
            }
            if (apptFieldDef.PickList != oldApptFieldDef.PickList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PickList = " + DbHelper.ParamChar + "paramPickList";
            }
            if (command == "")
            {
                return(false);
            }
            if (apptFieldDef.PickList == null)
            {
                apptFieldDef.PickList = "";
            }
            OdSqlParameter paramPickList = new OdSqlParameter("paramPickList", OdDbType.Text, POut.StringParam(apptFieldDef.PickList));

            command = "UPDATE apptfielddef SET " + command
                      + " WHERE ApptFieldDefNum = " + POut.Long(apptFieldDef.ApptFieldDefNum);
            Db.NonQ(command, paramPickList);
            return(true);
        }
Esempio n. 24
0
        ///<summary>Updates one ProcButton in the database.</summary>
        public static void Update(ProcButton procButton)
        {
            string command = "UPDATE procbutton SET "
                             + "Description  = '" + POut.String(procButton.Description) + "', "
                             + "ItemOrder    =  " + POut.Int(procButton.ItemOrder) + ", "
                             + "Category     =  " + POut.Long(procButton.Category) + ", "
                             + "ButtonImage  =  " + DbHelper.ParamChar + "paramButtonImage "
                             + "WHERE ProcButtonNum = " + POut.Long(procButton.ProcButtonNum);

            if (procButton.ButtonImage == null)
            {
                procButton.ButtonImage = "";
            }
            OdSqlParameter paramButtonImage = new OdSqlParameter("paramButtonImage", OdDbType.Text, POut.StringParam(procButton.ButtonImage));

            Db.NonQ(command, paramButtonImage);
        }
Esempio n. 25
0
        ///<summary>Updates one Disease in the database.</summary>
        public static void Update(Disease disease)
        {
            string command = "UPDATE disease SET "
                             + "PatNum           =  " + POut.Long(disease.PatNum) + ", "
                             + "DiseaseDefNum    =  " + POut.Long(disease.DiseaseDefNum) + ", "
                             + "PatNote          =  " + DbHelper.ParamChar + "paramPatNote, "
                             //DateTStamp can only be set by MySQL
                             + "ProbStatus       =  " + POut.Int((int)disease.ProbStatus) + ", "
                             + "DateStart        =  " + POut.Date(disease.DateStart) + ", "
                             + "DateStop         =  " + POut.Date(disease.DateStop) + ", "
                             + "SnomedProblemType= '" + POut.String(disease.SnomedProblemType) + "', "
                             + "FunctionStatus   =  " + POut.Int((int)disease.FunctionStatus) + " "
                             + "WHERE DiseaseNum = " + POut.Long(disease.DiseaseNum);

            if (disease.PatNote == null)
            {
                disease.PatNote = "";
            }
            OdSqlParameter paramPatNote = new OdSqlParameter("paramPatNote", OdDbType.Text, POut.StringParam(disease.PatNote));

            Db.NonQ(command, paramPatNote);
        }
Esempio n. 26
0
        ///<summary>Updates one ProcButton 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(ProcButton procButton, ProcButton oldProcButton)
        {
            string command = "";

            if (procButton.Description != oldProcButton.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(procButton.Description) + "'";
            }
            if (procButton.ItemOrder != oldProcButton.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(procButton.ItemOrder) + "";
            }
            if (procButton.Category != oldProcButton.Category)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Category = " + POut.Long(procButton.Category) + "";
            }
            if (procButton.ButtonImage != oldProcButton.ButtonImage)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ButtonImage = " + DbHelper.ParamChar + "paramButtonImage";
            }
            if (command == "")
            {
                return(false);
            }
            if (procButton.ButtonImage == null)
            {
                procButton.ButtonImage = "";
            }
            OdSqlParameter paramButtonImage = new OdSqlParameter("paramButtonImage", OdDbType.Text, POut.StringParam(procButton.ButtonImage));

            command = "UPDATE procbutton SET " + command
                      + " WHERE ProcButtonNum = " + POut.Long(procButton.ProcButtonNum);
            Db.NonQ(command, paramButtonImage);
            return(true);
        }
Esempio n. 27
0
        ///<summary>Inserts one ReplicationServer into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ReplicationServer replicationServer, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO replicationserver (";

            if (!useExistingPK && isRandomKeys)
            {
                replicationServer.ReplicationServerNum = ReplicationServers.GetKeyNoCache("replicationserver", "ReplicationServerNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ReplicationServerNum,";
            }
            command += "Descript,ServerId,RangeStart,RangeEnd,AtoZpath,UpdateBlocked,SlaveMonitor) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(replicationServer.ReplicationServerNum) + ",";
            }
            command +=
                DbHelper.ParamChar + "paramDescript,"
                + POut.Int(replicationServer.ServerId) + ","
                + POut.Long(replicationServer.RangeStart) + ","
                + POut.Long(replicationServer.RangeEnd) + ","
                + "'" + POut.String(replicationServer.AtoZpath) + "',"
                + POut.Bool(replicationServer.UpdateBlocked) + ","
                + "'" + POut.String(replicationServer.SlaveMonitor) + "')";
            if (replicationServer.Descript == null)
            {
                replicationServer.Descript = "";
            }
            OdSqlParameter paramDescript = new OdSqlParameter("paramDescript", OdDbType.Text, POut.StringParam(replicationServer.Descript));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramDescript);
            }
            else
            {
                replicationServer.ReplicationServerNum = Db.NonQ(command, true, "ReplicationServerNum", "replicationServer", paramDescript);
            }
            return(replicationServer.ReplicationServerNum);
        }
Esempio n. 28
0
        ///<summary>Inserts one Recall into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Recall recall, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO recall (";

            if (!useExistingPK && isRandomKeys)
            {
                recall.RecallNum = ReplicationServers.GetKeyNoCache("recall", "RecallNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "RecallNum,";
            }
            command += "PatNum,DateDueCalc,DateDue,DatePrevious,RecallInterval,RecallStatus,Note,IsDisabled,RecallTypeNum,DisableUntilBalance,DisableUntilDate,DateScheduled,Priority) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                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) + ","
                + DbHelper.ParamChar + "paramNote,"
                + POut.Bool(recall.IsDisabled) + ","
                //DateTStamp can only be set by MySQL
                + POut.Long(recall.RecallTypeNum) + ","
                + "'" + POut.Double(recall.DisableUntilBalance) + "',"
                + POut.Date(recall.DisableUntilDate) + ","
                + POut.Date(recall.DateScheduled) + ","
                + POut.Int((int)recall.Priority) + ")";
            if (recall.Note == null)
            {
                recall.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(recall.Note));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNote);
            }
            else
            {
                recall.RecallNum = Db.NonQ(command, true, "RecallNum", "recall", paramNote);
            }
            return(recall.RecallNum);
        }
Esempio n. 29
0
        ///<summary>Updates one ReplicationServer 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(ReplicationServer replicationServer, ReplicationServer oldReplicationServer)
        {
            string command = "";

            if (replicationServer.Descript != oldReplicationServer.Descript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Descript = " + DbHelper.ParamChar + "paramDescript";
            }
            if (replicationServer.ServerId != oldReplicationServer.ServerId)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ServerId = " + POut.Int(replicationServer.ServerId) + "";
            }
            if (replicationServer.RangeStart != oldReplicationServer.RangeStart)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RangeStart = " + POut.Long(replicationServer.RangeStart) + "";
            }
            if (replicationServer.RangeEnd != oldReplicationServer.RangeEnd)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RangeEnd = " + POut.Long(replicationServer.RangeEnd) + "";
            }
            if (replicationServer.AtoZpath != oldReplicationServer.AtoZpath)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AtoZpath = '" + POut.String(replicationServer.AtoZpath) + "'";
            }
            if (replicationServer.UpdateBlocked != oldReplicationServer.UpdateBlocked)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UpdateBlocked = " + POut.Bool(replicationServer.UpdateBlocked) + "";
            }
            if (replicationServer.SlaveMonitor != oldReplicationServer.SlaveMonitor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SlaveMonitor = '" + POut.String(replicationServer.SlaveMonitor) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            if (replicationServer.Descript == null)
            {
                replicationServer.Descript = "";
            }
            OdSqlParameter paramDescript = new OdSqlParameter("paramDescript", OdDbType.Text, POut.StringParam(replicationServer.Descript));

            command = "UPDATE replicationserver SET " + command
                      + " WHERE ReplicationServerNum = " + POut.Long(replicationServer.ReplicationServerNum);
            Db.NonQ(command, paramDescript);
            return(true);
        }
Esempio n. 30
0
        ///<summary>Inserts one JobReview into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(JobReview jobReview, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO jobreview (";

            if (!useExistingPK && isRandomKeys)
            {
                jobReview.JobReviewNum = ReplicationServers.GetKeyNoCache("jobreview", "JobReviewNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "JobReviewNum,";
            }
            command += "JobNum,ReviewerNum,Description,ReviewStatus,TimeReview) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(jobReview.JobReviewNum) + ",";
            }
            command +=
                POut.Long(jobReview.JobNum) + ","
                + POut.Long(jobReview.ReviewerNum) + ","
                //DateTStamp can only be set by MySQL
                + DbHelper.ParamChar + "paramDescription,"
                + "'" + POut.String(jobReview.ReviewStatus.ToString()) + "',"
                + "'" + POut.Long(jobReview.TimeReview.Ticks) + "')";
            if (jobReview.Description == null)
            {
                jobReview.Description = "";
            }
            OdSqlParameter paramDescription = new OdSqlParameter("paramDescription", OdDbType.Text, POut.StringParam(jobReview.Description));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramDescription);
            }
            else
            {
                jobReview.JobReviewNum = Db.NonQ(command, true, "JobReviewNum", "jobReview", paramDescription);
            }
            return(jobReview.JobReviewNum);
        }