///<summary>Inserts one Screen into the database. Provides option to use the existing priKey.</summary> public static long Insert(Screen screen, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { screen.ScreenNum = ReplicationServers.GetKey("screen", "ScreenNum"); } string command = "INSERT INTO screen ("; if (useExistingPK || PrefC.RandomKeys) { command += "ScreenNum,"; } command += "Gender,RaceOld,GradeLevel,Age,Urgency,HasCaries,NeedsSealants,CariesExperience,EarlyChildCaries,ExistingSealants,MissingAllTeeth,Birthdate,ScreenGroupNum,ScreenGroupOrder,Comments,ScreenPatNum,SheetNum) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(screen.ScreenNum) + ","; } command += POut.Int((int)screen.Gender) + "," + POut.Int((int)screen.RaceOld) + "," + POut.Int((int)screen.GradeLevel) + "," + POut.Byte(screen.Age) + "," + POut.Int((int)screen.Urgency) + "," + POut.Int((int)screen.HasCaries) + "," + POut.Int((int)screen.NeedsSealants) + "," + POut.Int((int)screen.CariesExperience) + "," + POut.Int((int)screen.EarlyChildCaries) + "," + POut.Int((int)screen.ExistingSealants) + "," + POut.Int((int)screen.MissingAllTeeth) + "," + POut.Date(screen.Birthdate) + "," + POut.Long(screen.ScreenGroupNum) + "," + POut.Int(screen.ScreenGroupOrder) + "," + "'" + POut.String(screen.Comments) + "'," + POut.Long(screen.ScreenPatNum) + "," + POut.Long(screen.SheetNum) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { screen.ScreenNum = Db.NonQ(command, true, "ScreenNum", "screen"); } return(screen.ScreenNum); }
///<summary>Updates one EhrMeasureEvent in the database.</summary> public static void Update(EhrMeasureEvent ehrMeasureEvent) { string command = "UPDATE ehrmeasureevent SET " + "DateTEvent = " + POut.DateT(ehrMeasureEvent.DateTEvent) + ", " + "EventType = " + POut.Int((int)ehrMeasureEvent.EventType) + ", " + "PatNum = " + POut.Long(ehrMeasureEvent.PatNum) + ", " + "MoreInfo = '" + POut.String(ehrMeasureEvent.MoreInfo) + "', " + "CodeValueEvent = '" + POut.String(ehrMeasureEvent.CodeValueEvent) + "', " + "CodeSystemEvent = '" + POut.String(ehrMeasureEvent.CodeSystemEvent) + "', " + "CodeValueResult = '" + POut.String(ehrMeasureEvent.CodeValueResult) + "', " + "CodeSystemResult = '" + POut.String(ehrMeasureEvent.CodeSystemResult) + "', " + "FKey = " + POut.Long(ehrMeasureEvent.FKey) + ", " + "DateStartTobacco = " + POut.Date(ehrMeasureEvent.DateStartTobacco) + ", " + "TobaccoCessationDesire= " + POut.Byte(ehrMeasureEvent.TobaccoCessationDesire) + " " + "WHERE EhrMeasureEventNum = " + POut.Long(ehrMeasureEvent.EhrMeasureEventNum); Db.NonQ(command); }
///<summary>Updates one SigMessage in the database.</summary> public static void Update(SigMessage sigMessage) { string command = "UPDATE sigmessage SET " + "ButtonText = '" + POut.String(sigMessage.ButtonText) + "', " + "ButtonIndex = " + POut.Int(sigMessage.ButtonIndex) + ", " + "SynchIcon = " + POut.Byte(sigMessage.SynchIcon) + ", " + "FromUser = '******', " + "ToUser = '******', " //MessageDateTime not allowed to change + "AckDateTime = " + POut.DateT(sigMessage.AckDateTime) + ", " + "SigText = '" + POut.String(sigMessage.SigText) + "', " + "SigElementDefNumUser = "******", " + "SigElementDefNumExtra= " + POut.Long(sigMessage.SigElementDefNumExtra) + ", " + "SigElementDefNumMsg = " + POut.Long(sigMessage.SigElementDefNumMsg) + " " + "WHERE SigMessageNum = " + POut.Long(sigMessage.SigMessageNum); Db.NonQ(command); }
///<summary>Updates one Benefit in the database.</summary> public static void Update(Benefit benefit) { string command = "UPDATE benefit SET " + "PlanNum = " + POut.Long(benefit.PlanNum) + ", " + "PatPlanNum = " + POut.Long(benefit.PatPlanNum) + ", " + "CovCatNum = " + POut.Long(benefit.CovCatNum) + ", " + "BenefitType = " + POut.Int((int)benefit.BenefitType) + ", " + "Percent = " + POut.Int(benefit.Percent) + ", " + "MonetaryAmt = '" + POut.Double(benefit.MonetaryAmt) + "', " + "TimePeriod = " + POut.Int((int)benefit.TimePeriod) + ", " + "QuantityQualifier= " + POut.Int((int)benefit.QuantityQualifier) + ", " + "Quantity = " + POut.Byte(benefit.Quantity) + ", " + "CodeNum = " + POut.Long(benefit.CodeNum) + ", " + "CoverageLevel = " + POut.Int((int)benefit.CoverageLevel) + " " + "WHERE BenefitNum = " + POut.Long(benefit.BenefitNum); Db.NonQ(command); }
///<summary>Updates one SigButDef 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(SigButDef sigButDef, SigButDef oldSigButDef) { string command = ""; if (sigButDef.ButtonText != oldSigButDef.ButtonText) { if (command != "") { command += ","; } command += "ButtonText = '" + POut.String(sigButDef.ButtonText) + "'"; } if (sigButDef.ButtonIndex != oldSigButDef.ButtonIndex) { if (command != "") { command += ","; } command += "ButtonIndex = " + POut.Int(sigButDef.ButtonIndex) + ""; } if (sigButDef.SynchIcon != oldSigButDef.SynchIcon) { if (command != "") { command += ","; } command += "SynchIcon = " + POut.Byte(sigButDef.SynchIcon) + ""; } if (sigButDef.ComputerName != oldSigButDef.ComputerName) { if (command != "") { command += ","; } command += "ComputerName = '" + POut.String(sigButDef.ComputerName) + "'"; } if (command == "") { return; } command = "UPDATE sigbutdef SET " + command + " WHERE SigButDefNum = " + POut.Long(sigButDef.SigButDefNum); Db.NonQ(command); }
///<summary>Updates one ClaimProc in the database.</summary> internal static void Update(ClaimProc claimProc) { string command = "UPDATE claimproc SET " + "ProcNum = " + POut.Long(claimProc.ProcNum) + ", " + "ClaimNum = " + POut.Long(claimProc.ClaimNum) + ", " + "PatNum = " + POut.Long(claimProc.PatNum) + ", " + "ProvNum = " + POut.Long(claimProc.ProvNum) + ", " + "FeeBilled = '" + POut.Double(claimProc.FeeBilled) + "', " + "InsPayEst = '" + POut.Double(claimProc.InsPayEst) + "', " + "DedApplied = '" + POut.Double(claimProc.DedApplied) + "', " + "Status = " + POut.Int((int)claimProc.Status) + ", " + "InsPayAmt = '" + POut.Double(claimProc.InsPayAmt) + "', " + "Remarks = '" + POut.String(claimProc.Remarks) + "', " + "ClaimPaymentNum = " + POut.Long(claimProc.ClaimPaymentNum) + ", " + "PlanNum = " + POut.Long(claimProc.PlanNum) + ", " + "DateCP = " + POut.Date(claimProc.DateCP) + ", " + "WriteOff = '" + POut.Double(claimProc.WriteOff) + "', " + "CodeSent = '" + POut.String(claimProc.CodeSent) + "', " + "AllowedOverride = '" + POut.Double(claimProc.AllowedOverride) + "', " + "Percentage = " + POut.Int(claimProc.Percentage) + ", " + "PercentOverride = " + POut.Int(claimProc.PercentOverride) + ", " + "CopayAmt = '" + POut.Double(claimProc.CopayAmt) + "', " + "NoBillIns = " + POut.Bool(claimProc.NoBillIns) + ", " + "PaidOtherIns = '" + POut.Double(claimProc.PaidOtherIns) + "', " + "BaseEst = '" + POut.Double(claimProc.BaseEst) + "', " + "CopayOverride = '" + POut.Double(claimProc.CopayOverride) + "', " + "ProcDate = " + POut.Date(claimProc.ProcDate) + ", " + "DateEntry = " + POut.Date(claimProc.DateEntry) + ", " + "LineNumber = " + POut.Byte(claimProc.LineNumber) + ", " + "DedEst = '" + POut.Double(claimProc.DedEst) + "', " + "DedEstOverride = '" + POut.Double(claimProc.DedEstOverride) + "', " + "InsEstTotal = '" + POut.Double(claimProc.InsEstTotal) + "', " + "InsEstTotalOverride = '" + POut.Double(claimProc.InsEstTotalOverride) + "', " + "PaidOtherInsOverride= '" + POut.Double(claimProc.PaidOtherInsOverride) + "', " + "EstimateNote = '" + POut.String(claimProc.EstimateNote) + "', " + "WriteOffEst = '" + POut.Double(claimProc.WriteOffEst) + "', " + "WriteOffEstOverride = '" + POut.Double(claimProc.WriteOffEstOverride) + "', " + "ClinicNum = " + POut.Long(claimProc.ClinicNum) + ", " + "InsSubNum = " + POut.Long(claimProc.InsSubNum) + ", " + "PaymentRow = " + POut.Int(claimProc.PaymentRow) + " " + "WHERE ClaimProcNum = " + POut.Long(claimProc.ClaimProcNum); Db.NonQ(command); }
///<summary>Inserts one PaySplit into the database. Provides option to use the existing priKey.</summary> public static long Insert(PaySplit paySplit, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { paySplit.SplitNum = ReplicationServers.GetKey("paysplit", "SplitNum"); } string command = "INSERT INTO paysplit ("; if (useExistingPK || PrefC.RandomKeys) { command += "SplitNum,"; } command += "SplitAmt,PatNum,ProcDate,PayNum,IsDiscount,DiscountType,ProvNum,PayPlanNum,DatePay,ProcNum,DateEntry,UnearnedType,ClinicNum,SecUserNumEntry,FSplitNum) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(paySplit.SplitNum) + ","; } command += "'" + POut.Double(paySplit.SplitAmt) + "'," + POut.Long(paySplit.PatNum) + "," + POut.Date(paySplit.ProcDate) + "," + POut.Long(paySplit.PayNum) + "," + POut.Bool(paySplit.IsDiscount) + "," + POut.Byte(paySplit.DiscountType) + "," + POut.Long(paySplit.ProvNum) + "," + POut.Long(paySplit.PayPlanNum) + "," + POut.Date(paySplit.DatePay) + "," + POut.Long(paySplit.ProcNum) + "," + DbHelper.Now() + "," + POut.Long(paySplit.UnearnedType) + "," + POut.Long(paySplit.ClinicNum) + "," + POut.Long(paySplit.SecUserNumEntry) + "," //SecDateTEdit can only be set by MySQL + POut.Long(paySplit.FSplitNum) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { paySplit.SplitNum = Db.NonQ(command, true, "SplitNum", "paySplit"); } return(paySplit.SplitNum); }
///<summary>Inserts one ComputerPref into the database. Provides option to use the existing priKey.</summary> internal static long Insert(ComputerPref computerPref, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { computerPref.ComputerPrefNum = ReplicationServers.GetKey("computerpref", "ComputerPrefNum"); } string command = "INSERT INTO computerpref ("; if (useExistingPK || PrefC.RandomKeys) { command += "ComputerPrefNum,"; } command += "ComputerName,GraphicsUseHardware,GraphicsSimple,SensorType,SensorBinned,SensorPort,SensorExposure,GraphicsDoubleBuffering,PreferredPixelFormatNum,AtoZpath,TaskKeepListHidden,TaskDock,TaskX,TaskY,DirectXFormat,RecentApptView) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(computerPref.ComputerPrefNum) + ","; } command += "'" + POut.String(computerPref.ComputerName) + "'," + POut.Bool(computerPref.GraphicsUseHardware) + "," + POut.Int((int)computerPref.GraphicsSimple) + "," + "'" + POut.String(computerPref.SensorType) + "'," + POut.Bool(computerPref.SensorBinned) + "," + POut.Int(computerPref.SensorPort) + "," + POut.Int(computerPref.SensorExposure) + "," + POut.Bool(computerPref.GraphicsDoubleBuffering) + "," + POut.Int(computerPref.PreferredPixelFormatNum) + "," + "'" + POut.String(computerPref.AtoZpath) + "'," + POut.Bool(computerPref.TaskKeepListHidden) + "," + POut.Int(computerPref.TaskDock) + "," + POut.Int(computerPref.TaskX) + "," + POut.Int(computerPref.TaskY) + "," + "'" + POut.String(computerPref.DirectXFormat) + "'," + POut.Byte(computerPref.RecentApptView) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { computerPref.ComputerPrefNum = Db.NonQ(command, true); } return(computerPref.ComputerPrefNum); }
///<summary>Updates one SigElementDef in the database.</summary> internal static void Update(SigElementDef sigElementDef) { string command = "UPDATE sigelementdef SET " + "LightRow = " + POut.Byte(sigElementDef.LightRow) + ", " + "LightColor = " + POut.Int(sigElementDef.LightColor.ToArgb()) + ", " + "SigElementType = " + POut.Int((int)sigElementDef.SigElementType) + ", " + "SigText = '" + POut.String(sigElementDef.SigText) + "', " + "Sound = " + DbHelper.ParamChar + "paramSound, " + "ItemOrder = " + POut.Int(sigElementDef.ItemOrder) + " " + "WHERE SigElementDefNum = " + POut.Long(sigElementDef.SigElementDefNum); if (sigElementDef.Sound == null) { sigElementDef.Sound = ""; } OdSqlParameter paramSound = new OdSqlParameter("paramSound", OdDbType.Text, sigElementDef.Sound); Db.NonQ(command, paramSound); }
///<summary>Updates one Sheet in the database.</summary> internal static void Update(Sheet sheet) { string command = "UPDATE sheet SET " + "SheetType = " + POut.Int((int)sheet.SheetType) + ", " + "PatNum = " + POut.Long(sheet.PatNum) + ", " + "DateTimeSheet = " + POut.DateT(sheet.DateTimeSheet) + ", " + "FontSize = " + POut.Float(sheet.FontSize) + ", " + "FontName = '" + POut.String(sheet.FontName) + "', " + "Width = " + POut.Int(sheet.Width) + ", " + "Height = " + POut.Int(sheet.Height) + ", " + "IsLandscape = " + POut.Bool(sheet.IsLandscape) + ", " + "InternalNote = '" + POut.String(sheet.InternalNote) + "', " + "Description = '" + POut.String(sheet.Description) + "', " + "ShowInTerminal= " + POut.Byte(sheet.ShowInTerminal) + ", " + "IsWebForm = " + POut.Bool(sheet.IsWebForm) + " " + "WHERE SheetNum = " + POut.Long(sheet.SheetNum); Db.NonQ(command); }
///<summary>Updates one ApptView in the database.</summary> public static void Update(ApptView apptView) { string command = "UPDATE apptview SET " + "Description = '" + POut.String(apptView.Description) + "', " + "ItemOrder = " + POut.Int(apptView.ItemOrder) + ", " + "RowsPerIncr = " + POut.Byte(apptView.RowsPerIncr) + ", " + "OnlyScheduledProvs = " + POut.Bool(apptView.OnlyScheduledProvs) + ", " + "OnlySchedBeforeTime = " + POut.Time(apptView.OnlySchedBeforeTime) + ", " + "OnlySchedAfterTime = " + POut.Time(apptView.OnlySchedAfterTime) + ", " + "StackBehavUR = " + POut.Int((int)apptView.StackBehavUR) + ", " + "StackBehavLR = " + POut.Int((int)apptView.StackBehavLR) + ", " + "ClinicNum = " + POut.Long(apptView.ClinicNum) + ", " + "ApptTimeScrollStart = " + POut.Time(apptView.ApptTimeScrollStart) + ", " + "IsScrollStartDynamic = " + POut.Bool(apptView.IsScrollStartDynamic) + ", " + "IsApptBubblesDisabled= " + POut.Bool(apptView.IsApptBubblesDisabled) + " " + "WHERE ApptViewNum = " + POut.Long(apptView.ApptViewNum); Db.NonQ(command); }
///<summary>Converts a list of ApptView into a DataTable.</summary> public static DataTable ListToTable(List <ApptView> listApptViews, string tableName = "") { if (string.IsNullOrEmpty(tableName)) { tableName = "ApptView"; } DataTable table = new DataTable(tableName); table.Columns.Add("ApptViewNum"); table.Columns.Add("Description"); table.Columns.Add("ItemOrder"); table.Columns.Add("RowsPerIncr"); table.Columns.Add("OnlyScheduledProvs"); table.Columns.Add("OnlySchedBeforeTime"); table.Columns.Add("OnlySchedAfterTime"); table.Columns.Add("StackBehavUR"); table.Columns.Add("StackBehavLR"); table.Columns.Add("ClinicNum"); table.Columns.Add("ApptTimeScrollStart"); table.Columns.Add("IsScrollStartDynamic"); table.Columns.Add("IsApptBubblesDisabled"); table.Columns.Add("WidthOpMinimum"); foreach (ApptView apptView in listApptViews) { table.Rows.Add(new object[] { POut.Long(apptView.ApptViewNum), apptView.Description, POut.Int(apptView.ItemOrder), POut.Byte(apptView.RowsPerIncr), POut.Bool(apptView.OnlyScheduledProvs), POut.Time(apptView.OnlySchedBeforeTime, false), POut.Time(apptView.OnlySchedAfterTime, false), POut.Int((int)apptView.StackBehavUR), POut.Int((int)apptView.StackBehavLR), POut.Long(apptView.ClinicNum), POut.Time(apptView.ApptTimeScrollStart, false), POut.Bool(apptView.IsScrollStartDynamic), POut.Bool(apptView.IsApptBubblesDisabled), POut.Int(apptView.WidthOpMinimum), }); } return(table); }
///<summary>Inserts one Carrier into the database. Provides option to use the existing priKey.</summary> public static long Insert(Carrier carrier, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { carrier.CarrierNum = ReplicationServers.GetKey("carrier", "CarrierNum"); } string command = "INSERT INTO carrier ("; if (useExistingPK || PrefC.RandomKeys) { command += "CarrierNum,"; } command += "CarrierName,Address,Address2,City,State,Zip,Phone,ElectID,NoSendElect,IsCDA,CDAnetVersion,CanadianNetworkNum,IsHidden,CanadianEncryptionMethod,CanadianSupportedTypes) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(carrier.CarrierNum) + ","; } command += "'" + POut.String(carrier.CarrierName) + "'," + "'" + POut.String(carrier.Address) + "'," + "'" + POut.String(carrier.Address2) + "'," + "'" + POut.String(carrier.City) + "'," + "'" + POut.String(carrier.State) + "'," + "'" + POut.String(carrier.Zip) + "'," + "'" + POut.String(carrier.Phone) + "'," + "'" + POut.String(carrier.ElectID) + "'," + POut.Bool(carrier.NoSendElect) + "," + POut.Bool(carrier.IsCDA) + "," + "'" + POut.String(carrier.CDAnetVersion) + "'," + POut.Long(carrier.CanadianNetworkNum) + "," + POut.Bool(carrier.IsHidden) + "," + POut.Byte(carrier.CanadianEncryptionMethod) + "," + POut.Int((int)carrier.CanadianSupportedTypes) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { carrier.CarrierNum = Db.NonQ(command, true); } return(carrier.CarrierNum); }
///<summary>Converts a list of Benefit into a DataTable.</summary> public static DataTable ListToTable(List <Benefit> listBenefits, string tableName = "") { if (string.IsNullOrEmpty(tableName)) { tableName = "Benefit"; } DataTable table = new DataTable(tableName); table.Columns.Add("BenefitNum"); table.Columns.Add("PlanNum"); table.Columns.Add("PatPlanNum"); table.Columns.Add("CovCatNum"); table.Columns.Add("BenefitType"); table.Columns.Add("Percent"); table.Columns.Add("MonetaryAmt"); table.Columns.Add("TimePeriod"); table.Columns.Add("QuantityQualifier"); table.Columns.Add("Quantity"); table.Columns.Add("CodeNum"); table.Columns.Add("CoverageLevel"); table.Columns.Add("SecDateTEntry"); table.Columns.Add("SecDateTEdit"); foreach (Benefit benefit in listBenefits) { table.Rows.Add(new object[] { POut.Long(benefit.BenefitNum), POut.Long(benefit.PlanNum), POut.Long(benefit.PatPlanNum), POut.Long(benefit.CovCatNum), POut.Int((int)benefit.BenefitType), POut.Int(benefit.Percent), POut.Double(benefit.MonetaryAmt), POut.Int((int)benefit.TimePeriod), POut.Int((int)benefit.QuantityQualifier), POut.Byte(benefit.Quantity), POut.Long(benefit.CodeNum), POut.Int((int)benefit.CoverageLevel), POut.DateT(benefit.SecDateTEntry, false), POut.DateT(benefit.SecDateTEdit, false), }); } return(table); }
///<summary>Inserts one ApptView into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(ApptView apptView, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO apptview ("; if (!useExistingPK && isRandomKeys) { apptView.ApptViewNum = ReplicationServers.GetKeyNoCache("apptview", "ApptViewNum"); } if (isRandomKeys || useExistingPK) { command += "ApptViewNum,"; } command += "Description,ItemOrder,RowsPerIncr,OnlyScheduledProvs,OnlySchedBeforeTime,OnlySchedAfterTime,StackBehavUR,StackBehavLR,ClinicNum,ApptTimeScrollStart,IsScrollStartDynamic,IsApptBubblesDisabled,WidthOpMinimum) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(apptView.ApptViewNum) + ","; } command += "'" + POut.String(apptView.Description) + "'," + POut.Int(apptView.ItemOrder) + "," + POut.Byte(apptView.RowsPerIncr) + "," + POut.Bool(apptView.OnlyScheduledProvs) + "," + POut.Time(apptView.OnlySchedBeforeTime) + "," + POut.Time(apptView.OnlySchedAfterTime) + "," + POut.Int((int)apptView.StackBehavUR) + "," + POut.Int((int)apptView.StackBehavLR) + "," + POut.Long(apptView.ClinicNum) + "," + POut.Time(apptView.ApptTimeScrollStart) + "," + POut.Bool(apptView.IsScrollStartDynamic) + "," + POut.Bool(apptView.IsApptBubblesDisabled) + "," + POut.Int(apptView.WidthOpMinimum) + ")"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { apptView.ApptViewNum = Db.NonQ(command, true, "ApptViewNum", "apptView"); } return(apptView.ApptViewNum); }
///<summary>Inserts one Benefit into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(Benefit benefit, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO benefit ("; if (!useExistingPK && isRandomKeys) { benefit.BenefitNum = ReplicationServers.GetKeyNoCache("benefit", "BenefitNum"); } if (isRandomKeys || useExistingPK) { command += "BenefitNum,"; } command += "PlanNum,PatPlanNum,CovCatNum,BenefitType,Percent,MonetaryAmt,TimePeriod,QuantityQualifier,Quantity,CodeNum,CoverageLevel,SecDateTEntry) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(benefit.BenefitNum) + ","; } command += POut.Long(benefit.PlanNum) + "," + POut.Long(benefit.PatPlanNum) + "," + POut.Long(benefit.CovCatNum) + "," + POut.Int((int)benefit.BenefitType) + "," + POut.Int(benefit.Percent) + "," + "'" + POut.Double(benefit.MonetaryAmt) + "'," + POut.Int((int)benefit.TimePeriod) + "," + POut.Int((int)benefit.QuantityQualifier) + "," + POut.Byte(benefit.Quantity) + "," + POut.Long(benefit.CodeNum) + "," + POut.Int((int)benefit.CoverageLevel) + "," + DbHelper.Now() + ")"; //SecDateTEdit can only be set by MySQL if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { benefit.BenefitNum = Db.NonQ(command, true, "BenefitNum", "benefit"); } return(benefit.BenefitNum); }
///<summary>Updates one Dunning in the database.</summary> public static void Update(Dunning dunning) { string command = "UPDATE dunning SET " + "DunMessage = '" + POut.String(dunning.DunMessage) + "', " + "BillingType = " + POut.Long(dunning.BillingType) + ", " + "AgeAccount = " + POut.Byte(dunning.AgeAccount) + ", " + "InsIsPending= " + POut.Int((int)dunning.InsIsPending) + ", " + "MessageBold = '" + POut.String(dunning.MessageBold) + "', " + "EmailSubject= '" + POut.String(dunning.EmailSubject) + "', " + "EmailBody = " + DbHelper.ParamChar + "paramEmailBody " + "WHERE DunningNum = " + POut.Long(dunning.DunningNum); if (dunning.EmailBody == null) { dunning.EmailBody = ""; } OdSqlParameter paramEmailBody = new OdSqlParameter("paramEmailBody", OdDbType.Text, dunning.EmailBody); Db.NonQ(command, paramEmailBody); }
///<summary>Updates one PaySplit in the database.</summary> public static void Update(PaySplit paySplit) { string command = "UPDATE paysplit SET " + "SplitAmt = '" + POut.Double(paySplit.SplitAmt) + "', " + "PatNum = " + POut.Long(paySplit.PatNum) + ", " + "ProcDate = " + POut.Date(paySplit.ProcDate) + ", " + "PayNum = " + POut.Long(paySplit.PayNum) + ", " + "IsDiscount = " + POut.Bool(paySplit.IsDiscount) + ", " + "DiscountType= " + POut.Byte(paySplit.DiscountType) + ", " + "ProvNum = " + POut.Long(paySplit.ProvNum) + ", " + "PayPlanNum = " + POut.Long(paySplit.PayPlanNum) + ", " + "DatePay = " + POut.Date(paySplit.DatePay) + ", " + "ProcNum = " + POut.Long(paySplit.ProcNum) + ", " //DateEntry not allowed to change + "UnearnedType= " + POut.Long(paySplit.UnearnedType) + ", " + "ClinicNum = " + POut.Long(paySplit.ClinicNum) + " " + "WHERE SplitNum = " + POut.Long(paySplit.SplitNum); Db.NonQ(command); }
///<summary>Inserts one Dunning into the database. Provides option to use the existing priKey.</summary> public static long Insert(Dunning dunning, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { dunning.DunningNum = ReplicationServers.GetKey("dunning", "DunningNum"); } string command = "INSERT INTO dunning ("; if (useExistingPK || PrefC.RandomKeys) { command += "DunningNum,"; } command += "DunMessage,BillingType,AgeAccount,InsIsPending,MessageBold,EmailSubject,EmailBody) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(dunning.DunningNum) + ","; } command += "'" + POut.String(dunning.DunMessage) + "'," + POut.Long(dunning.BillingType) + "," + POut.Byte(dunning.AgeAccount) + "," + POut.Int((int)dunning.InsIsPending) + "," + "'" + POut.String(dunning.MessageBold) + "'," + "'" + POut.String(dunning.EmailSubject) + "'," + DbHelper.ParamChar + "paramEmailBody)"; if (dunning.EmailBody == null) { dunning.EmailBody = ""; } OdSqlParameter paramEmailBody = new OdSqlParameter("paramEmailBody", OdDbType.Text, dunning.EmailBody); if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command, paramEmailBody); } else { dunning.DunningNum = Db.NonQ(command, true, paramEmailBody); } return(dunning.DunningNum); }
///<summary>Inserts one SigElementDef into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(SigElementDef sigElementDef, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO sigelementdef ("; if (!useExistingPK && isRandomKeys) { sigElementDef.SigElementDefNum = ReplicationServers.GetKeyNoCache("sigelementdef", "SigElementDefNum"); } if (isRandomKeys || useExistingPK) { command += "SigElementDefNum,"; } command += "LightRow,LightColor,SigElementType,SigText,Sound,ItemOrder) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(sigElementDef.SigElementDefNum) + ","; } command += POut.Byte(sigElementDef.LightRow) + "," + POut.Int(sigElementDef.LightColor.ToArgb()) + "," + POut.Int((int)sigElementDef.SigElementType) + "," + "'" + POut.String(sigElementDef.SigText) + "'," + DbHelper.ParamChar + "paramSound," + POut.Int(sigElementDef.ItemOrder) + ")"; if (sigElementDef.Sound == null) { sigElementDef.Sound = ""; } OdSqlParameter paramSound = new OdSqlParameter("paramSound", OdDbType.Text, POut.StringParam(sigElementDef.Sound)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramSound); } else { sigElementDef.SigElementDefNum = Db.NonQ(command, true, "SigElementDefNum", "sigElementDef", paramSound); } return(sigElementDef.SigElementDefNum); }
///<summary>Inserts one Sheet into the database. Provides option to use the existing priKey.</summary> internal static long Insert(Sheet sheet, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { sheet.SheetNum = ReplicationServers.GetKey("sheet", "SheetNum"); } string command = "INSERT INTO sheet ("; if (useExistingPK || PrefC.RandomKeys) { command += "SheetNum,"; } command += "SheetType,PatNum,DateTimeSheet,FontSize,FontName,Width,Height,IsLandscape,InternalNote,Description,ShowInTerminal,IsWebForm) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(sheet.SheetNum) + ","; } command += POut.Int((int)sheet.SheetType) + "," + POut.Long(sheet.PatNum) + "," + POut.DateT(sheet.DateTimeSheet) + "," + POut.Float(sheet.FontSize) + "," + "'" + POut.String(sheet.FontName) + "'," + POut.Int(sheet.Width) + "," + POut.Int(sheet.Height) + "," + POut.Bool(sheet.IsLandscape) + "," + "'" + POut.String(sheet.InternalNote) + "'," + "'" + POut.String(sheet.Description) + "'," + POut.Byte(sheet.ShowInTerminal) + "," + POut.Bool(sheet.IsWebForm) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { sheet.SheetNum = Db.NonQ(command, true); } return(sheet.SheetNum); }
///<summary>Inserts one SigMessage into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(SigMessage sigMessage, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO sigmessage ("; if (!useExistingPK && isRandomKeys) { sigMessage.SigMessageNum = ReplicationServers.GetKeyNoCache("sigmessage", "SigMessageNum"); } if (isRandomKeys || useExistingPK) { command += "SigMessageNum,"; } command += "ButtonText,ButtonIndex,SynchIcon,FromUser,ToUser,MessageDateTime,AckDateTime,SigText,SigElementDefNumUser,SigElementDefNumExtra,SigElementDefNumMsg) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(sigMessage.SigMessageNum) + ","; } command += "'" + POut.String(sigMessage.ButtonText) + "'," + POut.Int(sigMessage.ButtonIndex) + "," + POut.Byte(sigMessage.SynchIcon) + "," + "'" + POut.String(sigMessage.FromUser) + "'," + "'" + POut.String(sigMessage.ToUser) + "'," + DbHelper.Now() + "," + POut.DateT(sigMessage.AckDateTime) + "," + "'" + POut.String(sigMessage.SigText) + "'," + POut.Long(sigMessage.SigElementDefNumUser) + "," + POut.Long(sigMessage.SigElementDefNumExtra) + "," + POut.Long(sigMessage.SigElementDefNumMsg) + ")"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { sigMessage.SigMessageNum = Db.NonQ(command, true, "SigMessageNum", "sigMessage"); } return(sigMessage.SigMessageNum); }
///<summary>Inserts one EhrMeasureEvent into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(EhrMeasureEvent ehrMeasureEvent, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO ehrmeasureevent ("; if (!useExistingPK && isRandomKeys) { ehrMeasureEvent.EhrMeasureEventNum = ReplicationServers.GetKeyNoCache("ehrmeasureevent", "EhrMeasureEventNum"); } if (isRandomKeys || useExistingPK) { command += "EhrMeasureEventNum,"; } command += "DateTEvent,EventType,PatNum,MoreInfo,CodeValueEvent,CodeSystemEvent,CodeValueResult,CodeSystemResult,FKey,DateStartTobacco,TobaccoCessationDesire) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(ehrMeasureEvent.EhrMeasureEventNum) + ","; } command += POut.DateT(ehrMeasureEvent.DateTEvent) + "," + POut.Int((int)ehrMeasureEvent.EventType) + "," + POut.Long(ehrMeasureEvent.PatNum) + "," + "'" + POut.String(ehrMeasureEvent.MoreInfo) + "'," + "'" + POut.String(ehrMeasureEvent.CodeValueEvent) + "'," + "'" + POut.String(ehrMeasureEvent.CodeSystemEvent) + "'," + "'" + POut.String(ehrMeasureEvent.CodeValueResult) + "'," + "'" + POut.String(ehrMeasureEvent.CodeSystemResult) + "'," + POut.Long(ehrMeasureEvent.FKey) + "," + POut.Date(ehrMeasureEvent.DateStartTobacco) + "," + POut.Byte(ehrMeasureEvent.TobaccoCessationDesire) + ")"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { ehrMeasureEvent.EhrMeasureEventNum = Db.NonQ(command, true, "EhrMeasureEventNum", "ehrMeasureEvent"); } return(ehrMeasureEvent.EhrMeasureEventNum); }
///<summary>Updates one Carrier in the database.</summary> public static void Update(Carrier carrier) { string command = "UPDATE carrier SET " + "CarrierName = '" + POut.String(carrier.CarrierName) + "', " + "Address = '" + POut.String(carrier.Address) + "', " + "Address2 = '" + POut.String(carrier.Address2) + "', " + "City = '" + POut.String(carrier.City) + "', " + "State = '" + POut.String(carrier.State) + "', " + "Zip = '" + POut.String(carrier.Zip) + "', " + "Phone = '" + POut.String(carrier.Phone) + "', " + "ElectID = '" + POut.String(carrier.ElectID) + "', " + "NoSendElect = " + POut.Bool(carrier.NoSendElect) + ", " + "IsCDA = " + POut.Bool(carrier.IsCDA) + ", " + "CDAnetVersion = '" + POut.String(carrier.CDAnetVersion) + "', " + "CanadianNetworkNum = " + POut.Long(carrier.CanadianNetworkNum) + ", " + "IsHidden = " + POut.Bool(carrier.IsHidden) + ", " + "CanadianEncryptionMethod= " + POut.Byte(carrier.CanadianEncryptionMethod) + ", " + "CanadianSupportedTypes = " + POut.Int((int)carrier.CanadianSupportedTypes) + " " + "WHERE CarrierNum = " + POut.Long(carrier.CarrierNum); Db.NonQ(command); }
///<summary>Converts a list of SigMessage into a DataTable.</summary> public static DataTable ListToTable(List <SigMessage> listSigMessages, string tableName = "") { if (string.IsNullOrEmpty(tableName)) { tableName = "SigMessage"; } DataTable table = new DataTable(tableName); table.Columns.Add("SigMessageNum"); table.Columns.Add("ButtonText"); table.Columns.Add("ButtonIndex"); table.Columns.Add("SynchIcon"); table.Columns.Add("FromUser"); table.Columns.Add("ToUser"); table.Columns.Add("MessageDateTime"); table.Columns.Add("AckDateTime"); table.Columns.Add("SigText"); table.Columns.Add("SigElementDefNumUser"); table.Columns.Add("SigElementDefNumExtra"); table.Columns.Add("SigElementDefNumMsg"); foreach (SigMessage sigMessage in listSigMessages) { table.Rows.Add(new object[] { POut.Long(sigMessage.SigMessageNum), sigMessage.ButtonText, POut.Int(sigMessage.ButtonIndex), POut.Byte(sigMessage.SynchIcon), sigMessage.FromUser, sigMessage.ToUser, POut.DateT(sigMessage.MessageDateTime, false), POut.DateT(sigMessage.AckDateTime, false), sigMessage.SigText, POut.Long(sigMessage.SigElementDefNumUser), POut.Long(sigMessage.SigElementDefNumExtra), POut.Long(sigMessage.SigElementDefNumMsg), }); } return(table); }
///<summary>Converts a list of EhrMeasureEvent into a DataTable.</summary> public static DataTable ListToTable(List <EhrMeasureEvent> listEhrMeasureEvents, string tableName = "") { if (string.IsNullOrEmpty(tableName)) { tableName = "EhrMeasureEvent"; } DataTable table = new DataTable(tableName); table.Columns.Add("EhrMeasureEventNum"); table.Columns.Add("DateTEvent"); table.Columns.Add("EventType"); table.Columns.Add("PatNum"); table.Columns.Add("MoreInfo"); table.Columns.Add("CodeValueEvent"); table.Columns.Add("CodeSystemEvent"); table.Columns.Add("CodeValueResult"); table.Columns.Add("CodeSystemResult"); table.Columns.Add("FKey"); table.Columns.Add("DateStartTobacco"); table.Columns.Add("TobaccoCessationDesire"); foreach (EhrMeasureEvent ehrMeasureEvent in listEhrMeasureEvents) { table.Rows.Add(new object[] { POut.Long(ehrMeasureEvent.EhrMeasureEventNum), POut.DateT(ehrMeasureEvent.DateTEvent, false), POut.Int((int)ehrMeasureEvent.EventType), POut.Long(ehrMeasureEvent.PatNum), ehrMeasureEvent.MoreInfo, ehrMeasureEvent.CodeValueEvent, ehrMeasureEvent.CodeSystemEvent, ehrMeasureEvent.CodeValueResult, ehrMeasureEvent.CodeSystemResult, POut.Long(ehrMeasureEvent.FKey), POut.DateT(ehrMeasureEvent.DateStartTobacco, false), POut.Byte(ehrMeasureEvent.TobaccoCessationDesire), }); } return(table); }
///<summary>Inserts one Benefit into the database. Provides option to use the existing priKey.</summary> public static long Insert(Benefit benefit, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { benefit.BenefitNum = ReplicationServers.GetKey("benefit", "BenefitNum"); } string command = "INSERT INTO benefit ("; if (useExistingPK || PrefC.RandomKeys) { command += "BenefitNum,"; } command += "PlanNum,PatPlanNum,CovCatNum,BenefitType,Percent,MonetaryAmt,TimePeriod,QuantityQualifier,Quantity,CodeNum,CoverageLevel) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(benefit.BenefitNum) + ","; } command += POut.Long(benefit.PlanNum) + "," + POut.Long(benefit.PatPlanNum) + "," + POut.Long(benefit.CovCatNum) + "," + POut.Int((int)benefit.BenefitType) + "," + POut.Int(benefit.Percent) + "," + "'" + POut.Double(benefit.MonetaryAmt) + "'," + POut.Int((int)benefit.TimePeriod) + "," + POut.Int((int)benefit.QuantityQualifier) + "," + POut.Byte(benefit.Quantity) + "," + POut.Long(benefit.CodeNum) + "," + POut.Int((int)benefit.CoverageLevel) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { benefit.BenefitNum = Db.NonQ(command, true); } return(benefit.BenefitNum); }
///<summary>Inserts one ApptViewItem into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(ApptViewItem apptViewItem, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO apptviewitem ("; if (!useExistingPK && isRandomKeys) { apptViewItem.ApptViewItemNum = ReplicationServers.GetKeyNoCache("apptviewitem", "ApptViewItemNum"); } if (isRandomKeys || useExistingPK) { command += "ApptViewItemNum,"; } command += "ApptViewNum,OpNum,ProvNum,ElementDesc,ElementOrder,ElementColor,ElementAlignment,ApptFieldDefNum,PatFieldDefNum) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(apptViewItem.ApptViewItemNum) + ","; } command += POut.Long(apptViewItem.ApptViewNum) + "," + POut.Long(apptViewItem.OpNum) + "," + POut.Long(apptViewItem.ProvNum) + "," + "'" + POut.String(apptViewItem.ElementDesc) + "'," + POut.Byte(apptViewItem.ElementOrder) + "," + POut.Int(apptViewItem.ElementColor.ToArgb()) + "," + POut.Int((int)apptViewItem.ElementAlignment) + "," + POut.Long(apptViewItem.ApptFieldDefNum) + "," + POut.Long(apptViewItem.PatFieldDefNum) + ")"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { apptViewItem.ApptViewItemNum = Db.NonQ(command, true, "ApptViewItemNum", "apptViewItem"); } return(apptViewItem.ApptViewItemNum); }
///<summary>Updates one ComputerPref in the database.</summary> internal static void Update(ComputerPref computerPref) { string command = "UPDATE computerpref SET " + "ComputerName = '" + POut.String(computerPref.ComputerName) + "', " + "GraphicsUseHardware = " + POut.Bool(computerPref.GraphicsUseHardware) + ", " + "GraphicsSimple = " + POut.Int((int)computerPref.GraphicsSimple) + ", " + "SensorType = '" + POut.String(computerPref.SensorType) + "', " + "SensorBinned = " + POut.Bool(computerPref.SensorBinned) + ", " + "SensorPort = " + POut.Int(computerPref.SensorPort) + ", " + "SensorExposure = " + POut.Int(computerPref.SensorExposure) + ", " + "GraphicsDoubleBuffering= " + POut.Bool(computerPref.GraphicsDoubleBuffering) + ", " + "PreferredPixelFormatNum= " + POut.Int(computerPref.PreferredPixelFormatNum) + ", " + "AtoZpath = '" + POut.String(computerPref.AtoZpath) + "', " + "TaskKeepListHidden = " + POut.Bool(computerPref.TaskKeepListHidden) + ", " + "TaskDock = " + POut.Int(computerPref.TaskDock) + ", " + "TaskX = " + POut.Int(computerPref.TaskX) + ", " + "TaskY = " + POut.Int(computerPref.TaskY) + ", " + "DirectXFormat = '" + POut.String(computerPref.DirectXFormat) + "', " + "RecentApptView = " + POut.Byte(computerPref.RecentApptView) + " " + "WHERE ComputerPrefNum = " + POut.Long(computerPref.ComputerPrefNum); Db.NonQ(command); }
///<summary>Inserts one PatPlan into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(PatPlan patPlan, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO patplan ("; if (!useExistingPK && isRandomKeys) { patPlan.PatPlanNum = ReplicationServers.GetKeyNoCache("patplan", "PatPlanNum"); } if (isRandomKeys || useExistingPK) { command += "PatPlanNum,"; } command += "PatNum,Ordinal,IsPending,Relationship,PatID,InsSubNum,OrthoAutoFeeBilledOverride,OrthoAutoNextClaimDate) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(patPlan.PatPlanNum) + ","; } command += POut.Long(patPlan.PatNum) + "," + POut.Byte(patPlan.Ordinal) + "," + POut.Bool(patPlan.IsPending) + "," + POut.Int((int)patPlan.Relationship) + "," + "'" + POut.String(patPlan.PatID) + "'," + POut.Long(patPlan.InsSubNum) + "," + "'" + POut.Double(patPlan.OrthoAutoFeeBilledOverride) + "'," + POut.Date(patPlan.OrthoAutoNextClaimDate) + ")"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { patPlan.PatPlanNum = Db.NonQ(command, true, "PatPlanNum", "patPlan"); } return(patPlan.PatPlanNum); }