コード例 #1
0
ファイル: UcumCrud.cs プロジェクト: kjb7749/testImport
        ///<summary>Updates one Ucum 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(Ucum ucum, Ucum oldUcum)
        {
            string command = "";

            if (ucum.UcumCode != oldUcum.UcumCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UcumCode = '" + POut.String(ucum.UcumCode) + "'";
            }
            if (ucum.Description != oldUcum.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(ucum.Description) + "'";
            }
            if (ucum.IsInUse != oldUcum.IsInUse)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsInUse = " + POut.Bool(ucum.IsInUse) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE ucum SET " + command
                      + " WHERE UcumNum = " + POut.Long(ucum.UcumNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #2
0
        ///<summary>Inserts one OrionProc into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(OrionProc orionProc, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                orionProc.OrionProcNum = ReplicationServers.GetKey("orionproc", "OrionProcNum");
            }
            string command = "INSERT INTO orionproc (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "OrionProcNum,";
            }
            command += "ProcNum,DPC,DPCpost,DateScheduleBy,DateStopClock,Status2,IsOnCall,IsEffectiveComm,IsRepair) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(orionProc.OrionProcNum) + ",";
            }
            command +=
                POut.Long(orionProc.ProcNum) + ","
                + POut.Int((int)orionProc.DPC) + ","
                + POut.Int((int)orionProc.DPCpost) + ","
                + POut.Date(orionProc.DateScheduleBy) + ","
                + POut.Date(orionProc.DateStopClock) + ","
                + POut.Int((int)orionProc.Status2) + ","
                + POut.Bool(orionProc.IsOnCall) + ","
                + POut.Bool(orionProc.IsEffectiveComm) + ","
                + POut.Bool(orionProc.IsRepair) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                orionProc.OrionProcNum = Db.NonQ(command, true, "OrionProcNum", "orionProc");
            }
            return(orionProc.OrionProcNum);
        }
コード例 #3
0
        ///<summary>Inserts one ApptView into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(ApptView apptView, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                apptView.ApptViewNum = ReplicationServers.GetKey("apptview", "ApptViewNum");
            }
            string command = "INSERT INTO apptview (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ApptViewNum,";
            }
            command += "Description,ItemOrder,RowsPerIncr,OnlyScheduledProvs,OnlySchedBeforeTime,OnlySchedAfterTime,StackBehavUR,StackBehavLR,ClinicNum) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(apptView.ApptViewNum) + ",";
            }
            command +=
                "'" + POut.String(apptView.Description) + "',"
                + POut.Int(apptView.ItemOrder) + ","
                + POut.Byte(apptView.RowsPerIncr) + ","
                + POut.Bool(apptView.OnlyScheduledProvs) + ","
                + POut.Time(apptView.OnlySchedBeforeTime) + ","
                + POut.Time(apptView.OnlySchedAfterTime) + ","
                + POut.Int((int)apptView.StackBehavUR) + ","
                + POut.Int((int)apptView.StackBehavLR) + ","
                + POut.Long(apptView.ClinicNum) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                apptView.ApptViewNum = Db.NonQ(command, true);
            }
            return(apptView.ApptViewNum);
        }
コード例 #4
0
        ///<summary>Updates one WebForms_Preference 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(WebForms_Preference webForms_Preference, WebForms_Preference oldWebForms_Preference)
        {
            string command = "";

            if (webForms_Preference.ColorBorder != oldWebForms_Preference.ColorBorder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ColorBorder = " + POut.Int(webForms_Preference.ColorBorder.ToArgb()) + "";
            }
            if (webForms_Preference.CultureName != oldWebForms_Preference.CultureName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CultureName = '" + POut.String(webForms_Preference.CultureName) + "'";
            }
            if (webForms_Preference.DisableSignatures != oldWebForms_Preference.DisableSignatures)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DisableSignatures = " + POut.Bool(webForms_Preference.DisableSignatures) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE webforms_preference SET " + command
                      + " WHERE DentalOfficeID = " + POut.Long(webForms_Preference.DentalOfficeID);
            DataCore.NonQ(command);
            return(true);
        }
コード例 #5
0
ファイル: OperatoryCrud.cs プロジェクト: nampn/ODental
        ///<summary>Inserts one Operatory into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(Operatory operatory, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                operatory.OperatoryNum = ReplicationServers.GetKey("operatory", "OperatoryNum");
            }
            string command = "INSERT INTO operatory (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "OperatoryNum,";
            }
            command += "OpName,Abbrev,ItemOrder,IsHidden,ProvDentist,ProvHygienist,IsHygiene,ClinicNum,SetProspective) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(operatory.OperatoryNum) + ",";
            }
            command +=
                "'" + POut.String(operatory.OpName) + "',"
                + "'" + POut.String(operatory.Abbrev) + "',"
                + POut.Int(operatory.ItemOrder) + ","
                + POut.Bool(operatory.IsHidden) + ","
                + POut.Long(operatory.ProvDentist) + ","
                + POut.Long(operatory.ProvHygienist) + ","
                + POut.Bool(operatory.IsHygiene) + ","
                + POut.Long(operatory.ClinicNum) + ","
                + POut.Bool(operatory.SetProspective) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                operatory.OperatoryNum = Db.NonQ(command, true);
            }
            return(operatory.OperatoryNum);
        }
コード例 #6
0
        ///<summary>Updates one AlertCategory 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(AlertCategory alertCategory, AlertCategory oldAlertCategory)
        {
            string command = "";

            if (alertCategory.IsHQCategory != oldAlertCategory.IsHQCategory)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHQCategory = " + POut.Bool(alertCategory.IsHQCategory) + "";
            }
            if (alertCategory.InternalName != oldAlertCategory.InternalName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "InternalName = '" + POut.String(alertCategory.InternalName) + "'";
            }
            if (alertCategory.Description != oldAlertCategory.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(alertCategory.Description) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE alertcategory SET " + command
                      + " WHERE AlertCategoryNum = " + POut.Long(alertCategory.AlertCategoryNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #7
0
        ///<summary>Updates one AutoCode 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(AutoCode autoCode, AutoCode oldAutoCode)
        {
            string command = "";

            if (autoCode.Description != oldAutoCode.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(autoCode.Description) + "'";
            }
            if (autoCode.IsHidden != oldAutoCode.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(autoCode.IsHidden) + "";
            }
            if (autoCode.LessIntrusive != oldAutoCode.LessIntrusive)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LessIntrusive = " + POut.Bool(autoCode.LessIntrusive) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE autocode SET " + command
                      + " WHERE AutoCodeNum = " + POut.Long(autoCode.AutoCodeNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #8
0
        ///<summary>Updates one PhoneGraph 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(PhoneGraph phoneGraph, PhoneGraph oldPhoneGraph)
        {
            string command = "";

            if (phoneGraph.EmployeeNum != oldPhoneGraph.EmployeeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmployeeNum = " + POut.Long(phoneGraph.EmployeeNum) + "";
            }
            if (phoneGraph.IsGraphed != oldPhoneGraph.IsGraphed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsGraphed = " + POut.Bool(phoneGraph.IsGraphed) + "";
            }
            if (phoneGraph.DateEntry.Date != oldPhoneGraph.DateEntry.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateEntry = " + POut.Date(phoneGraph.DateEntry) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE phonegraph SET " + command
                      + " WHERE PhoneGraphNum = " + POut.Long(phoneGraph.PhoneGraphNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #9
0
ファイル: ProviderErxCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Converts a list of ProviderErx into a DataTable.</summary>
        public static DataTable ListToTable(List <ProviderErx> listProviderErxs, string tableName = "")
        {
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = "ProviderErx";
            }
            DataTable table = new DataTable(tableName);

            table.Columns.Add("ProviderErxNum");
            table.Columns.Add("PatNum");
            table.Columns.Add("NationalProviderID");
            table.Columns.Add("IsEnabled");
            table.Columns.Add("IsIdentifyProofed");
            table.Columns.Add("IsSentToHq");
            table.Columns.Add("IsEpcs");
            table.Columns.Add("ErxType");
            table.Columns.Add("UserId");
            table.Columns.Add("AccountId");
            table.Columns.Add("RegistrationKeyNum");
            foreach (ProviderErx providerErx in listProviderErxs)
            {
                table.Rows.Add(new object[] {
                    POut.Long(providerErx.ProviderErxNum),
                    POut.Long(providerErx.PatNum),
                    providerErx.NationalProviderID,
                    POut.Int((int)providerErx.IsEnabled),
                    POut.Bool(providerErx.IsIdentifyProofed),
                    POut.Bool(providerErx.IsSentToHq),
                    POut.Bool(providerErx.IsEpcs),
                    POut.Int((int)providerErx.ErxType),
                    providerErx.UserId,
                    providerErx.AccountId,
                    POut.Long(providerErx.RegistrationKeyNum),
                });
            }
            return(table);
        }
コード例 #10
0
        ///<summary>Converts a list of Dunning into a DataTable.</summary>
        public static DataTable ListToTable(List <Dunning> listDunnings, string tableName = "")
        {
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = "Dunning";
            }
            DataTable table = new DataTable(tableName);

            table.Columns.Add("DunningNum");
            table.Columns.Add("DunMessage");
            table.Columns.Add("BillingType");
            table.Columns.Add("AgeAccount");
            table.Columns.Add("InsIsPending");
            table.Columns.Add("MessageBold");
            table.Columns.Add("EmailSubject");
            table.Columns.Add("EmailBody");
            table.Columns.Add("DaysInAdvance");
            table.Columns.Add("ClinicNum");
            table.Columns.Add("IsSuperFamily");
            foreach (Dunning dunning in listDunnings)
            {
                table.Rows.Add(new object[] {
                    POut.Long(dunning.DunningNum),
                    dunning.DunMessage,
                    POut.Long(dunning.BillingType),
                    POut.Byte(dunning.AgeAccount),
                    POut.Int((int)dunning.InsIsPending),
                    dunning.MessageBold,
                    dunning.EmailSubject,
                    dunning.EmailBody,
                    POut.Int(dunning.DaysInAdvance),
                    POut.Long(dunning.ClinicNum),
                    POut.Bool(dunning.IsSuperFamily),
                });
            }
            return(table);
        }
コード例 #11
0
        ///<summary>Inserts one FeeSched into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(FeeSched feeSched, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO feesched (";

            if (!useExistingPK && isRandomKeys)
            {
                feeSched.FeeSchedNum = ReplicationServers.GetKeyNoCache("feesched", "FeeSchedNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "FeeSchedNum,";
            }
            command += "Description,FeeSchedType,ItemOrder,IsHidden,IsGlobal,SecUserNumEntry,SecDateEntry) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(feeSched.FeeSchedNum) + ",";
            }
            command +=
                "'" + POut.String(feeSched.Description) + "',"
                + POut.Int((int)feeSched.FeeSchedType) + ","
                + POut.Int(feeSched.ItemOrder) + ","
                + POut.Bool(feeSched.IsHidden) + ","
                + POut.Bool(feeSched.IsGlobal) + ","
                + POut.Long(feeSched.SecUserNumEntry) + ","
                + DbHelper.Now() + ")";
            //SecDateTEdit can only be set by MySQL
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                feeSched.FeeSchedNum = Db.NonQ(command, true, "FeeSchedNum", "feeSched");
            }
            return(feeSched.FeeSchedNum);
        }
コード例 #12
0
ファイル: AllergyCrud.cs プロジェクト: kjb7749/testImport
        ///<summary>Inserts one Allergy into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Allergy allergy, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO allergy (";

            if (!useExistingPK && isRandomKeys)
            {
                allergy.AllergyNum = ReplicationServers.GetKeyNoCache("allergy", "AllergyNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "AllergyNum,";
            }
            command += "AllergyDefNum,PatNum,Reaction,StatusIsActive,DateAdverseReaction,SnomedReaction) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(allergy.AllergyNum) + ",";
            }
            command +=
                POut.Long(allergy.AllergyDefNum) + ","
                + POut.Long(allergy.PatNum) + ","
                + "'" + POut.String(allergy.Reaction) + "',"
                + POut.Bool(allergy.StatusIsActive) + ","
                //DateTStamp can only be set by MySQL
                + POut.Date(allergy.DateAdverseReaction) + ","
                + "'" + POut.String(allergy.SnomedReaction) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                allergy.AllergyNum = Db.NonQ(command, true, "AllergyNum", "allergy");
            }
            return(allergy.AllergyNum);
        }
コード例 #13
0
        ///<summary>Inserts one MobileAppDevice into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(MobileAppDevice mobileAppDevice, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                mobileAppDevice.MobileAppDeviceNum = ReplicationServers.GetKey("mobileappdevice", "MobileAppDeviceNum");
            }
            string command = "INSERT INTO mobileappdevice (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "MobileAppDeviceNum,";
            }
            command += "ClinicNum,DeviceName,UniqueID,IsAllowed,PatNum,LastCheckInActivity,LastAttempt,LastLogin) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(mobileAppDevice.MobileAppDeviceNum) + ",";
            }
            command +=
                POut.Long(mobileAppDevice.ClinicNum) + ","
                + "'" + POut.String(mobileAppDevice.DeviceName) + "',"
                + "'" + POut.String(mobileAppDevice.UniqueID) + "',"
                + POut.Bool(mobileAppDevice.IsAllowed) + ","
                + POut.Long(mobileAppDevice.PatNum) + ","
                + POut.DateT(mobileAppDevice.LastCheckInActivity) + ","
                + POut.DateT(mobileAppDevice.LastAttempt) + ","
                + POut.DateT(mobileAppDevice.LastLogin) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                mobileAppDevice.MobileAppDeviceNum = Db.NonQ(command, true, "MobileAppDeviceNum", "mobileAppDevice");
            }
            return(mobileAppDevice.MobileAppDeviceNum);
        }
コード例 #14
0
ファイル: PopupCrud.cs プロジェクト: steev90/opendental
        ///<summary>Inserts one Popup into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Popup popup, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                popup.PopupNum = ReplicationServers.GetKey("popup", "PopupNum");
            }
            string command = "INSERT INTO popup (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "PopupNum,";
            }
            command += "PatNum,Description,IsDisabled,PopupLevel,UserNum,DateTimeEntry,IsArchived,PopupNumArchive) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(popup.PopupNum) + ",";
            }
            command +=
                POut.Long(popup.PatNum) + ","
                + "'" + POut.String(popup.Description) + "',"
                + POut.Bool(popup.IsDisabled) + ","
                + POut.Int((int)popup.PopupLevel) + ","
                + POut.Long(popup.UserNum) + ","
                + DbHelper.Now() + ","
                + POut.Bool(popup.IsArchived) + ","
                + POut.Long(popup.PopupNumArchive) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                popup.PopupNum = Db.NonQ(command, true);
            }
            return(popup.PopupNum);
        }
コード例 #15
0
        ///<summary>Updates one ComputerPref in the database.</summary>
        public static void Update(ComputerPref computerPref)
        {
            string command = "UPDATE computerpref SET "
                             + "ComputerName           = '" + POut.String(computerPref.ComputerName) + "', "
                             + "GraphicsUseHardware    =  " + POut.Bool(computerPref.GraphicsUseHardware) + ", "
                             + "GraphicsSimple         =  " + POut.Int((int)computerPref.GraphicsSimple) + ", "
                             + "SensorType             = '" + POut.String(computerPref.SensorType) + "', "
                             + "SensorBinned           =  " + POut.Bool(computerPref.SensorBinned) + ", "
                             + "SensorPort             =  " + POut.Int(computerPref.SensorPort) + ", "
                             + "SensorExposure         =  " + POut.Int(computerPref.SensorExposure) + ", "
                             + "GraphicsDoubleBuffering=  " + POut.Bool(computerPref.GraphicsDoubleBuffering) + ", "
                             + "PreferredPixelFormatNum=  " + POut.Int(computerPref.PreferredPixelFormatNum) + ", "
                             + "AtoZpath               = '" + POut.String(computerPref.AtoZpath) + "', "
                             + "TaskKeepListHidden     =  " + POut.Bool(computerPref.TaskKeepListHidden) + ", "
                             + "TaskDock               =  " + POut.Int(computerPref.TaskDock) + ", "
                             + "TaskX                  =  " + POut.Int(computerPref.TaskX) + ", "
                             + "TaskY                  =  " + POut.Int(computerPref.TaskY) + ", "
                             + "DirectXFormat          = '" + POut.String(computerPref.DirectXFormat) + "', "
                             + "ScanDocSelectSource    =  " + POut.Bool(computerPref.ScanDocSelectSource) + ", "
                             + "ScanDocShowOptions     =  " + POut.Bool(computerPref.ScanDocShowOptions) + ", "
                             + "ScanDocDuplex          =  " + POut.Bool(computerPref.ScanDocDuplex) + ", "
                             + "ScanDocGrayscale       =  " + POut.Bool(computerPref.ScanDocGrayscale) + ", "
                             + "ScanDocResolution      =  " + POut.Int(computerPref.ScanDocResolution) + ", "
                             + "ScanDocQuality         =  " + POut.Byte(computerPref.ScanDocQuality) + ", "
                             + "ClinicNum              =  " + POut.Long(computerPref.ClinicNum) + ", "
                             + "ApptViewNum            =  " + POut.Long(computerPref.ApptViewNum) + ", "
                             + "RecentApptView         =  " + POut.Byte(computerPref.RecentApptView) + ", "
                             + "PatSelectSearchMode    =  " + POut.Int((int)computerPref.PatSelectSearchMode) + ", "
                             + "NoShowLanguage         =  " + POut.Bool(computerPref.NoShowLanguage) + ", "
                             + "NoShowDecimal          =  " + POut.Bool(computerPref.NoShowDecimal) + ", "
                             + "ComputerOS             = '" + POut.String(computerPref.ComputerOS.ToString()) + "', "
                             + "HelpButtonXAdjustment  = '" + POut.Double(computerPref.HelpButtonXAdjustment) + "' "
                             + "WHERE ComputerPrefNum = " + POut.Long(computerPref.ComputerPrefNum);

            Db.NonQ(command);
        }
コード例 #16
0
ファイル: PatPlanCrud.cs プロジェクト: kjb7749/testImport
        ///<summary>Inserts one PatPlan into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(PatPlan patPlan, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                patPlan.PatPlanNum = ReplicationServers.GetKey("patplan", "PatPlanNum");
            }
            string command = "INSERT INTO patplan (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "PatPlanNum,";
            }
            command += "PatNum,Ordinal,IsPending,Relationship,PatID,InsSubNum,OrthoAutoFeeBilledOverride,OrthoAutoNextClaimDate) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(patPlan.PatPlanNum) + ",";
            }
            command +=
                POut.Long(patPlan.PatNum) + ","
                + POut.Byte(patPlan.Ordinal) + ","
                + POut.Bool(patPlan.IsPending) + ","
                + POut.Int((int)patPlan.Relationship) + ","
                + "'" + POut.String(patPlan.PatID) + "',"
                + POut.Long(patPlan.InsSubNum) + ","
                + "'" + POut.Double(patPlan.OrthoAutoFeeBilledOverride) + "',"
                + POut.Date(patPlan.OrthoAutoNextClaimDate) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                patPlan.PatPlanNum = Db.NonQ(command, true, "PatPlanNum", "patPlan");
            }
            return(patPlan.PatPlanNum);
        }
コード例 #17
0
        ///<summary>Inserts one RxDef into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(RxDef rxDef, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                rxDef.RxDefNum = ReplicationServers.GetKey("rxdef", "RxDefNum");
            }
            string command = "INSERT INTO rxdef (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "RxDefNum,";
            }
            command += "Drug,Sig,Disp,Refills,Notes,IsControlled,RxCui,IsProcRequired) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(rxDef.RxDefNum) + ",";
            }
            command +=
                "'" + POut.String(rxDef.Drug) + "',"
                + "'" + POut.String(rxDef.Sig) + "',"
                + "'" + POut.String(rxDef.Disp) + "',"
                + "'" + POut.String(rxDef.Refills) + "',"
                + "'" + POut.String(rxDef.Notes) + "',"
                + POut.Bool(rxDef.IsControlled) + ","
                + POut.Long(rxDef.RxCui) + ","
                + POut.Bool(rxDef.IsProcRequired) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                rxDef.RxDefNum = Db.NonQ(command, true, "RxDefNum", "rxDef");
            }
            return(rxDef.RxDefNum);
        }
コード例 #18
0
        ///<summary>Updates one ProcApptColor in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
        public static void Update(ProcApptColor procApptColor, ProcApptColor oldProcApptColor)
        {
            string command = "";

            if (procApptColor.CodeRange != oldProcApptColor.CodeRange)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CodeRange = '" + POut.String(procApptColor.CodeRange) + "'";
            }
            if (procApptColor.ShowPreviousDate != oldProcApptColor.ShowPreviousDate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ShowPreviousDate = " + POut.Bool(procApptColor.ShowPreviousDate) + "";
            }
            if (procApptColor.ColorText != oldProcApptColor.ColorText)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ColorText = " + POut.Int(procApptColor.ColorText.ToArgb()) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE procapptcolor SET " + command
                      + " WHERE ProcApptColorNum = " + POut.Long(procApptColor.ProcApptColorNum);
            Db.NonQ(command);
        }
コード例 #19
0
ファイル: UserWebCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Inserts one UserWeb into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(UserWeb userWeb, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                userWeb.UserWebNum = ReplicationServers.GetKey("userweb", "UserWebNum");
            }
            string command = "INSERT INTO userweb (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "UserWebNum,";
            }
            command += "FKey,FKeyType,UserName,Password,PasswordResetCode,RequireUserNameChange,DateTimeLastLogin,RequirePasswordChange) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(userWeb.UserWebNum) + ",";
            }
            command +=
                POut.Long(userWeb.FKey) + ","
                + POut.Int((int)userWeb.FKeyType) + ","
                + "'" + POut.String(userWeb.UserName) + "',"
                + "'" + POut.String(userWeb.Password) + "',"
                + "'" + POut.String(userWeb.PasswordResetCode) + "',"
                + POut.Bool(userWeb.RequireUserNameChange) + ","
                + POut.DateT(userWeb.DateTimeLastLogin) + ","
                + POut.Bool(userWeb.RequirePasswordChange) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                userWeb.UserWebNum = Db.NonQ(command, true, "UserWebNum", "userWeb");
            }
            return(userWeb.UserWebNum);
        }
コード例 #20
0
        ///<summary>Inserts one DiseaseDef into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(DiseaseDef diseaseDef, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO diseasedef (";

            if (!useExistingPK && isRandomKeys)
            {
                diseaseDef.DiseaseDefNum = ReplicationServers.GetKeyNoCache("diseasedef", "DiseaseDefNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "DiseaseDefNum,";
            }
            command += "DiseaseName,ItemOrder,IsHidden,ICD9Code,SnomedCode,Icd10Code) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                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 || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                diseaseDef.DiseaseDefNum = Db.NonQ(command, true, "DiseaseDefNum", "diseaseDef");
            }
            return(diseaseDef.DiseaseDefNum);
        }
コード例 #21
0
ファイル: TaskListCrud.cs プロジェクト: kjb7749/testImport
        ///<summary>Inserts one TaskList into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(TaskList taskList, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                taskList.TaskListNum = ReplicationServers.GetKey("tasklist", "TaskListNum");
            }
            string command = "INSERT INTO tasklist (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "TaskListNum,";
            }
            command += "Descript,Parent,DateTL,IsRepeating,DateType,FromNum,ObjectType,DateTimeEntry) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(taskList.TaskListNum) + ",";
            }
            command +=
                "'" + POut.String(taskList.Descript) + "',"
                + POut.Long(taskList.Parent) + ","
                + POut.Date(taskList.DateTL) + ","
                + POut.Bool(taskList.IsRepeating) + ","
                + POut.Int((int)taskList.DateType) + ","
                + POut.Long(taskList.FromNum) + ","
                + POut.Int((int)taskList.ObjectType) + ","
                + DbHelper.Now() + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                taskList.TaskListNum = Db.NonQ(command, true, "TaskListNum", "taskList");
            }
            return(taskList.TaskListNum);
        }
コード例 #22
0
        ///<summary>Updates one Phone in the database.</summary>
        public static void Update(Phone phone)
        {
            string command = "UPDATE phone SET "
                             + "Extension             =  " + POut.Int(phone.Extension) + ", "
                             + "EmployeeName          = '" + POut.String(phone.EmployeeName) + "', "
                             + "ClockStatus           = '" + POut.String(phone.ClockStatus.ToString()) + "', "
                             + "Description           = '" + POut.String(phone.Description) + "', "
                             + "ColorBar              =  " + POut.Int(phone.ColorBar.ToArgb()) + ", "
                             + "ColorText             =  " + POut.Int(phone.ColorText.ToArgb()) + ", "
                             + "EmployeeNum           =  " + POut.Long(phone.EmployeeNum) + ", "
                             + "CustomerNumber        = '" + POut.String(phone.CustomerNumber) + "', "
                             + "InOrOut               = '" + POut.String(phone.InOrOut) + "', "
                             + "PatNum                =  " + POut.Long(phone.PatNum) + ", "
                             + "DateTimeStart         =  " + POut.DateT(phone.DateTimeStart) + ", "
                             + "CustomerNumberRaw     = '" + POut.String(phone.CustomerNumberRaw) + "', "
                             + "LastCallTimeStart     =  " + POut.DateT(phone.LastCallTimeStart) + ", "
                             + "RingGroups            =  " + POut.Int((int)phone.RingGroups) + ", "
                             + "IsProximal            =  " + POut.Bool(phone.IsProximal) + ", "
                             + "DateTimeNeedsHelpStart=  " + POut.Date(phone.DateTimeNeedsHelpStart) + ", "
                             + "DateTProximal         =  " + POut.Date(phone.DateTProximal) + " "
                             + "WHERE PhoneNum = " + POut.Long(phone.PhoneNum);

            Db.NonQ(command);
        }
コード例 #23
0
ファイル: ClaimFormCrud.cs プロジェクト: steev90/opendental
        ///<summary>Inserts one ClaimForm into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(ClaimForm claimForm, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                claimForm.ClaimFormNum = ReplicationServers.GetKey("claimform", "ClaimFormNum");
            }
            string command = "INSERT INTO claimform (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ClaimFormNum,";
            }
            command += "Description,IsHidden,FontName,FontSize,UniqueID,PrintImages,OffsetX,OffsetY) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(claimForm.ClaimFormNum) + ",";
            }
            command +=
                "'" + POut.String(claimForm.Description) + "',"
                + POut.Bool(claimForm.IsHidden) + ","
                + "'" + POut.String(claimForm.FontName) + "',"
                + POut.Float(claimForm.FontSize) + ","
                + "'" + POut.String(claimForm.UniqueID) + "',"
                + POut.Bool(claimForm.PrintImages) + ","
                + POut.Int(claimForm.OffsetX) + ","
                + POut.Int(claimForm.OffsetY) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                claimForm.ClaimFormNum = Db.NonQ(command, true);
            }
            return(claimForm.ClaimFormNum);
        }
コード例 #24
0
        ///<summary>Inserts one ApptReminderSent into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ApptReminderSent apptReminderSent, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO apptremindersent (";

            if (!useExistingPK && isRandomKeys)
            {
                apptReminderSent.ApptReminderSentNum = ReplicationServers.GetKeyNoCache("apptremindersent", "ApptReminderSentNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ApptReminderSentNum,";
            }
            command += "ApptNum,ApptDateTime,DateTimeSent,TSPrior,ApptReminderRuleNum,IsSmsSent,IsEmailSent) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(apptReminderSent.ApptReminderSentNum) + ",";
            }
            command +=
                POut.Long(apptReminderSent.ApptNum) + ","
                + POut.DateT(apptReminderSent.ApptDateTime) + ","
                + POut.DateT(apptReminderSent.DateTimeSent) + ","
                + "'" + POut.Long(apptReminderSent.TSPrior.Ticks) + "',"
                + POut.Long(apptReminderSent.ApptReminderRuleNum) + ","
                + POut.Bool(apptReminderSent.IsSmsSent) + ","
                + POut.Bool(apptReminderSent.IsEmailSent) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                apptReminderSent.ApptReminderSentNum = Db.NonQ(command, true, "ApptReminderSentNum", "apptReminderSent");
            }
            return(apptReminderSent.ApptReminderSentNum);
        }
コード例 #25
0
        ///<summary>Inserts one Supply into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Supply supply, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                supply.SupplyNum = ReplicationServers.GetKey("supply", "SupplyNum");
            }
            string command = "INSERT INTO supply (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "SupplyNum,";
            }
            command += "SupplierNum,CatalogNumber,Descript,Category,ItemOrder,LevelDesired,IsHidden,Price) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(supply.SupplyNum) + ",";
            }
            command +=
                POut.Long(supply.SupplierNum) + ","
                + "'" + POut.String(supply.CatalogNumber) + "',"
                + "'" + POut.String(supply.Descript) + "',"
                + POut.Long(supply.Category) + ","
                + POut.Int(supply.ItemOrder) + ","
                + POut.Float(supply.LevelDesired) + ","
                + POut.Bool(supply.IsHidden) + ","
                + "'" + POut.Double(supply.Price) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                supply.SupplyNum = Db.NonQ(command, true);
            }
            return(supply.SupplyNum);
        }
コード例 #26
0
ファイル: AllergyCrud.cs プロジェクト: bek15071991/OpenDental
 ///<summary>Updates one Allergy 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(Allergy allergy,Allergy oldAllergy)
 {
     string command="";
     if(allergy.AllergyDefNum != oldAllergy.AllergyDefNum) {
         if(command!=""){ command+=",";}
         command+="AllergyDefNum = "+POut.Long(allergy.AllergyDefNum)+"";
     }
     if(allergy.PatNum != oldAllergy.PatNum) {
         if(command!=""){ command+=",";}
         command+="PatNum = "+POut.Long(allergy.PatNum)+"";
     }
     if(allergy.Reaction != oldAllergy.Reaction) {
         if(command!=""){ command+=",";}
         command+="Reaction = '"+POut.String(allergy.Reaction)+"'";
     }
     if(allergy.StatusIsActive != oldAllergy.StatusIsActive) {
         if(command!=""){ command+=",";}
         command+="StatusIsActive = "+POut.Bool(allergy.StatusIsActive)+"";
     }
     //DateTStamp can only be set by MySQL
     if(allergy.DateAdverseReaction.Date != oldAllergy.DateAdverseReaction.Date) {
         if(command!=""){ command+=",";}
         command+="DateAdverseReaction = "+POut.Date(allergy.DateAdverseReaction)+"";
     }
     if(allergy.SnomedReaction != oldAllergy.SnomedReaction) {
         if(command!=""){ command+=",";}
         command+="SnomedReaction = '"+POut.String(allergy.SnomedReaction)+"'";
     }
     if(command==""){
         return false;
     }
     command="UPDATE allergy SET "+command
         +" WHERE AllergyNum = "+POut.Long(allergy.AllergyNum);
     Db.NonQ(command);
     return true;
 }
コード例 #27
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);
        }
コード例 #28
0
        ///<summary>Updates one Laboratory in the database.</summary>
        public static void Update(Laboratory laboratory)
        {
            string command = "UPDATE laboratory SET "
                             + "Description  = '" + POut.String(laboratory.Description) + "', "
                             + "Phone        = '" + POut.String(laboratory.Phone) + "', "
                             + "Notes        =  " + DbHelper.ParamChar + "paramNotes, "
                             + "Slip         =  " + POut.Long(laboratory.Slip) + ", "
                             + "Address      = '" + POut.String(laboratory.Address) + "', "
                             + "City         = '" + POut.String(laboratory.City) + "', "
                             + "State        = '" + POut.String(laboratory.State) + "', "
                             + "Zip          = '" + POut.String(laboratory.Zip) + "', "
                             + "Email        = '" + POut.String(laboratory.Email) + "', "
                             + "WirelessPhone= '" + POut.String(laboratory.WirelessPhone) + "', "
                             + "IsHidden     =  " + POut.Bool(laboratory.IsHidden) + " "
                             + "WHERE LaboratoryNum = " + POut.Long(laboratory.LaboratoryNum);

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

            Db.NonQ(command, paramNotes);
        }
コード例 #29
0
        ///<summary>Updates one MedicationPat in the database.</summary>
        public static void Update(MedicationPat medicationPat)
        {
            string command = "UPDATE medicationpat SET "
                             + "PatNum          =  " + POut.Long(medicationPat.PatNum) + ", "
                             + "MedicationNum   =  " + POut.Long(medicationPat.MedicationNum) + ", "
                             + "PatNote         =  " + DbHelper.ParamChar + "paramPatNote, "
                             //DateTStamp can only be set by MySQL
                             + "DateStart       =  " + POut.Date(medicationPat.DateStart) + ", "
                             + "DateStop        =  " + POut.Date(medicationPat.DateStop) + ", "
                             + "ProvNum         =  " + POut.Long(medicationPat.ProvNum) + ", "
                             + "MedDescript     = '" + POut.String(medicationPat.MedDescript) + "', "
                             + "RxCui           =  " + POut.Long(medicationPat.RxCui) + ", "
                             + "ErxGuid         = '" + POut.String(medicationPat.ErxGuid) + "', "
                             + "IsCpoe          =  " + POut.Bool(medicationPat.IsCpoe) + " "
                             + "WHERE MedicationPatNum = " + POut.Long(medicationPat.MedicationPatNum);

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

            Db.NonQ(command, paramPatNote);
        }
コード例 #30
0
        ///<summary>Inserts one WebForms_Sheet into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(WebForms_Sheet webForms_Sheet, bool useExistingPK)
        {
            string command = "INSERT INTO webforms_sheet (";

            if (useExistingPK)
            {
                command += "SheetID,";
            }
            command += "DentalOfficeID,Description,SheetType,DateTimeSheet,FontSize,FontName,Width,Height,IsLandscape,ClinicNum,HasMobileLayout,SheetDefNum) VALUES(";
            if (useExistingPK)
            {
                command += POut.Long(webForms_Sheet.SheetID) + ",";
            }
            command +=
                POut.Long(webForms_Sheet.DentalOfficeID) + ","
                + "'" + POut.String(webForms_Sheet.Description) + "',"
                + POut.Int((int)webForms_Sheet.SheetType) + ","
                + POut.DateT(webForms_Sheet.DateTimeSheet) + ","
                + POut.Float(webForms_Sheet.FontSize) + ","
                + "'" + POut.String(webForms_Sheet.FontName) + "',"
                + POut.Int(webForms_Sheet.Width) + ","
                + POut.Int(webForms_Sheet.Height) + ","
                + POut.Bool(webForms_Sheet.IsLandscape) + ","
                + POut.Long(webForms_Sheet.ClinicNum) + ","
                + POut.Bool(webForms_Sheet.HasMobileLayout) + ","
                + POut.Long(webForms_Sheet.SheetDefNum) + ")";
            if (useExistingPK)
            {
                DataCore.NonQ(command);
            }
            else
            {
                webForms_Sheet.SheetID = DataCore.NonQ(command, true);
            }
            return(webForms_Sheet.SheetID);
        }