///<summary>Updates one Vitalsign 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(Vitalsign vitalsign, Vitalsign oldVitalsign) { string command = ""; if (vitalsign.PatNum != oldVitalsign.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(vitalsign.PatNum) + ""; } if (vitalsign.Height != oldVitalsign.Height) { if (command != "") { command += ","; } command += "Height = " + POut.Float(vitalsign.Height) + ""; } if (vitalsign.Weight != oldVitalsign.Weight) { if (command != "") { command += ","; } command += "Weight = " + POut.Float(vitalsign.Weight) + ""; } if (vitalsign.BpSystolic != oldVitalsign.BpSystolic) { if (command != "") { command += ","; } command += "BpSystolic = " + POut.Int(vitalsign.BpSystolic) + ""; } if (vitalsign.BpDiastolic != oldVitalsign.BpDiastolic) { if (command != "") { command += ","; } command += "BpDiastolic = " + POut.Int(vitalsign.BpDiastolic) + ""; } if (vitalsign.DateTaken != oldVitalsign.DateTaken) { if (command != "") { command += ","; } command += "DateTaken = " + POut.Date(vitalsign.DateTaken) + ""; } if (vitalsign.HasFollowupPlan != oldVitalsign.HasFollowupPlan) { if (command != "") { command += ","; } command += "HasFollowupPlan = " + POut.Bool(vitalsign.HasFollowupPlan) + ""; } if (vitalsign.IsIneligible != oldVitalsign.IsIneligible) { if (command != "") { command += ","; } command += "IsIneligible = " + POut.Bool(vitalsign.IsIneligible) + ""; } if (vitalsign.Documentation != oldVitalsign.Documentation) { if (command != "") { command += ","; } command += "Documentation = '" + POut.String(vitalsign.Documentation) + "'"; } if (vitalsign.ChildGotNutrition != oldVitalsign.ChildGotNutrition) { if (command != "") { command += ","; } command += "ChildGotNutrition = " + POut.Bool(vitalsign.ChildGotNutrition) + ""; } if (vitalsign.ChildGotPhysCouns != oldVitalsign.ChildGotPhysCouns) { if (command != "") { command += ","; } command += "ChildGotPhysCouns = " + POut.Bool(vitalsign.ChildGotPhysCouns) + ""; } if (command == "") { return; } command = "UPDATE vitalsign SET " + command + " WHERE VitalsignNum = " + POut.Long(vitalsign.VitalsignNum); Db.NonQ(command); }
protected override string GetCommand(DashboardFilter filter) { string where = "WHERE procedurelog.ProcStatus=" + POut.Int((int)ProcStat.C) + " "; if (filter.UseDateFilter) { where += "AND procedurelog.ProcDate BETWEEN " + POut.Date(filter.DateFrom) + " AND " + POut.Date(filter.DateTo) + " "; } return ("SELECT procedurelog.ProcDate,procedurelog.ProvNum,procedurelog.ClinicNum, " + "SUM(procedurelog.ProcFee*(procedurelog.UnitQty+procedurelog.BaseUnits)) AS GrossProd, " + "COUNT(procedurelog.ProcNum) AS ProcCount " + "FROM procedurelog " + where + "GROUP BY procedurelog.ProcDate,procedurelog.ProvNum,procedurelog.ClinicNum "); }
///<summary>Updates one RefAttach 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(RefAttach refAttach, RefAttach oldRefAttach) { string command = ""; if (refAttach.ReferralNum != oldRefAttach.ReferralNum) { if (command != "") { command += ","; } command += "ReferralNum = " + POut.Long(refAttach.ReferralNum) + ""; } if (refAttach.PatNum != oldRefAttach.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(refAttach.PatNum) + ""; } if (refAttach.ItemOrder != oldRefAttach.ItemOrder) { if (command != "") { command += ","; } command += "ItemOrder = " + POut.Int(refAttach.ItemOrder) + ""; } if (refAttach.RefDate != oldRefAttach.RefDate) { if (command != "") { command += ","; } command += "RefDate = " + POut.Date(refAttach.RefDate) + ""; } if (refAttach.IsFrom != oldRefAttach.IsFrom) { if (command != "") { command += ","; } command += "IsFrom = " + POut.Bool(refAttach.IsFrom) + ""; } if (refAttach.RefToStatus != oldRefAttach.RefToStatus) { if (command != "") { command += ","; } command += "RefToStatus = " + POut.Int((int)refAttach.RefToStatus) + ""; } if (refAttach.Note != oldRefAttach.Note) { if (command != "") { command += ","; } command += "Note = '" + POut.String(refAttach.Note) + "'"; } if (refAttach.IsTransitionOfCare != oldRefAttach.IsTransitionOfCare) { if (command != "") { command += ","; } command += "IsTransitionOfCare = " + POut.Bool(refAttach.IsTransitionOfCare) + ""; } if (refAttach.ProcNum != oldRefAttach.ProcNum) { if (command != "") { command += ","; } command += "ProcNum = " + POut.Long(refAttach.ProcNum) + ""; } if (refAttach.DateProcComplete != oldRefAttach.DateProcComplete) { if (command != "") { command += ","; } command += "DateProcComplete = " + POut.Date(refAttach.DateProcComplete) + ""; } if (refAttach.ProvNum != oldRefAttach.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(refAttach.ProvNum) + ""; } if (command == "") { return; } command = "UPDATE refattach SET " + command + " WHERE RefAttachNum = " + POut.Long(refAttach.RefAttachNum); Db.NonQ(command); }
///<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.</summary> public static void 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 != oldCreditCard.CCExpiration) { 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 != oldCreditCard.DateStart) { if (command != "") { command += ","; } command += "DateStart = " + POut.Date(creditCard.DateStart) + ""; } if (creditCard.DateStop != oldCreditCard.DateStop) { 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 (command == "") { return; } command = "UPDATE creditcard SET " + command + " WHERE CreditCardNum = " + POut.Long(creditCard.CreditCardNum); Db.NonQ(command); }
///<summary>Updates one Equipment 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(Equipment equipment, Equipment oldEquipment) { string command = ""; if (equipment.Description != oldEquipment.Description) { if (command != "") { command += ","; } command += "Description = '" + POut.String(equipment.Description) + "'"; } if (equipment.SerialNumber != oldEquipment.SerialNumber) { if (command != "") { command += ","; } command += "SerialNumber = '" + POut.String(equipment.SerialNumber) + "'"; } if (equipment.ModelYear != oldEquipment.ModelYear) { if (command != "") { command += ","; } command += "ModelYear = '" + POut.String(equipment.ModelYear) + "'"; } if (equipment.DatePurchased != oldEquipment.DatePurchased) { if (command != "") { command += ","; } command += "DatePurchased = " + POut.Date(equipment.DatePurchased) + ""; } if (equipment.DateSold != oldEquipment.DateSold) { if (command != "") { command += ","; } command += "DateSold = " + POut.Date(equipment.DateSold) + ""; } if (equipment.PurchaseCost != oldEquipment.PurchaseCost) { if (command != "") { command += ","; } command += "PurchaseCost = '" + POut.Double(equipment.PurchaseCost) + "'"; } if (equipment.MarketValue != oldEquipment.MarketValue) { if (command != "") { command += ","; } command += "MarketValue = '" + POut.Double(equipment.MarketValue) + "'"; } if (equipment.Location != oldEquipment.Location) { if (command != "") { command += ","; } command += "Location = '" + POut.String(equipment.Location) + "'"; } if (equipment.DateEntry != oldEquipment.DateEntry) { if (command != "") { command += ","; } command += "DateEntry = " + POut.Date(equipment.DateEntry) + ""; } if (command == "") { return; } command = "UPDATE equipment SET " + command + " WHERE EquipmentNum = " + POut.Long(equipment.EquipmentNum); Db.NonQ(command); }
///<summary>Updates one Deposit 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(Deposit deposit, Deposit oldDeposit) { string command = ""; if (deposit.DateDeposit.Date != oldDeposit.DateDeposit.Date) { if (command != "") { command += ","; } command += "DateDeposit = " + POut.Date(deposit.DateDeposit) + ""; } if (deposit.BankAccountInfo != oldDeposit.BankAccountInfo) { if (command != "") { command += ","; } command += "BankAccountInfo = " + DbHelper.ParamChar + "paramBankAccountInfo"; } if (deposit.Amount != oldDeposit.Amount) { if (command != "") { command += ","; } command += "Amount = '" + POut.Double(deposit.Amount) + "'"; } if (deposit.Memo != oldDeposit.Memo) { if (command != "") { command += ","; } command += "Memo = '" + POut.String(deposit.Memo) + "'"; } if (deposit.Batch != oldDeposit.Batch) { if (command != "") { command += ","; } command += "Batch = '" + POut.String(deposit.Batch) + "'"; } if (deposit.DepositAccountNum != oldDeposit.DepositAccountNum) { if (command != "") { command += ","; } command += "DepositAccountNum = " + POut.Long(deposit.DepositAccountNum) + ""; } if (command == "") { return(false); } if (deposit.BankAccountInfo == null) { deposit.BankAccountInfo = ""; } OdSqlParameter paramBankAccountInfo = new OdSqlParameter("paramBankAccountInfo", OdDbType.Text, POut.StringParam(deposit.BankAccountInfo)); command = "UPDATE deposit SET " + command + " WHERE DepositNum = " + POut.Long(deposit.DepositNum); Db.NonQ(command, paramBankAccountInfo); return(true); }
///<summary>Updates one Disease in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables. Returns true if an update occurred.</summary> public static bool Update(Disease disease, Disease oldDisease) { string command = ""; if (disease.PatNum != oldDisease.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(disease.PatNum) + ""; } if (disease.DiseaseDefNum != oldDisease.DiseaseDefNum) { if (command != "") { command += ","; } command += "DiseaseDefNum = " + POut.Long(disease.DiseaseDefNum) + ""; } if (disease.PatNote != oldDisease.PatNote) { if (command != "") { command += ","; } command += "PatNote = " + DbHelper.ParamChar + "paramPatNote"; } //DateTStamp can only be set by MySQL if (disease.ProbStatus != oldDisease.ProbStatus) { if (command != "") { command += ","; } command += "ProbStatus = " + POut.Int((int)disease.ProbStatus) + ""; } if (disease.DateStart.Date != oldDisease.DateStart.Date) { if (command != "") { command += ","; } command += "DateStart = " + POut.Date(disease.DateStart) + ""; } if (disease.DateStop.Date != oldDisease.DateStop.Date) { if (command != "") { command += ","; } command += "DateStop = " + POut.Date(disease.DateStop) + ""; } if (disease.SnomedProblemType != oldDisease.SnomedProblemType) { if (command != "") { command += ","; } command += "SnomedProblemType = '" + POut.String(disease.SnomedProblemType) + "'"; } if (disease.FunctionStatus != oldDisease.FunctionStatus) { if (command != "") { command += ","; } command += "FunctionStatus = " + POut.Int((int)disease.FunctionStatus) + ""; } if (command == "") { return(false); } if (disease.PatNote == null) { disease.PatNote = ""; } OdSqlParameter paramPatNote = new OdSqlParameter("paramPatNote", OdDbType.Text, POut.StringParam(disease.PatNote)); command = "UPDATE disease SET " + command + " WHERE DiseaseNum = " + POut.Long(disease.DiseaseNum); Db.NonQ(command, paramPatNote); return(true); }
///<summary>Updates one Vitalsign 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(Vitalsign vitalsign, Vitalsign oldVitalsign) { string command = ""; if (vitalsign.PatNum != oldVitalsign.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(vitalsign.PatNum) + ""; } if (vitalsign.Height != oldVitalsign.Height) { if (command != "") { command += ","; } command += "Height = " + POut.Float(vitalsign.Height) + ""; } if (vitalsign.Weight != oldVitalsign.Weight) { if (command != "") { command += ","; } command += "Weight = " + POut.Float(vitalsign.Weight) + ""; } if (vitalsign.BpSystolic != oldVitalsign.BpSystolic) { if (command != "") { command += ","; } command += "BpSystolic = " + POut.Int(vitalsign.BpSystolic) + ""; } if (vitalsign.BpDiastolic != oldVitalsign.BpDiastolic) { if (command != "") { command += ","; } command += "BpDiastolic = " + POut.Int(vitalsign.BpDiastolic) + ""; } if (vitalsign.DateTaken.Date != oldVitalsign.DateTaken.Date) { if (command != "") { command += ","; } command += "DateTaken = " + POut.Date(vitalsign.DateTaken) + ""; } if (vitalsign.HasFollowupPlan != oldVitalsign.HasFollowupPlan) { if (command != "") { command += ","; } command += "HasFollowupPlan = " + POut.Bool(vitalsign.HasFollowupPlan) + ""; } if (vitalsign.IsIneligible != oldVitalsign.IsIneligible) { if (command != "") { command += ","; } command += "IsIneligible = " + POut.Bool(vitalsign.IsIneligible) + ""; } if (vitalsign.Documentation != oldVitalsign.Documentation) { if (command != "") { command += ","; } command += "Documentation = " + DbHelper.ParamChar + "paramDocumentation"; } if (vitalsign.ChildGotNutrition != oldVitalsign.ChildGotNutrition) { if (command != "") { command += ","; } command += "ChildGotNutrition = " + POut.Bool(vitalsign.ChildGotNutrition) + ""; } if (vitalsign.ChildGotPhysCouns != oldVitalsign.ChildGotPhysCouns) { if (command != "") { command += ","; } command += "ChildGotPhysCouns = " + POut.Bool(vitalsign.ChildGotPhysCouns) + ""; } if (vitalsign.WeightCode != oldVitalsign.WeightCode) { if (command != "") { command += ","; } command += "WeightCode = '" + POut.String(vitalsign.WeightCode) + "'"; } if (vitalsign.HeightExamCode != oldVitalsign.HeightExamCode) { if (command != "") { command += ","; } command += "HeightExamCode = '" + POut.String(vitalsign.HeightExamCode) + "'"; } if (vitalsign.WeightExamCode != oldVitalsign.WeightExamCode) { if (command != "") { command += ","; } command += "WeightExamCode = '" + POut.String(vitalsign.WeightExamCode) + "'"; } if (vitalsign.BMIExamCode != oldVitalsign.BMIExamCode) { if (command != "") { command += ","; } command += "BMIExamCode = '" + POut.String(vitalsign.BMIExamCode) + "'"; } if (vitalsign.EhrNotPerformedNum != oldVitalsign.EhrNotPerformedNum) { if (command != "") { command += ","; } command += "EhrNotPerformedNum = " + POut.Long(vitalsign.EhrNotPerformedNum) + ""; } if (vitalsign.PregDiseaseNum != oldVitalsign.PregDiseaseNum) { if (command != "") { command += ","; } command += "PregDiseaseNum = " + POut.Long(vitalsign.PregDiseaseNum) + ""; } if (vitalsign.BMIPercentile != oldVitalsign.BMIPercentile) { if (command != "") { command += ","; } command += "BMIPercentile = " + POut.Int(vitalsign.BMIPercentile) + ""; } if (vitalsign.Pulse != oldVitalsign.Pulse) { if (command != "") { command += ","; } command += "Pulse = " + POut.Int(vitalsign.Pulse) + ""; } if (command == "") { return(false); } if (vitalsign.Documentation == null) { vitalsign.Documentation = ""; } OdSqlParameter paramDocumentation = new OdSqlParameter("paramDocumentation", OdDbType.Text, POut.StringParam(vitalsign.Documentation)); command = "UPDATE vitalsign SET " + command + " WHERE VitalsignNum = " + POut.Long(vitalsign.VitalsignNum); Db.NonQ(command, paramDocumentation); return(true); }
///<summary>Updates one InsVerifyHist 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(InsVerifyHist insVerifyHist, InsVerifyHist oldInsVerifyHist) { string command = ""; if (insVerifyHist.VerifyUserNum != oldInsVerifyHist.VerifyUserNum) { if (command != "") { command += ","; } command += "VerifyUserNum = " + POut.Long(insVerifyHist.VerifyUserNum) + ""; } if (insVerifyHist.InsVerifyNum != oldInsVerifyHist.InsVerifyNum) { if (command != "") { command += ","; } command += "InsVerifyNum = " + POut.Long(insVerifyHist.InsVerifyNum) + ""; } if (insVerifyHist.DateLastVerified.Date != oldInsVerifyHist.DateLastVerified.Date) { if (command != "") { command += ","; } command += "DateLastVerified = " + POut.Date(insVerifyHist.DateLastVerified) + ""; } if (insVerifyHist.UserNum != oldInsVerifyHist.UserNum) { if (command != "") { command += ","; } command += "UserNum = " + POut.Long(insVerifyHist.UserNum) + ""; } if (insVerifyHist.VerifyType != oldInsVerifyHist.VerifyType) { if (command != "") { command += ","; } command += "VerifyType = " + POut.Int((int)insVerifyHist.VerifyType) + ""; } if (insVerifyHist.FKey != oldInsVerifyHist.FKey) { if (command != "") { command += ","; } command += "FKey = " + POut.Long(insVerifyHist.FKey) + ""; } if (insVerifyHist.DefNum != oldInsVerifyHist.DefNum) { if (command != "") { command += ","; } command += "DefNum = " + POut.Long(insVerifyHist.DefNum) + ""; } if (insVerifyHist.DateLastAssigned.Date != oldInsVerifyHist.DateLastAssigned.Date) { if (command != "") { command += ","; } command += "DateLastAssigned = " + POut.Date(insVerifyHist.DateLastAssigned) + ""; } if (insVerifyHist.Note != oldInsVerifyHist.Note) { if (command != "") { command += ","; } command += "Note = " + DbHelper.ParamChar + "paramNote"; } //DateTimeEntry not allowed to change if (insVerifyHist.HoursAvailableForVerification != oldInsVerifyHist.HoursAvailableForVerification) { if (command != "") { command += ","; } command += "HoursAvailableForVerification = '" + POut.Double(insVerifyHist.HoursAvailableForVerification) + "'"; } if (command == "") { return(false); } if (insVerifyHist.Note == null) { insVerifyHist.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(insVerifyHist.Note)); command = "UPDATE insverifyhist SET " + command + " WHERE InsVerifyHistNum = " + POut.Long(insVerifyHist.InsVerifyHistNum); Db.NonQ(command, paramNote); return(true); }
///<summary>Updates one EhrNotPerformed 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(EhrNotPerformed ehrNotPerformed, EhrNotPerformed oldEhrNotPerformed) { string command = ""; if (ehrNotPerformed.PatNum != oldEhrNotPerformed.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(ehrNotPerformed.PatNum) + ""; } if (ehrNotPerformed.ProvNum != oldEhrNotPerformed.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(ehrNotPerformed.ProvNum) + ""; } if (ehrNotPerformed.CodeValue != oldEhrNotPerformed.CodeValue) { if (command != "") { command += ","; } command += "CodeValue = '" + POut.String(ehrNotPerformed.CodeValue) + "'"; } if (ehrNotPerformed.CodeSystem != oldEhrNotPerformed.CodeSystem) { if (command != "") { command += ","; } command += "CodeSystem = '" + POut.String(ehrNotPerformed.CodeSystem) + "'"; } if (ehrNotPerformed.CodeValueReason != oldEhrNotPerformed.CodeValueReason) { if (command != "") { command += ","; } command += "CodeValueReason = '" + POut.String(ehrNotPerformed.CodeValueReason) + "'"; } if (ehrNotPerformed.CodeSystemReason != oldEhrNotPerformed.CodeSystemReason) { if (command != "") { command += ","; } command += "CodeSystemReason = '" + POut.String(ehrNotPerformed.CodeSystemReason) + "'"; } if (ehrNotPerformed.Note != oldEhrNotPerformed.Note) { if (command != "") { command += ","; } command += "Note = " + DbHelper.ParamChar + "paramNote"; } if (ehrNotPerformed.DateEntry.Date != oldEhrNotPerformed.DateEntry.Date) { if (command != "") { command += ","; } command += "DateEntry = " + POut.Date(ehrNotPerformed.DateEntry) + ""; } if (command == "") { return(false); } if (ehrNotPerformed.Note == null) { ehrNotPerformed.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(ehrNotPerformed.Note)); command = "UPDATE ehrnotperformed SET " + command + " WHERE EhrNotPerformedNum = " + POut.Long(ehrNotPerformed.EhrNotPerformedNum); Db.NonQ(command, paramNote); return(true); }
///<summary>Updates one InsSub 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(InsSub insSub, InsSub oldInsSub) { string command = ""; if (insSub.PlanNum != oldInsSub.PlanNum) { if (command != "") { command += ","; } command += "PlanNum = " + POut.Long(insSub.PlanNum) + ""; } if (insSub.Subscriber != oldInsSub.Subscriber) { if (command != "") { command += ","; } command += "Subscriber = " + POut.Long(insSub.Subscriber) + ""; } if (insSub.DateEffective != oldInsSub.DateEffective) { if (command != "") { command += ","; } command += "DateEffective = " + POut.Date(insSub.DateEffective) + ""; } if (insSub.DateTerm != oldInsSub.DateTerm) { if (command != "") { command += ","; } command += "DateTerm = " + POut.Date(insSub.DateTerm) + ""; } if (insSub.ReleaseInfo != oldInsSub.ReleaseInfo) { if (command != "") { command += ","; } command += "ReleaseInfo = " + POut.Bool(insSub.ReleaseInfo) + ""; } if (insSub.AssignBen != oldInsSub.AssignBen) { if (command != "") { command += ","; } command += "AssignBen = " + POut.Bool(insSub.AssignBen) + ""; } if (insSub.SubscriberID != oldInsSub.SubscriberID) { if (command != "") { command += ","; } command += "SubscriberID = '" + POut.String(insSub.SubscriberID) + "'"; } if (insSub.BenefitNotes != oldInsSub.BenefitNotes) { if (command != "") { command += ","; } command += "BenefitNotes = " + DbHelper.ParamChar + "paramBenefitNotes"; } if (insSub.SubscNote != oldInsSub.SubscNote) { if (command != "") { command += ","; } command += "SubscNote = '" + POut.String(insSub.SubscNote) + "'"; } if (command == "") { return; } if (insSub.BenefitNotes == null) { insSub.BenefitNotes = ""; } OdSqlParameter paramBenefitNotes = new OdSqlParameter("paramBenefitNotes", OdDbType.Text, insSub.BenefitNotes); command = "UPDATE inssub SET " + command + " WHERE InsSubNum = " + POut.Long(insSub.InsSubNum); Db.NonQ(command, paramBenefitNotes); }
protected override string GetCommand(DashboardFilter filter) { string where = ""; if (filter.UseDateFilter) { where = "WHERE AdjDate BETWEEN " + POut.Date(filter.DateFrom) + " AND " + POut.Date(filter.DateTo) + " "; } return ("SELECT AdjDate,ProvNum,SUM(AdjAmt) AdjTotal, ClinicNum " + "FROM adjustment " + where + "GROUP BY AdjDate,ProvNum,ClinicNum " + "HAVING AdjTotal<>0 " + "ORDER BY AdjDate,ProvNum "); }
///<summary>Updates one OrionProc 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(OrionProc orionProc, OrionProc oldOrionProc) { string command = ""; if (orionProc.ProcNum != oldOrionProc.ProcNum) { if (command != "") { command += ","; } command += "ProcNum = " + POut.Long(orionProc.ProcNum) + ""; } if (orionProc.DPC != oldOrionProc.DPC) { if (command != "") { command += ","; } command += "DPC = " + POut.Int((int)orionProc.DPC) + ""; } if (orionProc.DPCpost != oldOrionProc.DPCpost) { if (command != "") { command += ","; } command += "DPCpost = " + POut.Int((int)orionProc.DPCpost) + ""; } if (orionProc.DateScheduleBy.Date != oldOrionProc.DateScheduleBy.Date) { if (command != "") { command += ","; } command += "DateScheduleBy = " + POut.Date(orionProc.DateScheduleBy) + ""; } if (orionProc.DateStopClock.Date != oldOrionProc.DateStopClock.Date) { if (command != "") { command += ","; } command += "DateStopClock = " + POut.Date(orionProc.DateStopClock) + ""; } if (orionProc.Status2 != oldOrionProc.Status2) { if (command != "") { command += ","; } command += "Status2 = " + POut.Int((int)orionProc.Status2) + ""; } if (orionProc.IsOnCall != oldOrionProc.IsOnCall) { if (command != "") { command += ","; } command += "IsOnCall = " + POut.Bool(orionProc.IsOnCall) + ""; } if (orionProc.IsEffectiveComm != oldOrionProc.IsEffectiveComm) { if (command != "") { command += ","; } command += "IsEffectiveComm = " + POut.Bool(orionProc.IsEffectiveComm) + ""; } if (orionProc.IsRepair != oldOrionProc.IsRepair) { if (command != "") { command += ","; } command += "IsRepair = " + POut.Bool(orionProc.IsRepair) + ""; } if (command == "") { return(false); } command = "UPDATE orionproc SET " + command + " WHERE OrionProcNum = " + POut.Long(orionProc.OrionProcNum); Db.NonQ(command); return(true); }
///<summary>Updates one Task 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(Task task, Task oldTask) { string command = ""; if (task.TaskListNum != oldTask.TaskListNum) { if (command != "") { command += ","; } command += "TaskListNum = " + POut.Long(task.TaskListNum) + ""; } if (task.DateTask != oldTask.DateTask) { if (command != "") { command += ","; } command += "DateTask = " + POut.Date(task.DateTask) + ""; } if (task.KeyNum != oldTask.KeyNum) { if (command != "") { command += ","; } command += "KeyNum = " + POut.Long(task.KeyNum) + ""; } if (task.Descript != oldTask.Descript) { if (command != "") { command += ","; } command += "Descript = " + DbHelper.ParamChar + "paramDescript"; } if (task.TaskStatus != oldTask.TaskStatus) { if (command != "") { command += ","; } command += "TaskStatus = " + POut.Int((int)task.TaskStatus) + ""; } if (task.IsRepeating != oldTask.IsRepeating) { if (command != "") { command += ","; } command += "IsRepeating = " + POut.Bool(task.IsRepeating) + ""; } if (task.DateType != oldTask.DateType) { if (command != "") { command += ","; } command += "DateType = " + POut.Int((int)task.DateType) + ""; } if (task.FromNum != oldTask.FromNum) { if (command != "") { command += ","; } command += "FromNum = " + POut.Long(task.FromNum) + ""; } if (task.ObjectType != oldTask.ObjectType) { if (command != "") { command += ","; } command += "ObjectType = " + POut.Int((int)task.ObjectType) + ""; } if (task.DateTimeEntry != oldTask.DateTimeEntry) { if (command != "") { command += ","; } command += "DateTimeEntry = " + POut.DateT(task.DateTimeEntry) + ""; } if (task.UserNum != oldTask.UserNum) { if (command != "") { command += ","; } command += "UserNum = " + POut.Long(task.UserNum) + ""; } if (task.DateTimeFinished != oldTask.DateTimeFinished) { if (command != "") { command += ","; } command += "DateTimeFinished = " + POut.DateT(task.DateTimeFinished) + ""; } if (command == "") { return; } if (task.Descript == null) { task.Descript = ""; } OdSqlParameter paramDescript = new OdSqlParameter("paramDescript", OdDbType.Text, task.Descript); command = "UPDATE task SET " + command + " WHERE TaskNum = " + POut.Long(task.TaskNum); Db.NonQ(command, paramDescript); }
///<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 (payPlan.IsDynamic != oldPayPlan.IsDynamic) { if (command != "") { command += ","; } command += "IsDynamic = " + POut.Bool(payPlan.IsDynamic) + ""; } if (payPlan.ChargeFrequency != oldPayPlan.ChargeFrequency) { if (command != "") { command += ","; } command += "ChargeFrequency = " + POut.Int((int)payPlan.ChargeFrequency) + ""; } if (payPlan.DatePayPlanStart.Date != oldPayPlan.DatePayPlanStart.Date) { if (command != "") { command += ","; } command += "DatePayPlanStart = " + POut.Date(payPlan.DatePayPlanStart) + ""; } if (payPlan.IsLocked != oldPayPlan.IsLocked) { if (command != "") { command += ","; } command += "IsLocked = " + POut.Bool(payPlan.IsLocked) + ""; } 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); }
///<summary>Updates one RegistrationKey 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(RegistrationKey registrationKey, RegistrationKey oldRegistrationKey) { string command = ""; if (registrationKey.PatNum != oldRegistrationKey.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(registrationKey.PatNum) + ""; } if (registrationKey.RegKey != oldRegistrationKey.RegKey) { if (command != "") { command += ","; } command += "RegKey = '" + POut.String(registrationKey.RegKey) + "'"; } if (registrationKey.Note != oldRegistrationKey.Note) { if (command != "") { command += ","; } command += "Note = '" + POut.String(registrationKey.Note) + "'"; } if (registrationKey.DateStarted.Date != oldRegistrationKey.DateStarted.Date) { if (command != "") { command += ","; } command += "DateStarted = " + POut.Date(registrationKey.DateStarted) + ""; } if (registrationKey.DateDisabled.Date != oldRegistrationKey.DateDisabled.Date) { if (command != "") { command += ","; } command += "DateDisabled = " + POut.Date(registrationKey.DateDisabled) + ""; } if (registrationKey.DateEnded.Date != oldRegistrationKey.DateEnded.Date) { if (command != "") { command += ","; } command += "DateEnded = " + POut.Date(registrationKey.DateEnded) + ""; } if (registrationKey.IsForeign != oldRegistrationKey.IsForeign) { if (command != "") { command += ","; } command += "IsForeign = " + POut.Bool(registrationKey.IsForeign) + ""; } if (registrationKey.UsesServerVersion != oldRegistrationKey.UsesServerVersion) { if (command != "") { command += ","; } command += "UsesServerVersion = " + POut.Bool(registrationKey.UsesServerVersion) + ""; } if (registrationKey.IsFreeVersion != oldRegistrationKey.IsFreeVersion) { if (command != "") { command += ","; } command += "IsFreeVersion = " + POut.Bool(registrationKey.IsFreeVersion) + ""; } if (registrationKey.IsOnlyForTesting != oldRegistrationKey.IsOnlyForTesting) { if (command != "") { command += ","; } command += "IsOnlyForTesting = " + POut.Bool(registrationKey.IsOnlyForTesting) + ""; } if (registrationKey.VotesAllotted != oldRegistrationKey.VotesAllotted) { if (command != "") { command += ","; } command += "VotesAllotted = " + POut.Int(registrationKey.VotesAllotted) + ""; } if (registrationKey.IsResellerCustomer != oldRegistrationKey.IsResellerCustomer) { if (command != "") { command += ","; } command += "IsResellerCustomer = " + POut.Bool(registrationKey.IsResellerCustomer) + ""; } if (registrationKey.HasEarlyAccess != oldRegistrationKey.HasEarlyAccess) { if (command != "") { command += ","; } command += "HasEarlyAccess = " + POut.Bool(registrationKey.HasEarlyAccess) + ""; } if (registrationKey.DateTBackupScheduled != oldRegistrationKey.DateTBackupScheduled) { if (command != "") { command += ","; } command += "DateTBackupScheduled = " + POut.DateT(registrationKey.DateTBackupScheduled) + ""; } if (registrationKey.BackupPassCode != oldRegistrationKey.BackupPassCode) { if (command != "") { command += ","; } command += "BackupPassCode = '" + POut.String(registrationKey.BackupPassCode) + "'"; } if (command == "") { return(false); } command = "UPDATE registrationkey SET " + command + " WHERE RegistrationKeyNum = " + POut.Long(registrationKey.RegistrationKeyNum); Db.NonQ(command); return(true); }
///<summary>Updates one VaccineObs 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(VaccineObs vaccineObs, VaccineObs oldVaccineObs) { string command = ""; if (vaccineObs.VaccinePatNum != oldVaccineObs.VaccinePatNum) { if (command != "") { command += ","; } command += "VaccinePatNum = " + POut.Long(vaccineObs.VaccinePatNum) + ""; } if (vaccineObs.ValType != oldVaccineObs.ValType) { if (command != "") { command += ","; } command += "ValType = " + POut.Int((int)vaccineObs.ValType) + ""; } if (vaccineObs.IdentifyingCode != oldVaccineObs.IdentifyingCode) { if (command != "") { command += ","; } command += "IdentifyingCode = " + POut.Int((int)vaccineObs.IdentifyingCode) + ""; } if (vaccineObs.ValReported != oldVaccineObs.ValReported) { if (command != "") { command += ","; } command += "ValReported = '" + POut.String(vaccineObs.ValReported) + "'"; } if (vaccineObs.ValCodeSystem != oldVaccineObs.ValCodeSystem) { if (command != "") { command += ","; } command += "ValCodeSystem = " + POut.Int((int)vaccineObs.ValCodeSystem) + ""; } if (vaccineObs.VaccineObsNumGroup != oldVaccineObs.VaccineObsNumGroup) { if (command != "") { command += ","; } command += "VaccineObsNumGroup = " + POut.Long(vaccineObs.VaccineObsNumGroup) + ""; } if (vaccineObs.UcumCode != oldVaccineObs.UcumCode) { if (command != "") { command += ","; } command += "UcumCode = '" + POut.String(vaccineObs.UcumCode) + "'"; } if (vaccineObs.DateObs.Date != oldVaccineObs.DateObs.Date) { if (command != "") { command += ","; } command += "DateObs = " + POut.Date(vaccineObs.DateObs) + ""; } if (vaccineObs.MethodCode != oldVaccineObs.MethodCode) { if (command != "") { command += ","; } command += "MethodCode = '" + POut.String(vaccineObs.MethodCode) + "'"; } if (command == "") { return(false); } command = "UPDATE vaccineobs SET " + command + " WHERE VaccineObsNum = " + POut.Long(vaccineObs.VaccineObsNum); Db.NonQ(command); return(true); }
///<summary>Updates one Intervention 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(Intervention intervention, Intervention oldIntervention) { string command = ""; if (intervention.PatNum != oldIntervention.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(intervention.PatNum) + ""; } if (intervention.ProvNum != oldIntervention.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(intervention.ProvNum) + ""; } if (intervention.CodeValue != oldIntervention.CodeValue) { if (command != "") { command += ","; } command += "CodeValue = '" + POut.String(intervention.CodeValue) + "'"; } if (intervention.CodeSystem != oldIntervention.CodeSystem) { if (command != "") { command += ","; } command += "CodeSystem = '" + POut.String(intervention.CodeSystem) + "'"; } if (intervention.Note != oldIntervention.Note) { if (command != "") { command += ","; } command += "Note = " + DbHelper.ParamChar + "paramNote"; } if (intervention.DateEntry.Date != oldIntervention.DateEntry.Date) { if (command != "") { command += ","; } command += "DateEntry = " + POut.Date(intervention.DateEntry) + ""; } if (intervention.CodeSet != oldIntervention.CodeSet) { if (command != "") { command += ","; } command += "CodeSet = " + POut.Int((int)intervention.CodeSet) + ""; } if (intervention.IsPatDeclined != oldIntervention.IsPatDeclined) { if (command != "") { command += ","; } command += "IsPatDeclined = " + POut.Bool(intervention.IsPatDeclined) + ""; } if (command == "") { return(false); } if (intervention.Note == null) { intervention.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(intervention.Note)); command = "UPDATE intervention SET " + command + " WHERE InterventionNum = " + POut.Long(intervention.InterventionNum); Db.NonQ(command, paramNote); return(true); }
///<summary>Updates one EhrNotPerformed 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(EhrNotPerformed ehrNotPerformed, EhrNotPerformed oldEhrNotPerformed) { string command = ""; if (ehrNotPerformed.PatNum != oldEhrNotPerformed.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(ehrNotPerformed.PatNum) + ""; } if (ehrNotPerformed.ProvNum != oldEhrNotPerformed.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(ehrNotPerformed.ProvNum) + ""; } if (ehrNotPerformed.CodeValue != oldEhrNotPerformed.CodeValue) { if (command != "") { command += ","; } command += "CodeValue = '" + POut.String(ehrNotPerformed.CodeValue) + "'"; } if (ehrNotPerformed.CodeSystem != oldEhrNotPerformed.CodeSystem) { if (command != "") { command += ","; } command += "CodeSystem = '" + POut.String(ehrNotPerformed.CodeSystem) + "'"; } if (ehrNotPerformed.CodeValueReason != oldEhrNotPerformed.CodeValueReason) { if (command != "") { command += ","; } command += "CodeValueReason = '" + POut.String(ehrNotPerformed.CodeValueReason) + "'"; } if (ehrNotPerformed.CodeSystemReason != oldEhrNotPerformed.CodeSystemReason) { if (command != "") { command += ","; } command += "CodeSystemReason = '" + POut.String(ehrNotPerformed.CodeSystemReason) + "'"; } if (ehrNotPerformed.Note != oldEhrNotPerformed.Note) { if (command != "") { command += ","; } command += "Note = '" + POut.String(ehrNotPerformed.Note) + "'"; } if (ehrNotPerformed.DateEntry != oldEhrNotPerformed.DateEntry) { if (command != "") { command += ","; } command += "DateEntry = " + POut.Date(ehrNotPerformed.DateEntry) + ""; } if (command == "") { return; } command = "UPDATE ehrnotperformed SET " + command + " WHERE EhrNotPerformedNum = " + POut.Long(ehrNotPerformed.EhrNotPerformedNum); Db.NonQ(command); }
///<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 (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); }
///<summary>Updates one Signalod 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(Signalod signalod, Signalod oldSignalod) { string command = ""; if (signalod.FromUser != oldSignalod.FromUser) { if (command != "") { command += ","; } command += "FromUser = '******'"; } if (signalod.ITypes != oldSignalod.ITypes) { if (command != "") { command += ","; } command += "ITypes = '" + POut.String(signalod.ITypes) + "'"; } if (signalod.DateViewing != oldSignalod.DateViewing) { if (command != "") { command += ","; } command += "DateViewing = " + POut.Date(signalod.DateViewing) + ""; } if (signalod.SigType != oldSignalod.SigType) { if (command != "") { command += ","; } command += "SigType = " + POut.Int((int)signalod.SigType) + ""; } if (signalod.SigText != oldSignalod.SigText) { if (command != "") { command += ","; } command += "SigText = '" + POut.String(signalod.SigText) + "'"; } if (signalod.SigDateTime != oldSignalod.SigDateTime) { if (command != "") { command += ","; } command += "SigDateTime = " + POut.DateT(signalod.SigDateTime) + ""; } if (signalod.ToUser != oldSignalod.ToUser) { if (command != "") { command += ","; } command += "ToUser = '******'"; } if (signalod.AckTime != oldSignalod.AckTime) { if (command != "") { command += ","; } command += "AckTime = " + POut.DateT(signalod.AckTime) + ""; } if (signalod.TaskNum != oldSignalod.TaskNum) { if (command != "") { command += ","; } command += "TaskNum = " + POut.Long(signalod.TaskNum) + ""; } if (command == "") { return; } command = "UPDATE signalod SET " + command + " WHERE SignalNum = " + POut.Long(signalod.SignalNum); Db.NonQ(command); }
///<summary>Updates one JournalEntry 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(JournalEntry journalEntry, JournalEntry oldJournalEntry) { string command = ""; if (journalEntry.TransactionNum != oldJournalEntry.TransactionNum) { if (command != "") { command += ","; } command += "TransactionNum = " + POut.Long(journalEntry.TransactionNum) + ""; } if (journalEntry.AccountNum != oldJournalEntry.AccountNum) { if (command != "") { command += ","; } command += "AccountNum = " + POut.Long(journalEntry.AccountNum) + ""; } if (journalEntry.DateDisplayed.Date != oldJournalEntry.DateDisplayed.Date) { if (command != "") { command += ","; } command += "DateDisplayed = " + POut.Date(journalEntry.DateDisplayed) + ""; } if (journalEntry.DebitAmt != oldJournalEntry.DebitAmt) { if (command != "") { command += ","; } command += "DebitAmt = '" + POut.Double(journalEntry.DebitAmt) + "'"; } if (journalEntry.CreditAmt != oldJournalEntry.CreditAmt) { if (command != "") { command += ","; } command += "CreditAmt = '" + POut.Double(journalEntry.CreditAmt) + "'"; } if (journalEntry.Memo != oldJournalEntry.Memo) { if (command != "") { command += ","; } command += "Memo = " + DbHelper.ParamChar + "paramMemo"; } if (journalEntry.Splits != oldJournalEntry.Splits) { if (command != "") { command += ","; } command += "Splits = " + DbHelper.ParamChar + "paramSplits"; } if (journalEntry.CheckNumber != oldJournalEntry.CheckNumber) { if (command != "") { command += ","; } command += "CheckNumber = '" + POut.String(journalEntry.CheckNumber) + "'"; } if (journalEntry.ReconcileNum != oldJournalEntry.ReconcileNum) { if (command != "") { command += ","; } command += "ReconcileNum = " + POut.Long(journalEntry.ReconcileNum) + ""; } //SecUserNumEntry excluded from update //SecDateTEntry not allowed to change if (journalEntry.SecUserNumEdit != oldJournalEntry.SecUserNumEdit) { if (command != "") { command += ","; } command += "SecUserNumEdit = " + POut.Long(journalEntry.SecUserNumEdit) + ""; } //SecDateTEdit can only be set by MySQL if (command == "") { return(false); } if (journalEntry.Memo == null) { journalEntry.Memo = ""; } OdSqlParameter paramMemo = new OdSqlParameter("paramMemo", OdDbType.Text, POut.StringParam(journalEntry.Memo)); if (journalEntry.Splits == null) { journalEntry.Splits = ""; } OdSqlParameter paramSplits = new OdSqlParameter("paramSplits", OdDbType.Text, POut.StringParam(journalEntry.Splits)); command = "UPDATE journalentry SET " + command + " WHERE JournalEntryNum = " + POut.Long(journalEntry.JournalEntryNum); Db.NonQ(command, paramMemo, paramSplits); return(true); }
///<summary>Updates one PaySplit 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(PaySplit paySplit, PaySplit oldPaySplit) { string command = ""; if (paySplit.SplitAmt != oldPaySplit.SplitAmt) { if (command != "") { command += ","; } command += "SplitAmt = '" + POut.Double(paySplit.SplitAmt) + "'"; } if (paySplit.PatNum != oldPaySplit.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(paySplit.PatNum) + ""; } if (paySplit.ProcDate != oldPaySplit.ProcDate) { if (command != "") { command += ","; } command += "ProcDate = " + POut.Date(paySplit.ProcDate) + ""; } if (paySplit.PayNum != oldPaySplit.PayNum) { if (command != "") { command += ","; } command += "PayNum = " + POut.Long(paySplit.PayNum) + ""; } if (paySplit.IsDiscount != oldPaySplit.IsDiscount) { if (command != "") { command += ","; } command += "IsDiscount = " + POut.Bool(paySplit.IsDiscount) + ""; } if (paySplit.DiscountType != oldPaySplit.DiscountType) { if (command != "") { command += ","; } command += "DiscountType = " + POut.Byte(paySplit.DiscountType) + ""; } if (paySplit.ProvNum != oldPaySplit.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(paySplit.ProvNum) + ""; } if (paySplit.PayPlanNum != oldPaySplit.PayPlanNum) { if (command != "") { command += ","; } command += "PayPlanNum = " + POut.Long(paySplit.PayPlanNum) + ""; } if (paySplit.DatePay != oldPaySplit.DatePay) { if (command != "") { command += ","; } command += "DatePay = " + POut.Date(paySplit.DatePay) + ""; } if (paySplit.ProcNum != oldPaySplit.ProcNum) { if (command != "") { command += ","; } command += "ProcNum = " + POut.Long(paySplit.ProcNum) + ""; } //DateEntry not allowed to change if (paySplit.UnearnedType != oldPaySplit.UnearnedType) { if (command != "") { command += ","; } command += "UnearnedType = " + POut.Long(paySplit.UnearnedType) + ""; } if (paySplit.ClinicNum != oldPaySplit.ClinicNum) { if (command != "") { command += ","; } command += "ClinicNum = " + POut.Long(paySplit.ClinicNum) + ""; } if (command == "") { return; } command = "UPDATE paysplit SET " + command + " WHERE SplitNum = " + POut.Long(paySplit.SplitNum); Db.NonQ(command); }
///<summary>Updates one ScreenGroup 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(ScreenGroup screenGroup, ScreenGroup oldScreenGroup) { string command = ""; if (screenGroup.Description != oldScreenGroup.Description) { if (command != "") { command += ","; } command += "Description = '" + POut.String(screenGroup.Description) + "'"; } if (screenGroup.SGDate.Date != oldScreenGroup.SGDate.Date) { if (command != "") { command += ","; } command += "SGDate = " + POut.Date(screenGroup.SGDate) + ""; } if (screenGroup.ProvName != oldScreenGroup.ProvName) { if (command != "") { command += ","; } command += "ProvName = '" + POut.String(screenGroup.ProvName) + "'"; } if (screenGroup.ProvNum != oldScreenGroup.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(screenGroup.ProvNum) + ""; } if (screenGroup.PlaceService != oldScreenGroup.PlaceService) { if (command != "") { command += ","; } command += "PlaceService = " + POut.Int((int)screenGroup.PlaceService) + ""; } if (screenGroup.County != oldScreenGroup.County) { if (command != "") { command += ","; } command += "County = '" + POut.String(screenGroup.County) + "'"; } if (screenGroup.GradeSchool != oldScreenGroup.GradeSchool) { if (command != "") { command += ","; } command += "GradeSchool = '" + POut.String(screenGroup.GradeSchool) + "'"; } if (screenGroup.SheetDefNum != oldScreenGroup.SheetDefNum) { if (command != "") { command += ","; } command += "SheetDefNum = " + POut.Long(screenGroup.SheetDefNum) + ""; } if (command == "") { return(false); } command = "UPDATE screengroup SET " + command + " WHERE ScreenGroupNum = " + POut.Long(screenGroup.ScreenGroupNum); Db.NonQ(command); return(true); }
///<summary>Updates one Schedule 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(Schedule schedule, Schedule oldSchedule) { string command = ""; if (schedule.SchedDate != oldSchedule.SchedDate) { if (command != "") { command += ","; } command += "SchedDate = " + POut.Date(schedule.SchedDate) + ""; } if (schedule.StartTime != oldSchedule.StartTime) { if (command != "") { command += ","; } command += "StartTime = " + POut.Time(schedule.StartTime) + ""; } if (schedule.StopTime != oldSchedule.StopTime) { if (command != "") { command += ","; } command += "StopTime = " + POut.Time(schedule.StopTime) + ""; } if (schedule.SchedType != oldSchedule.SchedType) { if (command != "") { command += ","; } command += "SchedType = " + POut.Int((int)schedule.SchedType) + ""; } if (schedule.ProvNum != oldSchedule.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(schedule.ProvNum) + ""; } if (schedule.BlockoutType != oldSchedule.BlockoutType) { if (command != "") { command += ","; } command += "BlockoutType = " + POut.Long(schedule.BlockoutType) + ""; } if (schedule.Note != oldSchedule.Note) { if (command != "") { command += ","; } command += "Note = '" + POut.String(schedule.Note) + "'"; } if (schedule.Status != oldSchedule.Status) { if (command != "") { command += ","; } command += "Status = " + POut.Int((int)schedule.Status) + ""; } if (schedule.EmployeeNum != oldSchedule.EmployeeNum) { if (command != "") { command += ","; } command += "EmployeeNum = " + POut.Long(schedule.EmployeeNum) + ""; } //DateTStamp can only be set by MySQL if (command == "") { return; } command = "UPDATE schedule SET " + command + " WHERE ScheduleNum = " + POut.Long(schedule.ScheduleNum); Db.NonQ(command); }
protected override string GetCommand(DashboardFilter filter) { string where = ""; List <string> listWhereClauses = new List <string>(); if (filter.UseDateFilter) { listWhereClauses.Add("DATE(AdjDate) BETWEEN " + POut.Date(filter.DateFrom) + " AND " + POut.Date(filter.DateTo) + " "); } if (filter.UseProvFilter) { listWhereClauses.Add("ProvNum=" + POut.Long(filter.ProvNum) + " "); } if (listWhereClauses.Count > 0) { where = "WHERE " + string.Join("AND ", listWhereClauses); } return ("SELECT AdjDate,ProvNum,COUNT(AdjNum) AdjCount,ClinicNum,AdjType, SUM(AdjAmt) AdjAmt " + "FROM adjustment " + "INNER JOIN definition ON definition.DefNum=adjustment.AdjType " + "AND definition.ItemValue = '+' " + where + "GROUP BY AdjDate,ProvNum,ClinicNum,AdjType " + "ORDER BY AdjDate,ProvNum,ClinicNum "); }
protected override string GetCommand(DashboardFilter filter) { string where = "WHERE AptStatus=" + (int)ApptStatus.Broken + " "; if (filter.UseDateFilter) { where += "AND DATE(AptDateTime) BETWEEN " + POut.Date(filter.DateFrom) + " AND " + POut.Date(filter.DateTo) + " "; } if (filter.UseProvFilter) { where += "AND ProvNum=" + POut.Long(filter.ProvNum) + " "; } return ("SELECT DATE(AptDateTime) ApptDate,ProvNum,ClinicNum,COUNT(AptNum) ApptCount " + "FROM appointment " + where + "GROUP BY ApptDate,ProvNum,ClinicNum "); }
///<summary>Inserts one PayPlan into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(PayPlan payPlan, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO payplan ("; if (!useExistingPK && isRandomKeys) { payPlan.PayPlanNum = ReplicationServers.GetKeyNoCache("payplan", "PayPlanNum"); } if (isRandomKeys || useExistingPK) { command += "PayPlanNum,"; } command += "PatNum,Guarantor,PayPlanDate,APR,Note,PlanNum,CompletedAmt,InsSubNum,PaySchedule,NumberOfPayments,PayAmt,DownPayment,IsClosed,Signature,SigIsTopaz,PlanCategory,IsDynamic,ChargeFrequency,DatePayPlanStart,IsLocked) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(payPlan.PayPlanNum) + ","; } command += POut.Long(payPlan.PatNum) + "," + POut.Long(payPlan.Guarantor) + "," + POut.Date(payPlan.PayPlanDate) + "," + "'" + POut.Double(payPlan.APR) + "'," + DbHelper.ParamChar + "paramNote," + POut.Long(payPlan.PlanNum) + "," + "'" + POut.Double(payPlan.CompletedAmt) + "'," + POut.Long(payPlan.InsSubNum) + "," + POut.Int((int)payPlan.PaySchedule) + "," + POut.Int(payPlan.NumberOfPayments) + "," + "'" + POut.Double(payPlan.PayAmt) + "'," + "'" + POut.Double(payPlan.DownPayment) + "'," + POut.Bool(payPlan.IsClosed) + "," + DbHelper.ParamChar + "paramSignature," + POut.Bool(payPlan.SigIsTopaz) + "," + POut.Long(payPlan.PlanCategory) + "," + POut.Bool(payPlan.IsDynamic) + "," + POut.Int((int)payPlan.ChargeFrequency) + "," + POut.Date(payPlan.DatePayPlanStart) + "," + POut.Bool(payPlan.IsLocked) + ")"; 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)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramNote, paramSignature); } else { payPlan.PayPlanNum = Db.NonQ(command, true, "PayPlanNum", "payPlan", paramNote, paramSignature); } return(payPlan.PayPlanNum); }
///<summary>Inserts one ClaimProc into the database. Provides option to use the existing priKey.</summary> public static long Insert(ClaimProc claimProc, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { claimProc.ClaimProcNum = ReplicationServers.GetKey("claimproc", "ClaimProcNum"); } string command = "INSERT INTO claimproc ("; if (useExistingPK || PrefC.RandomKeys) { command += "ClaimProcNum,"; } command += "ProcNum,ClaimNum,PatNum,ProvNum,FeeBilled,InsPayEst,DedApplied,Status,InsPayAmt,Remarks,ClaimPaymentNum,PlanNum,DateCP,WriteOff,CodeSent,AllowedOverride,Percentage,PercentOverride,CopayAmt,NoBillIns,PaidOtherIns,BaseEst,CopayOverride,ProcDate,DateEntry,LineNumber,DedEst,DedEstOverride,InsEstTotal,InsEstTotalOverride,PaidOtherInsOverride,EstimateNote,WriteOffEst,WriteOffEstOverride,ClinicNum,InsSubNum,PaymentRow,PayPlanNum,ClaimPaymentTracking,SecUserNumEntry,SecDateEntry,DateSuppReceived,DateInsFinalized) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(claimProc.ClaimProcNum) + ","; } command += POut.Long(claimProc.ProcNum) + "," + POut.Long(claimProc.ClaimNum) + "," + POut.Long(claimProc.PatNum) + "," + POut.Long(claimProc.ProvNum) + "," + "'" + POut.Double(claimProc.FeeBilled) + "'," + "'" + POut.Double(claimProc.InsPayEst) + "'," + "'" + POut.Double(claimProc.DedApplied) + "'," + POut.Int((int)claimProc.Status) + "," + "'" + POut.Double(claimProc.InsPayAmt) + "'," + "'" + POut.String(claimProc.Remarks) + "'," + POut.Long(claimProc.ClaimPaymentNum) + "," + POut.Long(claimProc.PlanNum) + "," + POut.Date(claimProc.DateCP) + "," + "'" + POut.Double(claimProc.WriteOff) + "'," + "'" + POut.String(claimProc.CodeSent) + "'," + "'" + POut.Double(claimProc.AllowedOverride) + "'," + POut.Int(claimProc.Percentage) + "," + POut.Int(claimProc.PercentOverride) + "," + "'" + POut.Double(claimProc.CopayAmt) + "'," + POut.Bool(claimProc.NoBillIns) + "," + "'" + POut.Double(claimProc.PaidOtherIns) + "'," + "'" + POut.Double(claimProc.BaseEst) + "'," + "'" + POut.Double(claimProc.CopayOverride) + "'," + POut.Date(claimProc.ProcDate) + "," + POut.Date(claimProc.DateEntry) + "," + POut.Byte(claimProc.LineNumber) + "," + "'" + POut.Double(claimProc.DedEst) + "'," + "'" + POut.Double(claimProc.DedEstOverride) + "'," + "'" + POut.Double(claimProc.InsEstTotal) + "'," + "'" + POut.Double(claimProc.InsEstTotalOverride) + "'," + "'" + POut.Double(claimProc.PaidOtherInsOverride) + "'," + "'" + POut.String(claimProc.EstimateNote) + "'," + "'" + POut.Double(claimProc.WriteOffEst) + "'," + "'" + POut.Double(claimProc.WriteOffEstOverride) + "'," + POut.Long(claimProc.ClinicNum) + "," + POut.Long(claimProc.InsSubNum) + "," + POut.Int(claimProc.PaymentRow) + "," + POut.Long(claimProc.PayPlanNum) + "," + POut.Long(claimProc.ClaimPaymentTracking) + "," + POut.Long(claimProc.SecUserNumEntry) + "," + DbHelper.Now() + "," //SecDateTEdit can only be set by MySQL + POut.Date(claimProc.DateSuppReceived) + "," + POut.Date(claimProc.DateInsFinalized) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { claimProc.ClaimProcNum = Db.NonQ(command, true, "ClaimProcNum", "claimProc"); } return(claimProc.ClaimProcNum); }
///<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> public 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 (recall.DateScheduled != oldRecall.DateScheduled) { if (command != "") { command += ","; } command += "DateScheduled = " + POut.Date(recall.DateScheduled) + ""; } if (command == "") { return; } command = "UPDATE recall SET " + command + " WHERE RecallNum = " + POut.Long(recall.RecallNum); Db.NonQ(command); }