Example #1
0
        ///<summary>Inserts one ProcedureCode into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ProcedureCode procedureCode, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO procedurecode (";

            if (!useExistingPK && isRandomKeys)
            {
                procedureCode.CodeNum = ReplicationServers.GetKeyNoCache("procedurecode", "CodeNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "CodeNum,";
            }
            command += "ProcCode,Descript,AbbrDesc,ProcTime,ProcCat,TreatArea,NoBillIns,IsProsth,DefaultNote,IsHygiene,GTypeNum,AlternateCode1,MedicalCode,IsTaxed,PaintType,GraphicColor,LaymanTerm,IsCanadianLab,PreExisting,BaseUnits,SubstitutionCode,SubstOnlyIf,IsMultiVisit,DrugNDC,RevenueCodeDefault,ProvNumDefault,CanadaTimeUnits,IsRadiology,DefaultClaimNote,DefaultTPNote,BypassGlobalLock,TaxCode) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(procedureCode.CodeNum) + ",";
            }
            command +=
                "'" + POut.String(procedureCode.ProcCode) + "',"
                + "'" + POut.String(procedureCode.Descript) + "',"
                + "'" + POut.String(procedureCode.AbbrDesc) + "',"
                + "'" + POut.String(procedureCode.ProcTime) + "',"
                + POut.Long(procedureCode.ProcCat) + ","
                + POut.Int((int)procedureCode.TreatArea) + ","
                + POut.Bool(procedureCode.NoBillIns) + ","
                + POut.Bool(procedureCode.IsProsth) + ","
                + DbHelper.ParamChar + "paramDefaultNote,"
                + POut.Bool(procedureCode.IsHygiene) + ","
                + POut.Int(procedureCode.GTypeNum) + ","
                + "'" + POut.String(procedureCode.AlternateCode1) + "',"
                + "'" + POut.String(procedureCode.MedicalCode) + "',"
                + POut.Bool(procedureCode.IsTaxed) + ","
                + POut.Int((int)procedureCode.PaintType) + ","
                + POut.Int(procedureCode.GraphicColor.ToArgb()) + ","
                + "'" + POut.String(procedureCode.LaymanTerm) + "',"
                + POut.Bool(procedureCode.IsCanadianLab) + ","
                + POut.Bool(procedureCode.PreExisting) + ","
                + POut.Int(procedureCode.BaseUnits) + ","
                + "'" + POut.String(procedureCode.SubstitutionCode) + "',"
                + POut.Int((int)procedureCode.SubstOnlyIf) + ","
                //DateTStamp can only be set by MySQL
                + POut.Bool(procedureCode.IsMultiVisit) + ","
                + "'" + POut.String(procedureCode.DrugNDC) + "',"
                + "'" + POut.String(procedureCode.RevenueCodeDefault) + "',"
                + POut.Long(procedureCode.ProvNumDefault) + ","
                + "'" + POut.Double(procedureCode.CanadaTimeUnits) + "',"
                + POut.Bool(procedureCode.IsRadiology) + ","
                + DbHelper.ParamChar + "paramDefaultClaimNote,"
                + DbHelper.ParamChar + "paramDefaultTPNote,"
                + POut.Int((int)procedureCode.BypassGlobalLock) + ","
                + "'" + POut.String(procedureCode.TaxCode) + "')";
            if (procedureCode.DefaultNote == null)
            {
                procedureCode.DefaultNote = "";
            }
            OdSqlParameter paramDefaultNote = new OdSqlParameter("paramDefaultNote", OdDbType.Text, POut.StringParam(procedureCode.DefaultNote));

            if (procedureCode.DefaultClaimNote == null)
            {
                procedureCode.DefaultClaimNote = "";
            }
            OdSqlParameter paramDefaultClaimNote = new OdSqlParameter("paramDefaultClaimNote", OdDbType.Text, POut.StringParam(procedureCode.DefaultClaimNote));

            if (procedureCode.DefaultTPNote == null)
            {
                procedureCode.DefaultTPNote = "";
            }
            OdSqlParameter paramDefaultTPNote = new OdSqlParameter("paramDefaultTPNote", OdDbType.Text, POut.StringParam(procedureCode.DefaultTPNote));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramDefaultNote, paramDefaultClaimNote, paramDefaultTPNote);
            }
            else
            {
                procedureCode.CodeNum = Db.NonQ(command, true, "CodeNum", "procedureCode", paramDefaultNote, paramDefaultClaimNote, paramDefaultTPNote);
            }
            return(procedureCode.CodeNum);
        }
Example #2
0
        ///<summary>Updates one CreditCard 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(CreditCard creditCard, CreditCard oldCreditCard)
        {
            string command = "";

            if (creditCard.PatNum != oldCreditCard.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(creditCard.PatNum) + "";
            }
            if (creditCard.Address != oldCreditCard.Address)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Address = '" + POut.String(creditCard.Address) + "'";
            }
            if (creditCard.Zip != oldCreditCard.Zip)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Zip = '" + POut.String(creditCard.Zip) + "'";
            }
            if (creditCard.XChargeToken != oldCreditCard.XChargeToken)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "XChargeToken = '" + POut.String(creditCard.XChargeToken) + "'";
            }
            if (creditCard.CCNumberMasked != oldCreditCard.CCNumberMasked)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CCNumberMasked = '" + POut.String(creditCard.CCNumberMasked) + "'";
            }
            if (creditCard.CCExpiration.Date != oldCreditCard.CCExpiration.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CCExpiration = " + POut.Date(creditCard.CCExpiration) + "";
            }
            if (creditCard.ItemOrder != oldCreditCard.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(creditCard.ItemOrder) + "";
            }
            if (creditCard.ChargeAmt != oldCreditCard.ChargeAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ChargeAmt = '" + POut.Double(creditCard.ChargeAmt) + "'";
            }
            if (creditCard.DateStart.Date != oldCreditCard.DateStart.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateStart = " + POut.Date(creditCard.DateStart) + "";
            }
            if (creditCard.DateStop.Date != oldCreditCard.DateStop.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateStop = " + POut.Date(creditCard.DateStop) + "";
            }
            if (creditCard.Note != oldCreditCard.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = '" + POut.String(creditCard.Note) + "'";
            }
            if (creditCard.PayPlanNum != oldCreditCard.PayPlanNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayPlanNum = " + POut.Long(creditCard.PayPlanNum) + "";
            }
            if (creditCard.PayConnectToken != oldCreditCard.PayConnectToken)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayConnectToken = '" + POut.String(creditCard.PayConnectToken) + "'";
            }
            if (creditCard.PayConnectTokenExp.Date != oldCreditCard.PayConnectTokenExp.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayConnectTokenExp = " + POut.Date(creditCard.PayConnectTokenExp) + "";
            }
            if (creditCard.Procedures != oldCreditCard.Procedures)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Procedures = " + DbHelper.ParamChar + "paramProcedures";
            }
            if (creditCard.CCSource != oldCreditCard.CCSource)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CCSource = " + POut.Int((int)creditCard.CCSource) + "";
            }
            if (creditCard.ClinicNum != oldCreditCard.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(creditCard.ClinicNum) + "";
            }
            if (creditCard.ExcludeProcSync != oldCreditCard.ExcludeProcSync)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ExcludeProcSync = " + POut.Bool(creditCard.ExcludeProcSync) + "";
            }
            if (creditCard.PaySimpleToken != oldCreditCard.PaySimpleToken)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PaySimpleToken = '" + POut.String(creditCard.PaySimpleToken) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            if (creditCard.Procedures == null)
            {
                creditCard.Procedures = "";
            }
            OdSqlParameter paramProcedures = new OdSqlParameter("paramProcedures", OdDbType.Text, POut.StringParam(creditCard.Procedures));

            command = "UPDATE creditcard SET " + command
                      + " WHERE CreditCardNum = " + POut.Long(creditCard.CreditCardNum);
            Db.NonQ(command, paramProcedures);
            return(true);
        }
Example #3
0
        ///<summary>Converts a list of ProcTP into a DataTable.</summary>
        public static DataTable ListToTable(List <ProcTP> listProcTPs, string tableName = "")
        {
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = "ProcTP";
            }
            DataTable table = new DataTable(tableName);

            table.Columns.Add("ProcTPNum");
            table.Columns.Add("TreatPlanNum");
            table.Columns.Add("PatNum");
            table.Columns.Add("ProcNumOrig");
            table.Columns.Add("ItemOrder");
            table.Columns.Add("Priority");
            table.Columns.Add("ToothNumTP");
            table.Columns.Add("Surf");
            table.Columns.Add("ProcCode");
            table.Columns.Add("Descript");
            table.Columns.Add("FeeAmt");
            table.Columns.Add("PriInsAmt");
            table.Columns.Add("SecInsAmt");
            table.Columns.Add("PatAmt");
            table.Columns.Add("Discount");
            table.Columns.Add("Prognosis");
            table.Columns.Add("Dx");
            table.Columns.Add("ProcAbbr");
            table.Columns.Add("SecUserNumEntry");
            table.Columns.Add("SecDateEntry");
            table.Columns.Add("SecDateTEdit");
            table.Columns.Add("FeeAllowed");
            table.Columns.Add("TaxAmt");
            table.Columns.Add("ProvNum");
            table.Columns.Add("DateTP");
            table.Columns.Add("ClinicNum");
            table.Columns.Add("CatPercUCR");
            foreach (ProcTP procTP in listProcTPs)
            {
                table.Rows.Add(new object[] {
                    POut.Long(procTP.ProcTPNum),
                    POut.Long(procTP.TreatPlanNum),
                    POut.Long(procTP.PatNum),
                    POut.Long(procTP.ProcNumOrig),
                    POut.Int(procTP.ItemOrder),
                    POut.Long(procTP.Priority),
                    procTP.ToothNumTP,
                    procTP.Surf,
                    procTP.ProcCode,
                    procTP.Descript,
                    POut.Double(procTP.FeeAmt),
                    POut.Double(procTP.PriInsAmt),
                    POut.Double(procTP.SecInsAmt),
                    POut.Double(procTP.PatAmt),
                    POut.Double(procTP.Discount),
                    procTP.Prognosis,
                    procTP.Dx,
                    procTP.ProcAbbr,
                    POut.Long(procTP.SecUserNumEntry),
                    POut.DateT(procTP.SecDateEntry, false),
                    POut.DateT(procTP.SecDateTEdit, false),
                    POut.Double(procTP.FeeAllowed),
                    POut.Double(procTP.TaxAmt),
                    POut.Long(procTP.ProvNum),
                    POut.DateT(procTP.DateTP, false),
                    POut.Long(procTP.ClinicNum),
                    POut.Double(procTP.CatPercUCR),
                });
            }
            return(table);
        }
Example #4
0
        ///<summary>Updates one Adjustment in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
        public static void Update(Adjustment adjustment, Adjustment oldAdjustment)
        {
            string command = "";

            if (adjustment.AdjDate != oldAdjustment.AdjDate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AdjDate = " + POut.Date(adjustment.AdjDate) + "";
            }
            if (adjustment.AdjAmt != oldAdjustment.AdjAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AdjAmt = '" + POut.Double(adjustment.AdjAmt) + "'";
            }
            if (adjustment.PatNum != oldAdjustment.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(adjustment.PatNum) + "";
            }
            if (adjustment.AdjType != oldAdjustment.AdjType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AdjType = " + POut.Long(adjustment.AdjType) + "";
            }
            if (adjustment.ProvNum != oldAdjustment.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(adjustment.ProvNum) + "";
            }
            if (adjustment.AdjNote != oldAdjustment.AdjNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AdjNote = '" + POut.String(adjustment.AdjNote) + "'";
            }
            if (adjustment.ProcDate != oldAdjustment.ProcDate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcDate = " + POut.Date(adjustment.ProcDate) + "";
            }
            if (adjustment.ProcNum != oldAdjustment.ProcNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNum = " + POut.Long(adjustment.ProcNum) + "";
            }
            //DateEntry not allowed to change
            if (adjustment.ClinicNum != oldAdjustment.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(adjustment.ClinicNum) + "";
            }
            if (adjustment.StatementNum != oldAdjustment.StatementNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StatementNum = " + POut.Long(adjustment.StatementNum) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE adjustment SET " + command
                      + " WHERE AdjNum = " + POut.Long(adjustment.AdjNum);
            Db.NonQ(command);
        }
Example #5
0
        ///<summary>Converts a list of RxPat into a DataTable.</summary>
        public static DataTable ListToTable(List <RxPat> listRxPats, string tableName = "")
        {
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = "RxPat";
            }
            DataTable table = new DataTable(tableName);

            table.Columns.Add("RxNum");
            table.Columns.Add("PatNum");
            table.Columns.Add("RxDate");
            table.Columns.Add("Drug");
            table.Columns.Add("Sig");
            table.Columns.Add("Disp");
            table.Columns.Add("Refills");
            table.Columns.Add("ProvNum");
            table.Columns.Add("Notes");
            table.Columns.Add("PharmacyNum");
            table.Columns.Add("IsControlled");
            table.Columns.Add("DateTStamp");
            table.Columns.Add("SendStatus");
            table.Columns.Add("RxCui");
            table.Columns.Add("DosageCode");
            table.Columns.Add("ErxGuid");
            table.Columns.Add("IsErxOld");
            table.Columns.Add("ErxPharmacyInfo");
            table.Columns.Add("IsProcRequired");
            table.Columns.Add("ProcNum");
            table.Columns.Add("DaysOfSupply");
            table.Columns.Add("PatientInstruction");
            table.Columns.Add("ClinicNum");
            foreach (RxPat rxPat in listRxPats)
            {
                table.Rows.Add(new object[] {
                    POut.Long(rxPat.RxNum),
                    POut.Long(rxPat.PatNum),
                    POut.DateT(rxPat.RxDate, false),
                    rxPat.Drug,
                    rxPat.Sig,
                    rxPat.Disp,
                    rxPat.Refills,
                    POut.Long(rxPat.ProvNum),
                    rxPat.Notes,
                    POut.Long(rxPat.PharmacyNum),
                    POut.Bool(rxPat.IsControlled),
                    POut.DateT(rxPat.DateTStamp, false),
                    POut.Int((int)rxPat.SendStatus),
                    POut.Long(rxPat.RxCui),
                    rxPat.DosageCode,
                    rxPat.ErxGuid,
                    POut.Bool(rxPat.IsErxOld),
                    rxPat.ErxPharmacyInfo,
                    POut.Bool(rxPat.IsProcRequired),
                    POut.Long(rxPat.ProcNum),
                    POut.Double(rxPat.DaysOfSupply),
                    rxPat.PatientInstruction,
                    POut.Long(rxPat.ClinicNum),
                });
            }
            return(table);
        }
Example #6
0
        ///<summary>Updates one TsiTransLog 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(TsiTransLog tsiTransLog, TsiTransLog oldTsiTransLog)
        {
            string command = "";

            if (tsiTransLog.PatNum != oldTsiTransLog.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(tsiTransLog.PatNum) + "";
            }
            if (tsiTransLog.UserNum != oldTsiTransLog.UserNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UserNum = " + POut.Long(tsiTransLog.UserNum) + "";
            }
            if (tsiTransLog.TransType != oldTsiTransLog.TransType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TransType = " + POut.Int((int)tsiTransLog.TransType) + "";
            }
            //TransDateTime not allowed to change
            if (tsiTransLog.DemandType != oldTsiTransLog.DemandType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DemandType = " + POut.Int((int)tsiTransLog.DemandType) + "";
            }
            if (tsiTransLog.ServiceCode != oldTsiTransLog.ServiceCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ServiceCode = " + POut.Int((int)tsiTransLog.ServiceCode) + "";
            }
            if (tsiTransLog.ClientId != oldTsiTransLog.ClientId)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClientId = '" + POut.String(tsiTransLog.ClientId) + "'";
            }
            if (tsiTransLog.TransAmt != oldTsiTransLog.TransAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TransAmt = '" + POut.Double(tsiTransLog.TransAmt) + "'";
            }
            if (tsiTransLog.AccountBalance != oldTsiTransLog.AccountBalance)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AccountBalance = '" + POut.Double(tsiTransLog.AccountBalance) + "'";
            }
            if (tsiTransLog.FKeyType != oldTsiTransLog.FKeyType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FKeyType = " + POut.Int((int)tsiTransLog.FKeyType) + "";
            }
            if (tsiTransLog.FKey != oldTsiTransLog.FKey)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FKey = " + POut.Long(tsiTransLog.FKey) + "";
            }
            if (tsiTransLog.RawMsgText != oldTsiTransLog.RawMsgText)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RawMsgText = '" + POut.String(tsiTransLog.RawMsgText) + "'";
            }
            if (tsiTransLog.TransJson != oldTsiTransLog.TransJson)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TransJson = " + DbHelper.ParamChar + "paramTransJson";
            }
            if (command == "")
            {
                return(false);
            }
            if (tsiTransLog.TransJson == null)
            {
                tsiTransLog.TransJson = "";
            }
            OdSqlParameter paramTransJson = new OdSqlParameter("paramTransJson", OdDbType.Text, POut.StringParam(tsiTransLog.TransJson));

            command = "UPDATE tsitranslog SET " + command
                      + " WHERE TsiTransLogNum = " + POut.Long(tsiTransLog.TsiTransLogNum);
            Db.NonQ(command, paramTransJson);
            return(true);
        }
Example #7
0
 ///<summary>Inserts many PayPlanCharges into the database.  Provides option to use the existing priKey.</summary>
 public static void InsertMany(List <PayPlanCharge> listPayPlanCharges, bool useExistingPK)
 {
     if (!useExistingPK && PrefC.RandomKeys)
     {
         foreach (PayPlanCharge payPlanCharge in listPayPlanCharges)
         {
             Insert(payPlanCharge);
         }
     }
     else
     {
         StringBuilder sbCommands = null;
         int           index      = 0;
         int           countRows  = 0;
         while (index < listPayPlanCharges.Count)
         {
             PayPlanCharge payPlanCharge = listPayPlanCharges[index];
             StringBuilder sbRow         = new StringBuilder("(");
             bool          hasComma      = false;
             if (sbCommands == null)
             {
                 sbCommands = new StringBuilder();
                 sbCommands.Append("INSERT INTO payplancharge (");
                 if (useExistingPK)
                 {
                     sbCommands.Append("PayPlanChargeNum,");
                 }
                 sbCommands.Append("PayPlanNum,Guarantor,PatNum,ChargeDate,Principal,Interest,Note,ProvNum,ClinicNum,ChargeType,ProcNum,SecDateTEntry,StatementNum,FKey,LinkType) VALUES ");
                 countRows = 0;
             }
             else
             {
                 hasComma = true;
             }
             if (useExistingPK)
             {
                 sbRow.Append(POut.Long(payPlanCharge.PayPlanChargeNum)); sbRow.Append(",");
             }
             sbRow.Append(POut.Long(payPlanCharge.PayPlanNum)); sbRow.Append(",");
             sbRow.Append(POut.Long(payPlanCharge.Guarantor)); sbRow.Append(",");
             sbRow.Append(POut.Long(payPlanCharge.PatNum)); sbRow.Append(",");
             sbRow.Append(POut.Date(payPlanCharge.ChargeDate)); sbRow.Append(",");
             sbRow.Append("'" + POut.Double(payPlanCharge.Principal) + "'"); sbRow.Append(",");
             sbRow.Append("'" + POut.Double(payPlanCharge.Interest) + "'"); sbRow.Append(",");
             sbRow.Append("'" + POut.String(payPlanCharge.Note) + "'"); sbRow.Append(",");
             sbRow.Append(POut.Long(payPlanCharge.ProvNum)); sbRow.Append(",");
             sbRow.Append(POut.Long(payPlanCharge.ClinicNum)); sbRow.Append(",");
             sbRow.Append(POut.Int((int)payPlanCharge.ChargeType)); sbRow.Append(",");
             sbRow.Append(POut.Long(payPlanCharge.ProcNum)); sbRow.Append(",");
             sbRow.Append(DbHelper.Now()); sbRow.Append(",");
             //SecDateTEdit can only be set by MySQL
             sbRow.Append(POut.Long(payPlanCharge.StatementNum)); sbRow.Append(",");
             sbRow.Append(POut.Long(payPlanCharge.FKey)); sbRow.Append(",");
             sbRow.Append(POut.Int((int)payPlanCharge.LinkType)); sbRow.Append(")");
             if (sbCommands.Length + sbRow.Length + 1 > TableBase.MaxAllowedPacketCount && countRows > 0)
             {
                 Db.NonQ(sbCommands.ToString());
                 sbCommands = null;
             }
             else
             {
                 if (hasComma)
                 {
                     sbCommands.Append(",");
                 }
                 sbCommands.Append(sbRow.ToString());
                 countRows++;
                 if (index == listPayPlanCharges.Count - 1)
                 {
                     Db.NonQ(sbCommands.ToString());
                 }
                 index++;
             }
         }
     }
 }
Example #8
0
        ///<summary>Updates one Fee 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(Fee fee, Fee oldFee)
        {
            string command = "";

            if (fee.Amount != oldFee.Amount)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Amount = '" + POut.Double(fee.Amount) + "'";
            }
            if (fee.OldCode != oldFee.OldCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OldCode = '" + POut.String(fee.OldCode) + "'";
            }
            if (fee.FeeSched != oldFee.FeeSched)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeSched = " + POut.Long(fee.FeeSched) + "";
            }
            if (fee.UseDefaultFee != oldFee.UseDefaultFee)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UseDefaultFee = " + POut.Bool(fee.UseDefaultFee) + "";
            }
            if (fee.UseDefaultCov != oldFee.UseDefaultCov)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UseDefaultCov = " + POut.Bool(fee.UseDefaultCov) + "";
            }
            if (fee.CodeNum != oldFee.CodeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CodeNum = " + POut.Long(fee.CodeNum) + "";
            }
            if (fee.ClinicNum != oldFee.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(fee.ClinicNum) + "";
            }
            if (fee.ProvNum != oldFee.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(fee.ProvNum) + "";
            }
            //SecUserNumEntry excluded from update
            //SecDateEntry not allowed to change
            //SecDateTEdit can only be set by MySQL
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE fee SET " + command
                      + " WHERE FeeNum = " + POut.Long(fee.FeeNum);
            Db.NonQ(command);
            return(true);
        }
Example #9
0
        ///<summary>Updates one ClaimPayment 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(ClaimPayment claimPayment, ClaimPayment oldClaimPayment)
        {
            string command = "";

            if (claimPayment.CheckDate.Date != oldClaimPayment.CheckDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CheckDate = " + POut.Date(claimPayment.CheckDate) + "";
            }
            if (claimPayment.CheckAmt != oldClaimPayment.CheckAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CheckAmt = '" + POut.Double(claimPayment.CheckAmt) + "'";
            }
            if (claimPayment.CheckNum != oldClaimPayment.CheckNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CheckNum = '" + POut.String(claimPayment.CheckNum) + "'";
            }
            if (claimPayment.BankBranch != oldClaimPayment.BankBranch)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BankBranch = '" + POut.String(claimPayment.BankBranch) + "'";
            }
            if (claimPayment.Note != oldClaimPayment.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = '" + POut.String(claimPayment.Note) + "'";
            }
            if (claimPayment.ClinicNum != oldClaimPayment.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(claimPayment.ClinicNum) + "";
            }
            if (claimPayment.DepositNum != oldClaimPayment.DepositNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DepositNum = " + POut.Long(claimPayment.DepositNum) + "";
            }
            if (claimPayment.CarrierName != oldClaimPayment.CarrierName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CarrierName = '" + POut.String(claimPayment.CarrierName) + "'";
            }
            if (claimPayment.DateIssued.Date != oldClaimPayment.DateIssued.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateIssued = " + POut.Date(claimPayment.DateIssued) + "";
            }
            if (claimPayment.IsPartial != oldClaimPayment.IsPartial)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsPartial = " + POut.Bool(claimPayment.IsPartial) + "";
            }
            if (claimPayment.PayType != oldClaimPayment.PayType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayType = " + POut.Long(claimPayment.PayType) + "";
            }
            //SecUserNumEntry excluded from update
            //SecDateEntry not allowed to change
            //SecDateTEdit can only be set by MySQL
            if (claimPayment.PayGroup != oldClaimPayment.PayGroup)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayGroup = " + POut.Long(claimPayment.PayGroup) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE claimpayment SET " + command
                      + " WHERE ClaimPaymentNum = " + POut.Long(claimPayment.ClaimPaymentNum);
            Db.NonQ(command);
            return(true);
        }
Example #10
0
        ///<summary>Inserts one Statement into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Statement statement, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO statement (";

            if (!useExistingPK && isRandomKeys)
            {
                statement.StatementNum = ReplicationServers.GetKeyNoCache("statement", "StatementNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "StatementNum,";
            }
            command += "PatNum,SuperFamily,DateSent,DateRangeFrom,DateRangeTo,Note,NoteBold,Mode_,HidePayment,SinglePatient,Intermingled,IsSent,DocNum,IsReceipt,IsInvoice,IsInvoiceCopy,EmailSubject,EmailBody,IsBalValid,InsEst,BalTotal,StatementType,ShortGUID,StatementURL,StatementShortURL,SmsSendStatus) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(statement.StatementNum) + ",";
            }
            command +=
                POut.Long(statement.PatNum) + ","
                + POut.Long(statement.SuperFamily) + ","
                + POut.Date(statement.DateSent) + ","
                + POut.Date(statement.DateRangeFrom) + ","
                + POut.Date(statement.DateRangeTo) + ","
                + DbHelper.ParamChar + "paramNote,"
                + DbHelper.ParamChar + "paramNoteBold,"
                + POut.Int((int)statement.Mode_) + ","
                + POut.Bool(statement.HidePayment) + ","
                + POut.Bool(statement.SinglePatient) + ","
                + POut.Bool(statement.Intermingled) + ","
                + POut.Bool(statement.IsSent) + ","
                + POut.Long(statement.DocNum) + ","
                //DateTStamp can only be set by MySQL
                + POut.Bool(statement.IsReceipt) + ","
                + POut.Bool(statement.IsInvoice) + ","
                + POut.Bool(statement.IsInvoiceCopy) + ","
                + "'" + POut.String(statement.EmailSubject) + "',"
                + DbHelper.ParamChar + "paramEmailBody,"
                + POut.Bool(statement.IsBalValid) + ","
                + "'" + POut.Double(statement.InsEst) + "',"
                + "'" + POut.Double(statement.BalTotal) + "',"
                + "'" + POut.String(statement.StatementType.ToString()) + "',"
                + "'" + POut.String(statement.ShortGUID) + "',"
                + "'" + POut.String(statement.StatementURL) + "',"
                + "'" + POut.String(statement.StatementShortURL) + "',"
                + POut.Int((int)statement.SmsSendStatus) + ")";
            if (statement.Note == null)
            {
                statement.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(statement.Note));

            if (statement.NoteBold == null)
            {
                statement.NoteBold = "";
            }
            OdSqlParameter paramNoteBold = new OdSqlParameter("paramNoteBold", OdDbType.Text, POut.StringParam(statement.NoteBold));

            if (statement.EmailBody == null)
            {
                statement.EmailBody = "";
            }
            OdSqlParameter paramEmailBody = new OdSqlParameter("paramEmailBody", OdDbType.Text, POut.StringParam(statement.EmailBody));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramNote, paramNoteBold, paramEmailBody);
            }
            else
            {
                statement.StatementNum = Db.NonQ(command, true, "StatementNum", "statement", paramNote, paramNoteBold, paramEmailBody);
            }
            return(statement.StatementNum);
        }
Example #11
0
        ///<summary>Updates one Statement 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(Statement statement, Statement oldStatement)
        {
            string command = "";

            if (statement.PatNum != oldStatement.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(statement.PatNum) + "";
            }
            if (statement.SuperFamily != oldStatement.SuperFamily)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SuperFamily = " + POut.Long(statement.SuperFamily) + "";
            }
            if (statement.DateSent.Date != oldStatement.DateSent.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateSent = " + POut.Date(statement.DateSent) + "";
            }
            if (statement.DateRangeFrom.Date != oldStatement.DateRangeFrom.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateRangeFrom = " + POut.Date(statement.DateRangeFrom) + "";
            }
            if (statement.DateRangeTo.Date != oldStatement.DateRangeTo.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateRangeTo = " + POut.Date(statement.DateRangeTo) + "";
            }
            if (statement.Note != oldStatement.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (statement.NoteBold != oldStatement.NoteBold)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "NoteBold = " + DbHelper.ParamChar + "paramNoteBold";
            }
            if (statement.Mode_ != oldStatement.Mode_)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Mode_ = " + POut.Int((int)statement.Mode_) + "";
            }
            if (statement.HidePayment != oldStatement.HidePayment)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HidePayment = " + POut.Bool(statement.HidePayment) + "";
            }
            if (statement.SinglePatient != oldStatement.SinglePatient)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SinglePatient = " + POut.Bool(statement.SinglePatient) + "";
            }
            if (statement.Intermingled != oldStatement.Intermingled)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Intermingled = " + POut.Bool(statement.Intermingled) + "";
            }
            if (statement.IsSent != oldStatement.IsSent)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsSent = " + POut.Bool(statement.IsSent) + "";
            }
            if (statement.DocNum != oldStatement.DocNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DocNum = " + POut.Long(statement.DocNum) + "";
            }
            //DateTStamp can only be set by MySQL
            if (statement.IsReceipt != oldStatement.IsReceipt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsReceipt = " + POut.Bool(statement.IsReceipt) + "";
            }
            if (statement.IsInvoice != oldStatement.IsInvoice)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsInvoice = " + POut.Bool(statement.IsInvoice) + "";
            }
            if (statement.IsInvoiceCopy != oldStatement.IsInvoiceCopy)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsInvoiceCopy = " + POut.Bool(statement.IsInvoiceCopy) + "";
            }
            if (statement.EmailSubject != oldStatement.EmailSubject)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmailSubject = '" + POut.String(statement.EmailSubject) + "'";
            }
            if (statement.EmailBody != oldStatement.EmailBody)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmailBody = " + DbHelper.ParamChar + "paramEmailBody";
            }
            if (statement.IsBalValid != oldStatement.IsBalValid)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsBalValid = " + POut.Bool(statement.IsBalValid) + "";
            }
            if (statement.InsEst != oldStatement.InsEst)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "InsEst = '" + POut.Double(statement.InsEst) + "'";
            }
            if (statement.BalTotal != oldStatement.BalTotal)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BalTotal = '" + POut.Double(statement.BalTotal) + "'";
            }
            if (statement.StatementType != oldStatement.StatementType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StatementType = '" + POut.String(statement.StatementType.ToString()) + "'";
            }
            if (statement.ShortGUID != oldStatement.ShortGUID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ShortGUID = '" + POut.String(statement.ShortGUID) + "'";
            }
            if (statement.StatementURL != oldStatement.StatementURL)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StatementURL = '" + POut.String(statement.StatementURL) + "'";
            }
            if (statement.StatementShortURL != oldStatement.StatementShortURL)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StatementShortURL = '" + POut.String(statement.StatementShortURL) + "'";
            }
            if (statement.SmsSendStatus != oldStatement.SmsSendStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SmsSendStatus = " + POut.Int((int)statement.SmsSendStatus) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (statement.Note == null)
            {
                statement.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(statement.Note));

            if (statement.NoteBold == null)
            {
                statement.NoteBold = "";
            }
            OdSqlParameter paramNoteBold = new OdSqlParameter("paramNoteBold", OdDbType.Text, POut.StringParam(statement.NoteBold));

            if (statement.EmailBody == null)
            {
                statement.EmailBody = "";
            }
            OdSqlParameter paramEmailBody = new OdSqlParameter("paramEmailBody", OdDbType.Text, POut.StringParam(statement.EmailBody));

            command = "UPDATE statement SET " + command
                      + " WHERE StatementNum = " + POut.Long(statement.StatementNum);
            Db.NonQ(command, paramNote, paramNoteBold, paramEmailBody);
            return(true);
        }
Example #12
0
        ///<summary>Converts a list of Statement into a DataTable.</summary>
        public static DataTable ListToTable(List <Statement> listStatements, string tableName = "")
        {
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = "Statement";
            }
            DataTable table = new DataTable(tableName);

            table.Columns.Add("StatementNum");
            table.Columns.Add("PatNum");
            table.Columns.Add("SuperFamily");
            table.Columns.Add("DateSent");
            table.Columns.Add("DateRangeFrom");
            table.Columns.Add("DateRangeTo");
            table.Columns.Add("Note");
            table.Columns.Add("NoteBold");
            table.Columns.Add("Mode_");
            table.Columns.Add("HidePayment");
            table.Columns.Add("SinglePatient");
            table.Columns.Add("Intermingled");
            table.Columns.Add("IsSent");
            table.Columns.Add("DocNum");
            table.Columns.Add("DateTStamp");
            table.Columns.Add("IsReceipt");
            table.Columns.Add("IsInvoice");
            table.Columns.Add("IsInvoiceCopy");
            table.Columns.Add("EmailSubject");
            table.Columns.Add("EmailBody");
            table.Columns.Add("IsBalValid");
            table.Columns.Add("InsEst");
            table.Columns.Add("BalTotal");
            table.Columns.Add("StatementType");
            table.Columns.Add("ShortGUID");
            table.Columns.Add("StatementURL");
            table.Columns.Add("StatementShortURL");
            table.Columns.Add("SmsSendStatus");
            foreach (Statement statement in listStatements)
            {
                table.Rows.Add(new object[] {
                    POut.Long(statement.StatementNum),
                    POut.Long(statement.PatNum),
                    POut.Long(statement.SuperFamily),
                    POut.DateT(statement.DateSent, false),
                    POut.DateT(statement.DateRangeFrom, false),
                    POut.DateT(statement.DateRangeTo, false),
                    statement.Note,
                    statement.NoteBold,
                    POut.Int((int)statement.Mode_),
                    POut.Bool(statement.HidePayment),
                    POut.Bool(statement.SinglePatient),
                    POut.Bool(statement.Intermingled),
                    POut.Bool(statement.IsSent),
                    POut.Long(statement.DocNum),
                    POut.DateT(statement.DateTStamp, false),
                    POut.Bool(statement.IsReceipt),
                    POut.Bool(statement.IsInvoice),
                    POut.Bool(statement.IsInvoiceCopy),
                    statement.EmailSubject,
                    statement.EmailBody,
                    POut.Bool(statement.IsBalValid),
                    POut.Double(statement.InsEst),
                    POut.Double(statement.BalTotal),
                    POut.Int((int)statement.StatementType),
                    statement.ShortGUID,
                    statement.StatementURL,
                    statement.StatementShortURL,
                    POut.Int((int)statement.SmsSendStatus),
                });
            }
            return(table);
        }
Example #13
0
        ///<summary>Updates one ProcTP 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(ProcTP procTP, ProcTP oldProcTP)
        {
            string command = "";

            if (procTP.TreatPlanNum != oldProcTP.TreatPlanNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TreatPlanNum = " + POut.Long(procTP.TreatPlanNum) + "";
            }
            if (procTP.PatNum != oldProcTP.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(procTP.PatNum) + "";
            }
            if (procTP.ProcNumOrig != oldProcTP.ProcNumOrig)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNumOrig = " + POut.Long(procTP.ProcNumOrig) + "";
            }
            if (procTP.ItemOrder != oldProcTP.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(procTP.ItemOrder) + "";
            }
            if (procTP.Priority != oldProcTP.Priority)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Priority = " + POut.Long(procTP.Priority) + "";
            }
            if (procTP.ToothNumTP != oldProcTP.ToothNumTP)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ToothNumTP = '" + POut.String(procTP.ToothNumTP) + "'";
            }
            if (procTP.Surf != oldProcTP.Surf)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Surf = '" + POut.String(procTP.Surf) + "'";
            }
            if (procTP.ProcCode != oldProcTP.ProcCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcCode = '" + POut.String(procTP.ProcCode) + "'";
            }
            if (procTP.Descript != oldProcTP.Descript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Descript = '" + POut.String(procTP.Descript) + "'";
            }
            if (procTP.FeeAmt != oldProcTP.FeeAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeAmt = '" + POut.Double(procTP.FeeAmt) + "'";
            }
            if (procTP.PriInsAmt != oldProcTP.PriInsAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PriInsAmt = '" + POut.Double(procTP.PriInsAmt) + "'";
            }
            if (procTP.SecInsAmt != oldProcTP.SecInsAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SecInsAmt = '" + POut.Double(procTP.SecInsAmt) + "'";
            }
            if (procTP.PatAmt != oldProcTP.PatAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatAmt = '" + POut.Double(procTP.PatAmt) + "'";
            }
            if (procTP.Discount != oldProcTP.Discount)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Discount = '" + POut.Double(procTP.Discount) + "'";
            }
            if (procTP.Prognosis != oldProcTP.Prognosis)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Prognosis = '" + POut.String(procTP.Prognosis) + "'";
            }
            if (procTP.Dx != oldProcTP.Dx)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Dx = '" + POut.String(procTP.Dx) + "'";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE proctp SET " + command
                      + " WHERE ProcTPNum = " + POut.Long(procTP.ProcTPNum);
            Db.NonQ(command);
        }
Example #14
0
        ///<summary>Updates one ProcedureCode 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(ProcedureCode procedureCode, ProcedureCode oldProcedureCode)
        {
            string command = "";

            //ProcCode excluded from update
            if (procedureCode.Descript != oldProcedureCode.Descript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Descript = '" + POut.String(procedureCode.Descript) + "'";
            }
            if (procedureCode.AbbrDesc != oldProcedureCode.AbbrDesc)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AbbrDesc = '" + POut.String(procedureCode.AbbrDesc) + "'";
            }
            if (procedureCode.ProcTime != oldProcedureCode.ProcTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcTime = '" + POut.String(procedureCode.ProcTime) + "'";
            }
            if (procedureCode.ProcCat != oldProcedureCode.ProcCat)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcCat = " + POut.Long(procedureCode.ProcCat) + "";
            }
            if (procedureCode.TreatArea != oldProcedureCode.TreatArea)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TreatArea = " + POut.Int((int)procedureCode.TreatArea) + "";
            }
            if (procedureCode.NoBillIns != oldProcedureCode.NoBillIns)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "NoBillIns = " + POut.Bool(procedureCode.NoBillIns) + "";
            }
            if (procedureCode.IsProsth != oldProcedureCode.IsProsth)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsProsth = " + POut.Bool(procedureCode.IsProsth) + "";
            }
            if (procedureCode.DefaultNote != oldProcedureCode.DefaultNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DefaultNote = " + DbHelper.ParamChar + "paramDefaultNote";
            }
            if (procedureCode.IsHygiene != oldProcedureCode.IsHygiene)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHygiene = " + POut.Bool(procedureCode.IsHygiene) + "";
            }
            if (procedureCode.GTypeNum != oldProcedureCode.GTypeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "GTypeNum = " + POut.Int(procedureCode.GTypeNum) + "";
            }
            if (procedureCode.AlternateCode1 != oldProcedureCode.AlternateCode1)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AlternateCode1 = '" + POut.String(procedureCode.AlternateCode1) + "'";
            }
            if (procedureCode.MedicalCode != oldProcedureCode.MedicalCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicalCode = '" + POut.String(procedureCode.MedicalCode) + "'";
            }
            if (procedureCode.IsTaxed != oldProcedureCode.IsTaxed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsTaxed = " + POut.Bool(procedureCode.IsTaxed) + "";
            }
            if (procedureCode.PaintType != oldProcedureCode.PaintType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PaintType = " + POut.Int((int)procedureCode.PaintType) + "";
            }
            if (procedureCode.GraphicColor != oldProcedureCode.GraphicColor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "GraphicColor = " + POut.Int(procedureCode.GraphicColor.ToArgb()) + "";
            }
            if (procedureCode.LaymanTerm != oldProcedureCode.LaymanTerm)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LaymanTerm = '" + POut.String(procedureCode.LaymanTerm) + "'";
            }
            if (procedureCode.IsCanadianLab != oldProcedureCode.IsCanadianLab)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsCanadianLab = " + POut.Bool(procedureCode.IsCanadianLab) + "";
            }
            if (procedureCode.PreExisting != oldProcedureCode.PreExisting)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PreExisting = " + POut.Bool(procedureCode.PreExisting) + "";
            }
            if (procedureCode.BaseUnits != oldProcedureCode.BaseUnits)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BaseUnits = " + POut.Int(procedureCode.BaseUnits) + "";
            }
            if (procedureCode.SubstitutionCode != oldProcedureCode.SubstitutionCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SubstitutionCode = '" + POut.String(procedureCode.SubstitutionCode) + "'";
            }
            if (procedureCode.SubstOnlyIf != oldProcedureCode.SubstOnlyIf)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SubstOnlyIf = " + POut.Int((int)procedureCode.SubstOnlyIf) + "";
            }
            //DateTStamp can only be set by MySQL
            if (procedureCode.IsMultiVisit != oldProcedureCode.IsMultiVisit)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsMultiVisit = " + POut.Bool(procedureCode.IsMultiVisit) + "";
            }
            if (procedureCode.DrugNDC != oldProcedureCode.DrugNDC)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DrugNDC = '" + POut.String(procedureCode.DrugNDC) + "'";
            }
            if (procedureCode.RevenueCodeDefault != oldProcedureCode.RevenueCodeDefault)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RevenueCodeDefault = '" + POut.String(procedureCode.RevenueCodeDefault) + "'";
            }
            if (procedureCode.ProvNumDefault != oldProcedureCode.ProvNumDefault)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNumDefault = " + POut.Long(procedureCode.ProvNumDefault) + "";
            }
            if (procedureCode.CanadaTimeUnits != oldProcedureCode.CanadaTimeUnits)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CanadaTimeUnits = '" + POut.Double(procedureCode.CanadaTimeUnits) + "'";
            }
            if (procedureCode.IsRadiology != oldProcedureCode.IsRadiology)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsRadiology = " + POut.Bool(procedureCode.IsRadiology) + "";
            }
            if (procedureCode.DefaultClaimNote != oldProcedureCode.DefaultClaimNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DefaultClaimNote = " + DbHelper.ParamChar + "paramDefaultClaimNote";
            }
            if (procedureCode.DefaultTPNote != oldProcedureCode.DefaultTPNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DefaultTPNote = " + DbHelper.ParamChar + "paramDefaultTPNote";
            }
            if (procedureCode.BypassGlobalLock != oldProcedureCode.BypassGlobalLock)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BypassGlobalLock = " + POut.Int((int)procedureCode.BypassGlobalLock) + "";
            }
            if (procedureCode.TaxCode != oldProcedureCode.TaxCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TaxCode = '" + POut.String(procedureCode.TaxCode) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            if (procedureCode.DefaultNote == null)
            {
                procedureCode.DefaultNote = "";
            }
            OdSqlParameter paramDefaultNote = new OdSqlParameter("paramDefaultNote", OdDbType.Text, POut.StringParam(procedureCode.DefaultNote));

            if (procedureCode.DefaultClaimNote == null)
            {
                procedureCode.DefaultClaimNote = "";
            }
            OdSqlParameter paramDefaultClaimNote = new OdSqlParameter("paramDefaultClaimNote", OdDbType.Text, POut.StringParam(procedureCode.DefaultClaimNote));

            if (procedureCode.DefaultTPNote == null)
            {
                procedureCode.DefaultTPNote = "";
            }
            OdSqlParameter paramDefaultTPNote = new OdSqlParameter("paramDefaultTPNote", OdDbType.Text, POut.StringParam(procedureCode.DefaultTPNote));

            command = "UPDATE procedurecode SET " + command
                      + " WHERE CodeNum = " + POut.Long(procedureCode.CodeNum);
            Db.NonQ(command, paramDefaultNote, paramDefaultClaimNote, paramDefaultTPNote);
            return(true);
        }
        ///<summary>Updates one SupplyOrder 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(SupplyOrder supplyOrder, SupplyOrder oldSupplyOrder)
        {
            string command = "";

            if (supplyOrder.SupplierNum != oldSupplyOrder.SupplierNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SupplierNum = " + POut.Long(supplyOrder.SupplierNum) + "";
            }
            if (supplyOrder.DatePlaced.Date != oldSupplyOrder.DatePlaced.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DatePlaced = " + POut.Date(supplyOrder.DatePlaced) + "";
            }
            if (supplyOrder.Note != oldSupplyOrder.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (supplyOrder.AmountTotal != oldSupplyOrder.AmountTotal)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AmountTotal = '" + POut.Double(supplyOrder.AmountTotal) + "'";
            }
            if (supplyOrder.UserNum != oldSupplyOrder.UserNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UserNum = " + POut.Long(supplyOrder.UserNum) + "";
            }
            if (supplyOrder.ShippingCharge != oldSupplyOrder.ShippingCharge)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ShippingCharge = '" + POut.Double(supplyOrder.ShippingCharge) + "'";
            }
            if (supplyOrder.DateReceived.Date != oldSupplyOrder.DateReceived.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateReceived = " + POut.Date(supplyOrder.DateReceived) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (supplyOrder.Note == null)
            {
                supplyOrder.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(supplyOrder.Note));

            command = "UPDATE supplyorder SET " + command
                      + " WHERE SupplyOrderNum = " + POut.Long(supplyOrder.SupplyOrderNum);
            Db.NonQ(command, paramNote);
            return(true);
        }
Example #16
0
        ///<summary>Updates one PayPlan in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
        internal static void Update(PayPlan payPlan, PayPlan oldPayPlan)
        {
            string command = "";

            if (payPlan.PatNum != oldPayPlan.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(payPlan.PatNum) + "";
            }
            if (payPlan.Guarantor != oldPayPlan.Guarantor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Guarantor = " + POut.Long(payPlan.Guarantor) + "";
            }
            if (payPlan.PayPlanDate != oldPayPlan.PayPlanDate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayPlanDate = " + POut.Date(payPlan.PayPlanDate) + "";
            }
            if (payPlan.APR != oldPayPlan.APR)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "APR = '" + POut.Double(payPlan.APR) + "'";
            }
            if (payPlan.Note != oldPayPlan.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = '" + POut.String(payPlan.Note) + "'";
            }
            if (payPlan.PlanNum != oldPayPlan.PlanNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PlanNum = " + POut.Long(payPlan.PlanNum) + "";
            }
            if (payPlan.CompletedAmt != oldPayPlan.CompletedAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CompletedAmt = '" + POut.Double(payPlan.CompletedAmt) + "'";
            }
            if (payPlan.InsSubNum != oldPayPlan.InsSubNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "InsSubNum = " + POut.Long(payPlan.InsSubNum) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE payplan SET " + command
                      + " WHERE PayPlanNum = " + POut.Long(payPlan.PayPlanNum);
            Db.NonQ(command);
        }
Example #17
0
 ///<summary>Inserts many TsiTransLogs into the database.  Provides option to use the existing priKey.</summary>
 public static void InsertMany(List <TsiTransLog> listTsiTransLogs)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle || PrefC.RandomKeys)
     {
         foreach (TsiTransLog tsiTransLog in listTsiTransLogs)
         {
             Insert(tsiTransLog);
         }
     }
     else
     {
         StringBuilder sbCommands = null;
         int           index      = 0;
         while (index < listTsiTransLogs.Count)
         {
             TsiTransLog   tsiTransLog = listTsiTransLogs[index];
             StringBuilder sbRow       = new StringBuilder("(");
             bool          hasComma    = false;
             if (sbCommands == null)
             {
                 sbCommands = new StringBuilder();
                 sbCommands.Append("INSERT INTO tsitranslog (");
                 sbCommands.Append("PatNum,UserNum,TransType,TransDateTime,DemandType,ServiceCode,ClientId,TransAmt,AccountBalance,FKeyType,FKey,RawMsgText,TransJson) VALUES ");
             }
             else
             {
                 hasComma = true;
             }
             sbRow.Append(POut.Long(tsiTransLog.PatNum)); sbRow.Append(",");
             sbRow.Append(POut.Long(tsiTransLog.UserNum)); sbRow.Append(",");
             sbRow.Append(POut.Int((int)tsiTransLog.TransType)); sbRow.Append(",");
             sbRow.Append(DbHelper.Now()); sbRow.Append(",");
             sbRow.Append(POut.Int((int)tsiTransLog.DemandType)); sbRow.Append(",");
             sbRow.Append(POut.Int((int)tsiTransLog.ServiceCode)); sbRow.Append(",");
             sbRow.Append("'" + POut.String(tsiTransLog.ClientId) + "'"); sbRow.Append(",");
             sbRow.Append("'" + POut.Double(tsiTransLog.TransAmt) + "'"); sbRow.Append(",");
             sbRow.Append("'" + POut.Double(tsiTransLog.AccountBalance) + "'"); sbRow.Append(",");
             sbRow.Append(POut.Int((int)tsiTransLog.FKeyType)); sbRow.Append(",");
             sbRow.Append(POut.Long(tsiTransLog.FKey)); sbRow.Append(",");
             sbRow.Append("'" + POut.String(tsiTransLog.RawMsgText) + "'"); sbRow.Append(",");
             sbRow.Append("'" + POut.String(tsiTransLog.TransJson) + "'"); sbRow.Append(")");
             if (sbCommands.Length + sbRow.Length + 1 > TableBase.MaxAllowedPacketCount)
             {
                 Db.NonQ(sbCommands.ToString());
                 sbCommands = null;
             }
             else
             {
                 if (hasComma)
                 {
                     sbCommands.Append(",");
                 }
                 sbCommands.Append(sbRow.ToString());
                 if (index == listTsiTransLogs.Count - 1)
                 {
                     Db.NonQ(sbCommands.ToString());
                 }
                 index++;
             }
         }
     }
 }
Example #18
0
        ///<summary>Converts a list of Provider into a DataTable.</summary>
        public static DataTable ListToTable(List <Provider> listProviders, string tableName = "")
        {
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = "Provider";
            }
            DataTable table = new DataTable(tableName);

            table.Columns.Add("ProvNum");
            table.Columns.Add("Abbr");
            table.Columns.Add("ItemOrder");
            table.Columns.Add("LName");
            table.Columns.Add("FName");
            table.Columns.Add("MI");
            table.Columns.Add("Suffix");
            table.Columns.Add("FeeSched");
            table.Columns.Add("Specialty");
            table.Columns.Add("SSN");
            table.Columns.Add("StateLicense");
            table.Columns.Add("DEANum");
            table.Columns.Add("IsSecondary");
            table.Columns.Add("ProvColor");
            table.Columns.Add("IsHidden");
            table.Columns.Add("UsingTIN");
            table.Columns.Add("BlueCrossID");
            table.Columns.Add("SigOnFile");
            table.Columns.Add("MedicaidID");
            table.Columns.Add("OutlineColor");
            table.Columns.Add("SchoolClassNum");
            table.Columns.Add("NationalProvID");
            table.Columns.Add("CanadianOfficeNum");
            table.Columns.Add("DateTStamp");
            table.Columns.Add("AnesthProvType");
            table.Columns.Add("TaxonomyCodeOverride");
            table.Columns.Add("IsCDAnet");
            table.Columns.Add("EcwID");
            table.Columns.Add("StateRxID");
            table.Columns.Add("IsNotPerson");
            table.Columns.Add("StateWhereLicensed");
            table.Columns.Add("EmailAddressNum");
            table.Columns.Add("IsInstructor");
            table.Columns.Add("EhrMuStage");
            table.Columns.Add("ProvNumBillingOverride");
            table.Columns.Add("CustomID");
            table.Columns.Add("ProvStatus");
            table.Columns.Add("IsHiddenReport");
            table.Columns.Add("IsErxEnabled");
            table.Columns.Add("SchedNote");
            table.Columns.Add("Birthdate");
            table.Columns.Add("WebSchedDescript");
            table.Columns.Add("WebSchedImageLocation");
            table.Columns.Add("HourlyProdGoalAmt");
            table.Columns.Add("DateTerm");
            foreach (Provider provider in listProviders)
            {
                table.Rows.Add(new object[] {
                    POut.Long(provider.ProvNum),
                    provider.Abbr,
                    POut.Int(provider.ItemOrder),
                    provider.LName,
                    provider.FName,
                    provider.MI,
                    provider.Suffix,
                    POut.Long(provider.FeeSched),
                    POut.Long(provider.Specialty),
                    provider.SSN,
                    provider.StateLicense,
                    provider.DEANum,
                    POut.Bool(provider.IsSecondary),
                    POut.Int(provider.ProvColor.ToArgb()),
                    POut.Bool(provider.IsHidden),
                    POut.Bool(provider.UsingTIN),
                    provider.BlueCrossID,
                    POut.Bool(provider.SigOnFile),
                    provider.MedicaidID,
                    POut.Int(provider.OutlineColor.ToArgb()),
                    POut.Long(provider.SchoolClassNum),
                    provider.NationalProvID,
                    provider.CanadianOfficeNum,
                    POut.DateT(provider.DateTStamp, false),
                    POut.Long(provider.AnesthProvType),
                    provider.TaxonomyCodeOverride,
                    POut.Bool(provider.IsCDAnet),
                    provider.EcwID,
                    provider.StateRxID,
                    POut.Bool(provider.IsNotPerson),
                    provider.StateWhereLicensed,
                    POut.Long(provider.EmailAddressNum),
                    POut.Bool(provider.IsInstructor),
                    POut.Int(provider.EhrMuStage),
                    POut.Long(provider.ProvNumBillingOverride),
                    provider.CustomID,
                    POut.Int((int)provider.ProvStatus),
                    POut.Bool(provider.IsHiddenReport),
                    POut.Int((int)provider.IsErxEnabled),
                    provider.SchedNote,
                    POut.DateT(provider.Birthdate, false),
                    provider.WebSchedDescript,
                    provider.WebSchedImageLocation,
                    POut.Double(provider.HourlyProdGoalAmt),
                    POut.DateT(provider.DateTerm, false),
                });
            }
            return(table);
        }
Example #19
0
        /// <summary></summary>
        public static string RunAll()
        {
            string retVal = "";
            //Things that we might later add to this series of tests:
            //Special column types such as timestamp
            //Computer set to other region, affecting string parsing of types such dates and decimals
            //Test types without casting back and forth to strings.
            //Retrieval using a variety of techniques, such as getting a table, scalar, and reading a row.
            //Blobs
            string    command = "";
            DataTable table;
            TimeSpan  timespan;
            TimeSpan  timespan2;
            string    varchar1;
            string    varchar2;

            //timespan(timeOfDay)----------------------------------------------------------------------------------------------
            timespan = new TimeSpan(1, 2, 3);        //1hr,2min,3sec
            command  = "INSERT INTO tempcore (TimeOfDayTest) VALUES (" + POut.Time(timespan) + ")";
            DataCore.NonQ(command);
            command   = "SELECT TimeOfDayTest FROM tempcore";
            table     = DataCore.GetTable(command);
            timespan2 = PIn.Time(table.Rows[0]["TimeOfDayTest"].ToString());
            if (timespan != timespan2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "TimeSpan (time of day): Passed.\r\n";
            //timespan, negative------------------------------------------------------------------------------------
            timespan = new TimeSpan(0, -36, 0);        //This particular timespan value was found to fail in mysql with the old connector.
            //Don't know what's so special about this one value.  There are probably other values failing as well, but it doesn't matter.
            //Oracle does not seem to like negative values.
            command = "INSERT INTO tempcore (TimeSpanTest) VALUES ('" + POut.TSpan(timespan) + "')";
            DataCore.NonQ(command);
            command = "SELECT TimeSpanTest FROM tempcore";
            table   = DataCore.GetTable(command);
            string tempVal = table.Rows[0]["TimeSpanTest"].ToString();

            timespan2 = PIn.TSpan(tempVal);
            if (timespan != timespan2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "TimeSpan, negative: Passed.\r\n";
            //timespan, over 24 hours-----------------------------------------------------------------------------
            timespan = new TimeSpan(432, 5, 17);
            command  = "INSERT INTO tempcore (TimeSpanTest) VALUES ('" + POut.TSpan(timespan) + "')";
            DataCore.NonQ(command);
            command   = "SELECT TimeSpanTest FROM tempcore";
            table     = DataCore.GetTable(command);
            timespan2 = PIn.TSpan(table.Rows[0]["TimeSpanTest"].ToString());
            if (timespan != timespan2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "TimeSpan, large: Passed.\r\n";
            //date----------------------------------------------------------------------------------------------
            DateTime date1;
            DateTime date2;

            date1   = new DateTime(2003, 5, 23);
            command = "INSERT INTO tempcore (DateTest) VALUES (" + POut.Date(date1) + ")";
            DataCore.NonQ(command);
            command = "SELECT DateTest FROM tempcore";
            table   = DataCore.GetTable(command);
            date2   = PIn.Date(table.Rows[0]["DateTest"].ToString());
            if (date1 != date2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Date: Passed.\r\n";
            //datetime------------------------------------------------------------------------------------------
            DateTime datet1;
            DateTime datet2;

            datet1  = new DateTime(2003, 5, 23, 10, 18, 0);
            command = "INSERT INTO tempcore (DateTimeTest) VALUES (" + POut.DateT(datet1) + ")";
            DataCore.NonQ(command);
            command = "SELECT DateTimeTest FROM tempcore";
            table   = DataCore.GetTable(command);
            datet2  = PIn.DateT(table.Rows[0]["DateTimeTest"].ToString());
            if (datet1 != datet2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Date/Time: Passed.\r\n";
            //currency------------------------------------------------------------------------------------------
            double double1;
            double double2;

            double1 = 12.34d;
            command = "INSERT INTO tempcore (CurrencyTest) VALUES (" + POut.Double(double1) + ")";
            DataCore.NonQ(command);
            command = "SELECT CurrencyTest FROM tempcore";
            table   = DataCore.GetTable(command);
            double2 = PIn.Double(table.Rows[0]["CurrencyTest"].ToString());
            if (double1 != double2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Currency: Passed.\r\n";
            //group_concat------------------------------------------------------------------------------------
            command = "INSERT INTO tempgroupconcat VALUES ('name1')";
            DataCore.NonQ(command);
            command = "INSERT INTO tempgroupconcat VALUES ('name2')";
            DataCore.NonQ(command);
            command = "SELECT " + DbHelper.GroupConcat("Names") + " allnames FROM tempgroupconcat";
            table   = DataCore.GetTable(command);
            string allnames = PIn.ByteArray(table.Rows[0]["allnames"].ToString());

            //if(DataConnection.DBtype==DatabaseType.Oracle) {
            //	allnames=allnames.TrimEnd(',');//known issue.  Should already be fixed:
            //Use RTRIM(REPLACE(REPLACE(XMLAgg(XMLElement("x",column_name)),'<x>'),'</x>',','))
            //}
            if (allnames != "name1,name2")
            {
                throw new Exception();
            }
            command = "DELETE FROM tempgroupconcat";
            DataCore.NonQ(command);
            retVal += "Group_concat: Passed.\r\n";
            //bool,pos------------------------------------------------------------------------------------
            bool bool1;
            bool bool2;

            bool1   = true;
            command = "INSERT INTO tempcore (BoolTest) VALUES (" + POut.Bool(bool1) + ")";
            DataCore.NonQ(command);
            command = "SELECT BoolTest FROM tempcore";
            table   = DataCore.GetTable(command);
            bool2   = PIn.Bool(table.Rows[0]["BoolTest"].ToString());
            if (bool1 != bool2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Bool, true: Passed.\r\n";
            //bool,neg------------------------------------------------------------------------------------
            bool1   = false;
            command = "INSERT INTO tempcore (BoolTest) VALUES (" + POut.Bool(bool1) + ")";
            DataCore.NonQ(command);
            command = "SELECT BoolTest FROM tempcore";
            table   = DataCore.GetTable(command);
            bool2   = PIn.Bool(table.Rows[0]["BoolTest"].ToString());
            if (bool1 != bool2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Bool, false: Passed.\r\n";
            //varchar255 Nonstandard Characters-----------------------------------------------------------
            varchar1 = @"'!@#$%^&*()-+[{]}\`~,<.>/?'"";:=_" + "\r\n\t";
            varchar2 = "";
            command  = "INSERT INTO tempcore (TextTinyTest) VALUES ('" + POut.String(varchar1) + "')";
            DataCore.NonQ(command);
            command  = "SELECT TextTinyTest FROM tempcore";
            table    = DataCore.GetTable(command);
            varchar2 = PIn.String(table.Rows[0]["TextTinyTest"].ToString());
            if (varchar1 != varchar2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "VarChar(255): Passed.\r\n";
            //VARCHAR2(4000)------------------------------------------------------------------------------
            varchar1 = CreateRandomAlphaNumericString(4000);           //Tested 4001 and it was too large as expected.
            command  = "INSERT INTO tempcore (TextSmallTest) VALUES ('" + POut.String(varchar1) + "')";
            DataCore.NonQ(command);
            command  = "SELECT TextSmallTest FROM tempcore";
            table    = DataCore.GetTable(command);
            varchar2 = PIn.String(table.Rows[0]["TextSmallTest"].ToString());
            if (varchar1 != varchar2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "VarChar2(4000): Passed.\r\n";
            //clob:-----------------------------------------------------------------------------------------
            //tested up to 20MB in oracle.  (50MB however was failing: Chunk size error)
            //mysql mediumtext maxes out at about 16MB.
            string         clobstring1 = CreateRandomAlphaNumericString(10485760);   //10MB should be larger than anything we store.
            string         clobstring2 = "";
            OdSqlParameter param       = new OdSqlParameter("param1", OdDbType.Text, clobstring1);

            command = "INSERT INTO tempcore (TextLargeTest) VALUES (" + DbHelper.ParamChar + "param1)";
            DataCore.NonQ(command, param);
            command     = "SELECT TextLargeTest FROM tempcore";
            table       = DataCore.GetTable(command);
            clobstring2 = PIn.String(table.Rows[0]["TextLargeTest"].ToString());
            if (clobstring1 != clobstring2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Clob, Alpha-Numeric 10MB: Passed.\r\n";
            //clob:non-standard----------------------------------------------------------------------------------
            clobstring1 = CreateRandomNonStandardString(8000000);           //8MB is the max because many chars takes 2 bytes, and mysql maxes out at 16MB
            clobstring2 = "";
            param       = new OdSqlParameter("param1", OdDbType.Text, clobstring1);
            command     = "INSERT INTO tempcore (TextLargeTest) VALUES (" + DbHelper.ParamChar + "param1)";
            DataCore.NonQ(command, param);
            command     = "SELECT TextLargeTest FROM tempcore";
            table       = DataCore.GetTable(command);
            clobstring2 = PIn.String(table.Rows[0]["TextLargeTest"].ToString());
            if (clobstring1 != clobstring2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Clob, Symbols and Chinese: Passed.\r\n";
            //clob:Rick Roller----------------------------------------------------------------------------------
            clobstring1 = RickRoller(10485760);           //10MB should be larger than anything we store.
            clobstring2 = "";
            param       = new OdSqlParameter("param1", OdDbType.Text, clobstring1);
            command     = "INSERT INTO tempcore (TextLargeTest) VALUES (" + DbHelper.ParamChar + "param1)";
            DataCore.NonQ(command, param);
            command     = "SELECT TextLargeTest FROM tempcore";
            table       = DataCore.GetTable(command);
            clobstring2 = PIn.String(table.Rows[0]["TextLargeTest"].ToString());
            if (clobstring1 != clobstring2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Clob, Rick Roller: Passed.\r\n";
            //SHOW CREATE TABLE -----------------------------------------------------------------------
            //This command is needed in order to perform a backup.
            if (DataConnection.DBtype == DatabaseType.MySql)
            {
                command = "SHOW CREATE TABLE account";
                table   = DataCore.GetTable(command);
                string createResult = PIn.ByteArray(table.Rows[0][1]);
                if (!createResult.StartsWith("CREATE TABLE"))
                {
                    throw new Exception();
                }
                retVal += "SHOW CREATE TABLE: Passed.\r\n";
            }
            else
            {
                retVal += "SHOW CREATE TABLE: Not applicable to Oracle.\r\n";
            }
            //Single Command Split-------------------------------------------------------------------------
            varchar1 = "';\"";
            varchar2 = ";'';;;;\"\"\"\"'asdfsadsdaf'";
            command  = "INSERT INTO tempcore (TextTinyTest,TextSmallTest) VALUES ('" + POut.String(varchar1) + "','" + POut.String(varchar2) + "');";
            DataCore.NonQ(command);            //Test the split function.
            command = "SELECT TextTinyTest,TextSmallTest FROM tempcore";
            table   = DataCore.GetTable(command);
            if (PIn.String(table.Rows[0]["TextTinyTest"].ToString()) != varchar1 || PIn.String(table.Rows[0]["TextSmallTest"].ToString()) != varchar2)
            {
                throw new ApplicationException();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Single Command Split: Passed.";
            //Run multiple non-queries in one transaction--------------------------------------------------
            varchar1 = "A";
            varchar2 = "B";
            command  = "INSERT INTO tempcore (TextTinyTest) VALUES ('" + POut.String(varchar1) + "'); DELETE FROM tempcore; INSERT INTO tempcore (TextTinyTest) VALUES ('" + POut.String(varchar2) + "')";
            DataCore.NonQ(command);
            command = "SELECT TextTinyTest FROM tempcore";
            table   = DataCore.GetTable(command);
            if (PIn.String(table.Rows[0][0].ToString()) != varchar2)
            {
                throw new ApplicationException();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Multi-Non-Queries: Passed.\r\n";
            //Cleanup---------------------------------------------------------------------------------------
            if (DataConnection.DBtype == DatabaseType.MySql)
            {
                command = "DROP TABLE IF EXISTS tempcore";
                DataCore.NonQ(command);
                command = "DROP TABLE IF EXISTS tempgroupconcat";
                DataCore.NonQ(command);
            }
            else
            {
                command = "BEGIN EXECUTE IMMEDIATE 'DROP TABLE tempcore'; EXCEPTION WHEN OTHERS THEN NULL; END;";
                DataCore.NonQ(command);
                command = "BEGIN EXECUTE IMMEDIATE 'DROP TABLE tempgroupconcat'; EXCEPTION WHEN OTHERS THEN NULL; END;";
                DataCore.NonQ(command);
            }
            retVal += "CoreTypes test done.\r\n";
            return(retVal);
        }
Example #20
0
        ///<summary>Inserts one Provider into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Provider provider, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO provider (";

            if (!useExistingPK && isRandomKeys)
            {
                provider.ProvNum = ReplicationServers.GetKeyNoCache("provider", "ProvNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ProvNum,";
            }
            command += "Abbr,ItemOrder,LName,FName,MI,Suffix,FeeSched,Specialty,SSN,StateLicense,DEANum,IsSecondary,ProvColor,IsHidden,UsingTIN,BlueCrossID,SigOnFile,MedicaidID,OutlineColor,SchoolClassNum,NationalProvID,CanadianOfficeNum,AnesthProvType,TaxonomyCodeOverride,IsCDAnet,EcwID,StateRxID,IsNotPerson,StateWhereLicensed,EmailAddressNum,IsInstructor,EhrMuStage,ProvNumBillingOverride,CustomID,ProvStatus,IsHiddenReport,IsErxEnabled,SchedNote,Birthdate,WebSchedDescript,WebSchedImageLocation,HourlyProdGoalAmt,DateTerm) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(provider.ProvNum) + ",";
            }
            command +=
                "'" + POut.String(provider.Abbr) + "',"
                + POut.Int(provider.ItemOrder) + ","
                + "'" + POut.String(provider.LName) + "',"
                + "'" + POut.String(provider.FName) + "',"
                + "'" + POut.String(provider.MI) + "',"
                + "'" + POut.String(provider.Suffix) + "',"
                + POut.Long(provider.FeeSched) + ","
                + POut.Long(provider.Specialty) + ","
                + "'" + POut.String(provider.SSN) + "',"
                + "'" + POut.String(provider.StateLicense) + "',"
                + "'" + POut.String(provider.DEANum) + "',"
                + POut.Bool(provider.IsSecondary) + ","
                + POut.Int(provider.ProvColor.ToArgb()) + ","
                + POut.Bool(provider.IsHidden) + ","
                + POut.Bool(provider.UsingTIN) + ","
                + "'" + POut.String(provider.BlueCrossID) + "',"
                + POut.Bool(provider.SigOnFile) + ","
                + "'" + POut.String(provider.MedicaidID) + "',"
                + POut.Int(provider.OutlineColor.ToArgb()) + ","
                + POut.Long(provider.SchoolClassNum) + ","
                + "'" + POut.String(provider.NationalProvID) + "',"
                + "'" + POut.String(provider.CanadianOfficeNum) + "',"
                //DateTStamp can only be set by MySQL
                + POut.Long(provider.AnesthProvType) + ","
                + "'" + POut.String(provider.TaxonomyCodeOverride) + "',"
                + POut.Bool(provider.IsCDAnet) + ","
                + "'" + POut.String(provider.EcwID) + "',"
                + "'" + POut.String(provider.StateRxID) + "',"
                + POut.Bool(provider.IsNotPerson) + ","
                + "'" + POut.String(provider.StateWhereLicensed) + "',"
                + POut.Long(provider.EmailAddressNum) + ","
                + POut.Bool(provider.IsInstructor) + ","
                + POut.Int(provider.EhrMuStage) + ","
                + POut.Long(provider.ProvNumBillingOverride) + ","
                + "'" + POut.String(provider.CustomID) + "',"
                + POut.Int((int)provider.ProvStatus) + ","
                + POut.Bool(provider.IsHiddenReport) + ","
                + POut.Int((int)provider.IsErxEnabled) + ","
                + "'" + POut.String(provider.SchedNote) + "',"
                + POut.Date(provider.Birthdate) + ","
                + DbHelper.ParamChar + "paramWebSchedDescript,"
                + "'" + POut.String(provider.WebSchedImageLocation) + "',"
                + "'" + POut.Double(provider.HourlyProdGoalAmt) + "',"
                + POut.Date(provider.DateTerm) + ")";
            if (provider.WebSchedDescript == null)
            {
                provider.WebSchedDescript = "";
            }
            OdSqlParameter paramWebSchedDescript = new OdSqlParameter("paramWebSchedDescript", OdDbType.Text, POut.StringParam(provider.WebSchedDescript));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramWebSchedDescript);
            }
            else
            {
                provider.ProvNum = Db.NonQ(command, true, "ProvNum", "provider", paramWebSchedDescript);
            }
            return(provider.ProvNum);
        }
Example #21
0
        ///<summary>Updates one PayPlanCharge 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(PayPlanCharge payPlanCharge, PayPlanCharge oldPayPlanCharge)
        {
            string command = "";

            if (payPlanCharge.PayPlanNum != oldPayPlanCharge.PayPlanNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayPlanNum = " + POut.Long(payPlanCharge.PayPlanNum) + "";
            }
            if (payPlanCharge.Guarantor != oldPayPlanCharge.Guarantor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Guarantor = " + POut.Long(payPlanCharge.Guarantor) + "";
            }
            if (payPlanCharge.PatNum != oldPayPlanCharge.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(payPlanCharge.PatNum) + "";
            }
            if (payPlanCharge.ChargeDate.Date != oldPayPlanCharge.ChargeDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ChargeDate = " + POut.Date(payPlanCharge.ChargeDate) + "";
            }
            if (payPlanCharge.Principal != oldPayPlanCharge.Principal)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Principal = '" + POut.Double(payPlanCharge.Principal) + "'";
            }
            if (payPlanCharge.Interest != oldPayPlanCharge.Interest)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Interest = '" + POut.Double(payPlanCharge.Interest) + "'";
            }
            if (payPlanCharge.Note != oldPayPlanCharge.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (payPlanCharge.ProvNum != oldPayPlanCharge.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(payPlanCharge.ProvNum) + "";
            }
            if (payPlanCharge.ClinicNum != oldPayPlanCharge.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(payPlanCharge.ClinicNum) + "";
            }
            if (payPlanCharge.ChargeType != oldPayPlanCharge.ChargeType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ChargeType = " + POut.Int((int)payPlanCharge.ChargeType) + "";
            }
            if (payPlanCharge.ProcNum != oldPayPlanCharge.ProcNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNum = " + POut.Long(payPlanCharge.ProcNum) + "";
            }
            //SecDateTEntry not allowed to change
            //SecDateTEdit can only be set by MySQL
            if (payPlanCharge.StatementNum != oldPayPlanCharge.StatementNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StatementNum = " + POut.Long(payPlanCharge.StatementNum) + "";
            }
            if (payPlanCharge.FKey != oldPayPlanCharge.FKey)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FKey = " + POut.Long(payPlanCharge.FKey) + "";
            }
            if (payPlanCharge.LinkType != oldPayPlanCharge.LinkType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LinkType = " + POut.Int((int)payPlanCharge.LinkType) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (payPlanCharge.Note == null)
            {
                payPlanCharge.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(payPlanCharge.Note));

            command = "UPDATE payplancharge SET " + command
                      + " WHERE PayPlanChargeNum = " + POut.Long(payPlanCharge.PayPlanChargeNum);
            Db.NonQ(command, paramNote);
            return(true);
        }
Example #22
0
        ///<summary>Updates one Provider in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(Provider provider, Provider oldProvider)
        {
            string command = "";

            if (provider.Abbr != oldProvider.Abbr)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Abbr = '" + POut.String(provider.Abbr) + "'";
            }
            if (provider.ItemOrder != oldProvider.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(provider.ItemOrder) + "";
            }
            if (provider.LName != oldProvider.LName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LName = '" + POut.String(provider.LName) + "'";
            }
            if (provider.FName != oldProvider.FName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FName = '" + POut.String(provider.FName) + "'";
            }
            if (provider.MI != oldProvider.MI)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MI = '" + POut.String(provider.MI) + "'";
            }
            if (provider.Suffix != oldProvider.Suffix)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Suffix = '" + POut.String(provider.Suffix) + "'";
            }
            if (provider.FeeSched != oldProvider.FeeSched)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeSched = " + POut.Long(provider.FeeSched) + "";
            }
            if (provider.Specialty != oldProvider.Specialty)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Specialty = " + POut.Long(provider.Specialty) + "";
            }
            if (provider.SSN != oldProvider.SSN)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SSN = '" + POut.String(provider.SSN) + "'";
            }
            if (provider.StateLicense != oldProvider.StateLicense)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StateLicense = '" + POut.String(provider.StateLicense) + "'";
            }
            if (provider.DEANum != oldProvider.DEANum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DEANum = '" + POut.String(provider.DEANum) + "'";
            }
            if (provider.IsSecondary != oldProvider.IsSecondary)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsSecondary = " + POut.Bool(provider.IsSecondary) + "";
            }
            if (provider.ProvColor != oldProvider.ProvColor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvColor = " + POut.Int(provider.ProvColor.ToArgb()) + "";
            }
            if (provider.IsHidden != oldProvider.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(provider.IsHidden) + "";
            }
            if (provider.UsingTIN != oldProvider.UsingTIN)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UsingTIN = " + POut.Bool(provider.UsingTIN) + "";
            }
            if (provider.BlueCrossID != oldProvider.BlueCrossID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BlueCrossID = '" + POut.String(provider.BlueCrossID) + "'";
            }
            if (provider.SigOnFile != oldProvider.SigOnFile)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SigOnFile = " + POut.Bool(provider.SigOnFile) + "";
            }
            if (provider.MedicaidID != oldProvider.MedicaidID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicaidID = '" + POut.String(provider.MedicaidID) + "'";
            }
            if (provider.OutlineColor != oldProvider.OutlineColor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OutlineColor = " + POut.Int(provider.OutlineColor.ToArgb()) + "";
            }
            if (provider.SchoolClassNum != oldProvider.SchoolClassNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchoolClassNum = " + POut.Long(provider.SchoolClassNum) + "";
            }
            if (provider.NationalProvID != oldProvider.NationalProvID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "NationalProvID = '" + POut.String(provider.NationalProvID) + "'";
            }
            if (provider.CanadianOfficeNum != oldProvider.CanadianOfficeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CanadianOfficeNum = '" + POut.String(provider.CanadianOfficeNum) + "'";
            }
            //DateTStamp can only be set by MySQL
            if (provider.AnesthProvType != oldProvider.AnesthProvType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AnesthProvType = " + POut.Long(provider.AnesthProvType) + "";
            }
            if (provider.TaxonomyCodeOverride != oldProvider.TaxonomyCodeOverride)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TaxonomyCodeOverride = '" + POut.String(provider.TaxonomyCodeOverride) + "'";
            }
            if (provider.IsCDAnet != oldProvider.IsCDAnet)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsCDAnet = " + POut.Bool(provider.IsCDAnet) + "";
            }
            if (provider.EcwID != oldProvider.EcwID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EcwID = '" + POut.String(provider.EcwID) + "'";
            }
            if (provider.StateRxID != oldProvider.StateRxID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StateRxID = '" + POut.String(provider.StateRxID) + "'";
            }
            if (provider.IsNotPerson != oldProvider.IsNotPerson)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsNotPerson = " + POut.Bool(provider.IsNotPerson) + "";
            }
            if (provider.StateWhereLicensed != oldProvider.StateWhereLicensed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StateWhereLicensed = '" + POut.String(provider.StateWhereLicensed) + "'";
            }
            if (provider.EmailAddressNum != oldProvider.EmailAddressNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmailAddressNum = " + POut.Long(provider.EmailAddressNum) + "";
            }
            if (provider.IsInstructor != oldProvider.IsInstructor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsInstructor = " + POut.Bool(provider.IsInstructor) + "";
            }
            if (provider.EhrMuStage != oldProvider.EhrMuStage)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EhrMuStage = " + POut.Int(provider.EhrMuStage) + "";
            }
            if (provider.ProvNumBillingOverride != oldProvider.ProvNumBillingOverride)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNumBillingOverride = " + POut.Long(provider.ProvNumBillingOverride) + "";
            }
            if (provider.CustomID != oldProvider.CustomID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CustomID = '" + POut.String(provider.CustomID) + "'";
            }
            if (provider.ProvStatus != oldProvider.ProvStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvStatus = " + POut.Int((int)provider.ProvStatus) + "";
            }
            if (provider.IsHiddenReport != oldProvider.IsHiddenReport)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHiddenReport = " + POut.Bool(provider.IsHiddenReport) + "";
            }
            if (provider.IsErxEnabled != oldProvider.IsErxEnabled)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsErxEnabled = " + POut.Int((int)provider.IsErxEnabled) + "";
            }
            if (provider.SchedNote != oldProvider.SchedNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchedNote = '" + POut.String(provider.SchedNote) + "'";
            }
            if (provider.Birthdate.Date != oldProvider.Birthdate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Birthdate = " + POut.Date(provider.Birthdate) + "";
            }
            if (provider.WebSchedDescript != oldProvider.WebSchedDescript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "WebSchedDescript = " + DbHelper.ParamChar + "paramWebSchedDescript";
            }
            if (provider.WebSchedImageLocation != oldProvider.WebSchedImageLocation)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "WebSchedImageLocation = '" + POut.String(provider.WebSchedImageLocation) + "'";
            }
            if (provider.HourlyProdGoalAmt != oldProvider.HourlyProdGoalAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HourlyProdGoalAmt = '" + POut.Double(provider.HourlyProdGoalAmt) + "'";
            }
            if (provider.DateTerm.Date != oldProvider.DateTerm.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTerm = " + POut.Date(provider.DateTerm) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (provider.WebSchedDescript == null)
            {
                provider.WebSchedDescript = "";
            }
            OdSqlParameter paramWebSchedDescript = new OdSqlParameter("paramWebSchedDescript", OdDbType.Text, POut.StringParam(provider.WebSchedDescript));

            command = "UPDATE provider SET " + command
                      + " WHERE ProvNum = " + POut.Long(provider.ProvNum);
            Db.NonQ(command, paramWebSchedDescript);
            return(true);
        }
Example #23
0
        ///<summary>Updates one RxPat 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(RxPat rxPat, RxPat oldRxPat)
        {
            string command = "";

            if (rxPat.PatNum != oldRxPat.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(rxPat.PatNum) + "";
            }
            if (rxPat.RxDate.Date != oldRxPat.RxDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RxDate = " + POut.Date(rxPat.RxDate) + "";
            }
            if (rxPat.Drug != oldRxPat.Drug)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Drug = '" + POut.String(rxPat.Drug) + "'";
            }
            if (rxPat.Sig != oldRxPat.Sig)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Sig = '" + POut.String(rxPat.Sig) + "'";
            }
            if (rxPat.Disp != oldRxPat.Disp)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Disp = '" + POut.String(rxPat.Disp) + "'";
            }
            if (rxPat.Refills != oldRxPat.Refills)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Refills = '" + POut.String(rxPat.Refills) + "'";
            }
            if (rxPat.ProvNum != oldRxPat.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(rxPat.ProvNum) + "";
            }
            if (rxPat.Notes != oldRxPat.Notes)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Notes = '" + POut.String(rxPat.Notes) + "'";
            }
            if (rxPat.PharmacyNum != oldRxPat.PharmacyNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PharmacyNum = " + POut.Long(rxPat.PharmacyNum) + "";
            }
            if (rxPat.IsControlled != oldRxPat.IsControlled)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsControlled = " + POut.Bool(rxPat.IsControlled) + "";
            }
            //DateTStamp can only be set by MySQL
            if (rxPat.SendStatus != oldRxPat.SendStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SendStatus = " + POut.Int((int)rxPat.SendStatus) + "";
            }
            if (rxPat.RxCui != oldRxPat.RxCui)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RxCui = " + POut.Long(rxPat.RxCui) + "";
            }
            if (rxPat.DosageCode != oldRxPat.DosageCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DosageCode = '" + POut.String(rxPat.DosageCode) + "'";
            }
            if (rxPat.ErxGuid != oldRxPat.ErxGuid)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ErxGuid = '" + POut.String(rxPat.ErxGuid) + "'";
            }
            if (rxPat.IsErxOld != oldRxPat.IsErxOld)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsErxOld = " + POut.Bool(rxPat.IsErxOld) + "";
            }
            if (rxPat.ErxPharmacyInfo != oldRxPat.ErxPharmacyInfo)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ErxPharmacyInfo = '" + POut.String(rxPat.ErxPharmacyInfo) + "'";
            }
            if (rxPat.IsProcRequired != oldRxPat.IsProcRequired)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsProcRequired = " + POut.Bool(rxPat.IsProcRequired) + "";
            }
            if (rxPat.ProcNum != oldRxPat.ProcNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNum = " + POut.Long(rxPat.ProcNum) + "";
            }
            if (rxPat.DaysOfSupply != oldRxPat.DaysOfSupply)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DaysOfSupply = '" + POut.Double(rxPat.DaysOfSupply) + "'";
            }
            if (rxPat.PatientInstruction != oldRxPat.PatientInstruction)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatientInstruction = " + DbHelper.ParamChar + "paramPatientInstruction";
            }
            if (rxPat.ClinicNum != oldRxPat.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(rxPat.ClinicNum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (rxPat.PatientInstruction == null)
            {
                rxPat.PatientInstruction = "";
            }
            OdSqlParameter paramPatientInstruction = new OdSqlParameter("paramPatientInstruction", OdDbType.Text, POut.StringParam(rxPat.PatientInstruction));

            command = "UPDATE rxpat SET " + command
                      + " WHERE RxNum = " + POut.Long(rxPat.RxNum);
            Db.NonQ(command, paramPatientInstruction);
            return(true);
        }
Example #24
0
        ///<summary>Updates one PayPlan 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(PayPlan payPlan, PayPlan oldPayPlan)
        {
            string command = "";

            if (payPlan.PatNum != oldPayPlan.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(payPlan.PatNum) + "";
            }
            if (payPlan.Guarantor != oldPayPlan.Guarantor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Guarantor = " + POut.Long(payPlan.Guarantor) + "";
            }
            if (payPlan.PayPlanDate.Date != oldPayPlan.PayPlanDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayPlanDate = " + POut.Date(payPlan.PayPlanDate) + "";
            }
            if (payPlan.APR != oldPayPlan.APR)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "APR = '" + POut.Double(payPlan.APR) + "'";
            }
            if (payPlan.Note != oldPayPlan.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (payPlan.PlanNum != oldPayPlan.PlanNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PlanNum = " + POut.Long(payPlan.PlanNum) + "";
            }
            if (payPlan.CompletedAmt != oldPayPlan.CompletedAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CompletedAmt = '" + POut.Double(payPlan.CompletedAmt) + "'";
            }
            if (payPlan.InsSubNum != oldPayPlan.InsSubNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "InsSubNum = " + POut.Long(payPlan.InsSubNum) + "";
            }
            if (payPlan.PaySchedule != oldPayPlan.PaySchedule)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PaySchedule = " + POut.Int((int)payPlan.PaySchedule) + "";
            }
            if (payPlan.NumberOfPayments != oldPayPlan.NumberOfPayments)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "NumberOfPayments = " + POut.Int(payPlan.NumberOfPayments) + "";
            }
            if (payPlan.PayAmt != oldPayPlan.PayAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayAmt = '" + POut.Double(payPlan.PayAmt) + "'";
            }
            if (payPlan.DownPayment != oldPayPlan.DownPayment)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DownPayment = '" + POut.Double(payPlan.DownPayment) + "'";
            }
            if (payPlan.IsClosed != oldPayPlan.IsClosed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsClosed = " + POut.Bool(payPlan.IsClosed) + "";
            }
            if (payPlan.Signature != oldPayPlan.Signature)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Signature = " + DbHelper.ParamChar + "paramSignature";
            }
            if (payPlan.SigIsTopaz != oldPayPlan.SigIsTopaz)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SigIsTopaz = " + POut.Bool(payPlan.SigIsTopaz) + "";
            }
            if (payPlan.PlanCategory != oldPayPlan.PlanCategory)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PlanCategory = " + POut.Long(payPlan.PlanCategory) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (payPlan.Note == null)
            {
                payPlan.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(payPlan.Note));

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

            command = "UPDATE payplan SET " + command
                      + " WHERE PayPlanNum = " + POut.Long(payPlan.PayPlanNum);
            Db.NonQ(command, paramNote, paramSignature);
            return(true);
        }
Example #25
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.</summary>
        internal static void Update(Recall recall, Recall oldRecall)
        {
            string command = "";

            if (recall.PatNum != oldRecall.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(recall.PatNum) + "";
            }
            if (recall.DateDueCalc != oldRecall.DateDueCalc)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateDueCalc = " + POut.Date(recall.DateDueCalc) + "";
            }
            if (recall.DateDue != oldRecall.DateDue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateDue = " + POut.Date(recall.DateDue) + "";
            }
            if (recall.DatePrevious != oldRecall.DatePrevious)
            {
                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 = '" + POut.String(recall.Note) + "'";
            }
            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 != oldRecall.DisableUntilDate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DisableUntilDate = " + POut.Date(recall.DisableUntilDate) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE recall SET " + command
                      + " WHERE RecallNum = " + POut.Long(recall.RecallNum);
            Db.NonQ(command);
        }
Example #26
0
        ///<summary>Updates one MapArea 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(MapArea mapArea, MapArea oldMapArea)
        {
            string command = "";

            if (mapArea.Extension != oldMapArea.Extension)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Extension = " + POut.Int(mapArea.Extension) + "";
            }
            if (mapArea.XPos != oldMapArea.XPos)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "XPos = '" + POut.Double(mapArea.XPos) + "'";
            }
            if (mapArea.YPos != oldMapArea.YPos)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "YPos = '" + POut.Double(mapArea.YPos) + "'";
            }
            if (mapArea.Width != oldMapArea.Width)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Width = '" + POut.Double(mapArea.Width) + "'";
            }
            if (mapArea.Height != oldMapArea.Height)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Height = '" + POut.Double(mapArea.Height) + "'";
            }
            if (mapArea.Description != oldMapArea.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(mapArea.Description) + "'";
            }
            if (mapArea.ItemType != oldMapArea.ItemType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemType = " + POut.Int((int)mapArea.ItemType) + "";
            }
            if (mapArea.MapAreaContainerNum != oldMapArea.MapAreaContainerNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MapAreaContainerNum = " + POut.Long(mapArea.MapAreaContainerNum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE maparea SET " + command
                      + " WHERE MapAreaNum = " + POut.Long(mapArea.MapAreaNum);
            Db.NonQ(command);
            return(true);
        }
Example #27
0
        ///<summary>Updates one ProcTP 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(ProcTP procTP, ProcTP oldProcTP)
        {
            string command = "";

            if (procTP.TreatPlanNum != oldProcTP.TreatPlanNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TreatPlanNum = " + POut.Long(procTP.TreatPlanNum) + "";
            }
            if (procTP.PatNum != oldProcTP.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(procTP.PatNum) + "";
            }
            if (procTP.ProcNumOrig != oldProcTP.ProcNumOrig)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNumOrig = " + POut.Long(procTP.ProcNumOrig) + "";
            }
            if (procTP.ItemOrder != oldProcTP.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(procTP.ItemOrder) + "";
            }
            if (procTP.Priority != oldProcTP.Priority)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Priority = " + POut.Long(procTP.Priority) + "";
            }
            if (procTP.ToothNumTP != oldProcTP.ToothNumTP)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ToothNumTP = '" + POut.String(procTP.ToothNumTP) + "'";
            }
            if (procTP.Surf != oldProcTP.Surf)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Surf = '" + POut.String(procTP.Surf) + "'";
            }
            if (procTP.ProcCode != oldProcTP.ProcCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcCode = '" + POut.String(procTP.ProcCode) + "'";
            }
            if (procTP.Descript != oldProcTP.Descript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Descript = '" + POut.String(procTP.Descript) + "'";
            }
            if (procTP.FeeAmt != oldProcTP.FeeAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeAmt = '" + POut.Double(procTP.FeeAmt) + "'";
            }
            if (procTP.PriInsAmt != oldProcTP.PriInsAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PriInsAmt = '" + POut.Double(procTP.PriInsAmt) + "'";
            }
            if (procTP.SecInsAmt != oldProcTP.SecInsAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SecInsAmt = '" + POut.Double(procTP.SecInsAmt) + "'";
            }
            if (procTP.PatAmt != oldProcTP.PatAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatAmt = '" + POut.Double(procTP.PatAmt) + "'";
            }
            if (procTP.Discount != oldProcTP.Discount)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Discount = '" + POut.Double(procTP.Discount) + "'";
            }
            if (procTP.Prognosis != oldProcTP.Prognosis)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Prognosis = '" + POut.String(procTP.Prognosis) + "'";
            }
            if (procTP.Dx != oldProcTP.Dx)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Dx = '" + POut.String(procTP.Dx) + "'";
            }
            if (procTP.ProcAbbr != oldProcTP.ProcAbbr)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcAbbr = '" + POut.String(procTP.ProcAbbr) + "'";
            }
            //SecUserNumEntry excluded from update
            //SecDateEntry not allowed to change
            //SecDateTEdit can only be set by MySQL
            if (procTP.FeeAllowed != oldProcTP.FeeAllowed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeAllowed = '" + POut.Double(procTP.FeeAllowed) + "'";
            }
            if (procTP.TaxAmt != oldProcTP.TaxAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TaxAmt = '" + POut.Double(procTP.TaxAmt) + "'";
            }
            if (procTP.ProvNum != oldProcTP.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(procTP.ProvNum) + "";
            }
            if (procTP.DateTP.Date != oldProcTP.DateTP.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTP = " + POut.Date(procTP.DateTP) + "";
            }
            if (procTP.ClinicNum != oldProcTP.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(procTP.ClinicNum) + "";
            }
            if (procTP.CatPercUCR != oldProcTP.CatPercUCR)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CatPercUCR = '" + POut.Double(procTP.CatPercUCR) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE proctp SET " + command
                      + " WHERE ProcTPNum = " + POut.Long(procTP.ProcTPNum);
            Db.NonQ(command);
            return(true);
        }
Example #28
0
        ///<summary>Updates one XChargeTransaction 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(XChargeTransaction xChargeTransaction, XChargeTransaction oldXChargeTransaction)
        {
            string command = "";

            if (xChargeTransaction.TransType != oldXChargeTransaction.TransType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TransType = '" + POut.String(xChargeTransaction.TransType) + "'";
            }
            if (xChargeTransaction.Amount != oldXChargeTransaction.Amount)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Amount = '" + POut.Double(xChargeTransaction.Amount) + "'";
            }
            if (xChargeTransaction.CCEntry != oldXChargeTransaction.CCEntry)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CCEntry = '" + POut.String(xChargeTransaction.CCEntry) + "'";
            }
            if (xChargeTransaction.PatNum != oldXChargeTransaction.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(xChargeTransaction.PatNum) + "";
            }
            if (xChargeTransaction.Result != oldXChargeTransaction.Result)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Result = '" + POut.String(xChargeTransaction.Result) + "'";
            }
            if (xChargeTransaction.ClerkID != oldXChargeTransaction.ClerkID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClerkID = '" + POut.String(xChargeTransaction.ClerkID) + "'";
            }
            if (xChargeTransaction.ResultCode != oldXChargeTransaction.ResultCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ResultCode = '" + POut.String(xChargeTransaction.ResultCode) + "'";
            }
            if (xChargeTransaction.Expiration != oldXChargeTransaction.Expiration)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Expiration = '" + POut.String(xChargeTransaction.Expiration) + "'";
            }
            if (xChargeTransaction.CCType != oldXChargeTransaction.CCType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CCType = '" + POut.String(xChargeTransaction.CCType) + "'";
            }
            if (xChargeTransaction.CreditCardNum != oldXChargeTransaction.CreditCardNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CreditCardNum = '" + POut.String(xChargeTransaction.CreditCardNum) + "'";
            }
            if (xChargeTransaction.BatchNum != oldXChargeTransaction.BatchNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BatchNum = '" + POut.String(xChargeTransaction.BatchNum) + "'";
            }
            if (xChargeTransaction.ItemNum != oldXChargeTransaction.ItemNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemNum = '" + POut.String(xChargeTransaction.ItemNum) + "'";
            }
            if (xChargeTransaction.ApprCode != oldXChargeTransaction.ApprCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ApprCode = '" + POut.String(xChargeTransaction.ApprCode) + "'";
            }
            if (xChargeTransaction.TransactionDateTime != oldXChargeTransaction.TransactionDateTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TransactionDateTime = " + POut.DateT(xChargeTransaction.TransactionDateTime) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE xchargetransaction SET " + command
                      + " WHERE XChargeTransactionNum = " + POut.Long(xChargeTransaction.XChargeTransactionNum);
            Db.NonQ(command);
        }
Example #29
0
        ///<summary>Updates one OrthoCase 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(OrthoCase orthoCase, OrthoCase oldOrthoCase)
        {
            string command = "";

            if (orthoCase.PatNum != oldOrthoCase.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(orthoCase.PatNum) + "";
            }
            if (orthoCase.ProvNum != oldOrthoCase.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(orthoCase.ProvNum) + "";
            }
            if (orthoCase.ClinicNum != oldOrthoCase.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(orthoCase.ClinicNum) + "";
            }
            if (orthoCase.Fee != oldOrthoCase.Fee)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Fee = '" + POut.Double(orthoCase.Fee) + "'";
            }
            if (orthoCase.FeeInsPrimary != oldOrthoCase.FeeInsPrimary)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeInsPrimary = '" + POut.Double(orthoCase.FeeInsPrimary) + "'";
            }
            if (orthoCase.FeePat != oldOrthoCase.FeePat)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeePat = '" + POut.Double(orthoCase.FeePat) + "'";
            }
            if (orthoCase.BandingDate.Date != oldOrthoCase.BandingDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BandingDate = " + POut.Date(orthoCase.BandingDate) + "";
            }
            if (orthoCase.DebondDate.Date != oldOrthoCase.DebondDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DebondDate = " + POut.Date(orthoCase.DebondDate) + "";
            }
            if (orthoCase.DebondDateExpected.Date != oldOrthoCase.DebondDateExpected.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DebondDateExpected = " + POut.Date(orthoCase.DebondDateExpected) + "";
            }
            if (orthoCase.IsTransfer != oldOrthoCase.IsTransfer)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsTransfer = " + POut.Bool(orthoCase.IsTransfer) + "";
            }
            if (orthoCase.OrthoType != oldOrthoCase.OrthoType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OrthoType = " + POut.Long(orthoCase.OrthoType) + "";
            }
            //SecDateTEntry not allowed to change
            if (orthoCase.SecUserNumEntry != oldOrthoCase.SecUserNumEntry)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SecUserNumEntry = " + POut.Long(orthoCase.SecUserNumEntry) + "";
            }
            //SecDateTEdit can only be set by MySQL
            if (orthoCase.IsActive != oldOrthoCase.IsActive)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsActive = " + POut.Bool(orthoCase.IsActive) + "";
            }
            if (orthoCase.FeeInsSecondary != oldOrthoCase.FeeInsSecondary)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeInsSecondary = '" + POut.Double(orthoCase.FeeInsSecondary) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE orthocase SET " + command
                      + " WHERE OrthoCaseNum = " + POut.Long(orthoCase.OrthoCaseNum);
            Db.NonQ(command);
            return(true);
        }
Example #30
0
        ///<summary>Converts a list of ProcedureCode into a DataTable.</summary>
        public static DataTable ListToTable(List <ProcedureCode> listProcedureCodes, string tableName = "")
        {
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = "ProcedureCode";
            }
            DataTable table = new DataTable(tableName);

            table.Columns.Add("CodeNum");
            table.Columns.Add("ProcCode");
            table.Columns.Add("Descript");
            table.Columns.Add("AbbrDesc");
            table.Columns.Add("ProcTime");
            table.Columns.Add("ProcCat");
            table.Columns.Add("TreatArea");
            table.Columns.Add("NoBillIns");
            table.Columns.Add("IsProsth");
            table.Columns.Add("DefaultNote");
            table.Columns.Add("IsHygiene");
            table.Columns.Add("GTypeNum");
            table.Columns.Add("AlternateCode1");
            table.Columns.Add("MedicalCode");
            table.Columns.Add("IsTaxed");
            table.Columns.Add("PaintType");
            table.Columns.Add("GraphicColor");
            table.Columns.Add("LaymanTerm");
            table.Columns.Add("IsCanadianLab");
            table.Columns.Add("PreExisting");
            table.Columns.Add("BaseUnits");
            table.Columns.Add("SubstitutionCode");
            table.Columns.Add("SubstOnlyIf");
            table.Columns.Add("DateTStamp");
            table.Columns.Add("IsMultiVisit");
            table.Columns.Add("DrugNDC");
            table.Columns.Add("RevenueCodeDefault");
            table.Columns.Add("ProvNumDefault");
            table.Columns.Add("CanadaTimeUnits");
            table.Columns.Add("IsRadiology");
            table.Columns.Add("DefaultClaimNote");
            table.Columns.Add("DefaultTPNote");
            table.Columns.Add("BypassGlobalLock");
            table.Columns.Add("TaxCode");
            foreach (ProcedureCode procedureCode in listProcedureCodes)
            {
                table.Rows.Add(new object[] {
                    POut.Long(procedureCode.CodeNum),
                    procedureCode.ProcCode,
                    procedureCode.Descript,
                    procedureCode.AbbrDesc,
                    procedureCode.ProcTime,
                    POut.Long(procedureCode.ProcCat),
                    POut.Int((int)procedureCode.TreatArea),
                    POut.Bool(procedureCode.NoBillIns),
                    POut.Bool(procedureCode.IsProsth),
                    procedureCode.DefaultNote,
                    POut.Bool(procedureCode.IsHygiene),
                    POut.Int(procedureCode.GTypeNum),
                    procedureCode.AlternateCode1,
                    procedureCode.MedicalCode,
                    POut.Bool(procedureCode.IsTaxed),
                    POut.Int((int)procedureCode.PaintType),
                    POut.Int(procedureCode.GraphicColor.ToArgb()),
                    procedureCode.LaymanTerm,
                    POut.Bool(procedureCode.IsCanadianLab),
                    POut.Bool(procedureCode.PreExisting),
                    POut.Int(procedureCode.BaseUnits),
                    procedureCode.SubstitutionCode,
                    POut.Int((int)procedureCode.SubstOnlyIf),
                    POut.DateT(procedureCode.DateTStamp, false),
                    POut.Bool(procedureCode.IsMultiVisit),
                    procedureCode.DrugNDC,
                    procedureCode.RevenueCodeDefault,
                    POut.Long(procedureCode.ProvNumDefault),
                    POut.Double(procedureCode.CanadaTimeUnits),
                    POut.Bool(procedureCode.IsRadiology),
                    procedureCode.DefaultClaimNote,
                    procedureCode.DefaultTPNote,
                    POut.Int((int)procedureCode.BypassGlobalLock),
                    procedureCode.TaxCode,
                });
            }
            return(table);
        }