///<summary>Inserts one SupplyOrder into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(SupplyOrder supplyOrder, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO supplyorder ("; if (!useExistingPK && isRandomKeys) { supplyOrder.SupplyOrderNum = ReplicationServers.GetKeyNoCache("supplyorder", "SupplyOrderNum"); } if (isRandomKeys || useExistingPK) { command += "SupplyOrderNum,"; } command += "SupplierNum,DatePlaced,Note,AmountTotal) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(supplyOrder.SupplyOrderNum) + ","; } command += POut.Long(supplyOrder.SupplierNum) + "," + POut.Date(supplyOrder.DatePlaced) + "," + DbHelper.ParamChar + "paramNote," + "'" + POut.Double(supplyOrder.AmountTotal) + "')"; if (supplyOrder.Note == null) { supplyOrder.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(supplyOrder.Note)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramNote); } else { supplyOrder.SupplyOrderNum = Db.NonQ(command, true, "SupplyOrderNum", "supplyOrder", paramNote); } return(supplyOrder.SupplyOrderNum); }
///<summary>Inserts one PayorType into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(PayorType payorType, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO payortype ("; if (!useExistingPK && isRandomKeys) { payorType.PayorTypeNum = ReplicationServers.GetKeyNoCache("payortype", "PayorTypeNum"); } if (isRandomKeys || useExistingPK) { command += "PayorTypeNum,"; } command += "PatNum,DateStart,SopCode,Note) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(payorType.PayorTypeNum) + ","; } command += POut.Long(payorType.PatNum) + "," + POut.Date(payorType.DateStart) + "," + "'" + POut.String(payorType.SopCode) + "'," + DbHelper.ParamChar + "paramNote)"; if (payorType.Note == null) { payorType.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(payorType.Note)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramNote); } else { payorType.PayorTypeNum = Db.NonQ(command, true, "PayorTypeNum", "payorType", paramNote); } return(payorType.PayorTypeNum); }
///<summary>Inserts one ClaimForm into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(ClaimForm claimForm, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO claimform ("; if (!useExistingPK && isRandomKeys) { claimForm.ClaimFormNum = ReplicationServers.GetKeyNoCache("claimform", "ClaimFormNum"); } if (isRandomKeys || useExistingPK) { command += "ClaimFormNum,"; } command += "Description,IsHidden,FontName,FontSize,UniqueID,PrintImages,OffsetX,OffsetY,Width,Height) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(claimForm.ClaimFormNum) + ","; } command += "'" + POut.String(claimForm.Description) + "'," + POut.Bool(claimForm.IsHidden) + "," + "'" + POut.String(claimForm.FontName) + "'," + POut.Float(claimForm.FontSize) + "," + "'" + POut.String(claimForm.UniqueID) + "'," + POut.Bool(claimForm.PrintImages) + "," + POut.Int(claimForm.OffsetX) + "," + POut.Int(claimForm.OffsetY) + "," + POut.Int(claimForm.Width) + "," + POut.Int(claimForm.Height) + ")"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { claimForm.ClaimFormNum = Db.NonQ(command, true, "ClaimFormNum", "claimForm"); } return(claimForm.ClaimFormNum); }
///<summary>Inserts one EobAttach into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(EobAttach eobAttach, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO eobattach ("; if (!useExistingPK && isRandomKeys) { eobAttach.EobAttachNum = ReplicationServers.GetKeyNoCache("eobattach", "EobAttachNum"); } if (isRandomKeys || useExistingPK) { command += "EobAttachNum,"; } command += "ClaimPaymentNum,DateTCreated,FileName,RawBase64) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(eobAttach.EobAttachNum) + ","; } command += POut.Long(eobAttach.ClaimPaymentNum) + "," + POut.DateT(eobAttach.DateTCreated) + "," + "'" + POut.String(eobAttach.FileName) + "'," + DbHelper.ParamChar + "paramRawBase64)"; if (eobAttach.RawBase64 == null) { eobAttach.RawBase64 = ""; } OdSqlParameter paramRawBase64 = new OdSqlParameter("paramRawBase64", OdDbType.Text, POut.StringParam(eobAttach.RawBase64)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramRawBase64); } else { eobAttach.EobAttachNum = Db.NonQ(command, true, "EobAttachNum", "eobAttach", paramRawBase64); } return(eobAttach.EobAttachNum); }
///<summary>Inserts one TaskNote into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(TaskNote taskNote, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO tasknote ("; if (!useExistingPK && isRandomKeys) { taskNote.TaskNoteNum = ReplicationServers.GetKeyNoCache("tasknote", "TaskNoteNum"); } if (isRandomKeys || useExistingPK) { command += "TaskNoteNum,"; } command += "TaskNum,UserNum,DateTimeNote,Note) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(taskNote.TaskNoteNum) + ","; } command += POut.Long(taskNote.TaskNum) + "," + POut.Long(taskNote.UserNum) + "," + DbHelper.Now() + "," + DbHelper.ParamChar + "paramNote)"; if (taskNote.Note == null) { taskNote.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(taskNote.Note)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramNote); } else { taskNote.TaskNoteNum = Db.NonQ(command, true, "TaskNoteNum", "taskNote", paramNote); } return(taskNote.TaskNoteNum); }
///<summary>Inserts one ProcButton into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(ProcButton procButton, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO procbutton ("; if (!useExistingPK && isRandomKeys) { procButton.ProcButtonNum = ReplicationServers.GetKeyNoCache("procbutton", "ProcButtonNum"); } if (isRandomKeys || useExistingPK) { command += "ProcButtonNum,"; } command += "Description,ItemOrder,Category,ButtonImage) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(procButton.ProcButtonNum) + ","; } command += "'" + POut.String(procButton.Description) + "'," + POut.Int(procButton.ItemOrder) + "," + POut.Long(procButton.Category) + "," + DbHelper.ParamChar + "paramButtonImage)"; if (procButton.ButtonImage == null) { procButton.ButtonImage = ""; } OdSqlParameter paramButtonImage = new OdSqlParameter("paramButtonImage", OdDbType.Text, POut.StringParam(procButton.ButtonImage)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramButtonImage); } else { procButton.ProcButtonNum = Db.NonQ(command, true, "ProcButtonNum", "procButton", paramButtonImage); } return(procButton.ProcButtonNum); }
///<summary>Inserts one CDSPermission into the database. Provides option to use the existing priKey.</summary> public static long Insert(CDSPermission cDSPermission, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { cDSPermission.CDSPermissionNum = ReplicationServers.GetKey("cdspermission", "CDSPermissionNum"); } string command = "INSERT INTO cdspermission ("; if (useExistingPK || PrefC.RandomKeys) { command += "CDSPermissionNum,"; } command += "UserNum,SetupCDS,ShowCDS,ShowInfobutton,EditBibliography,ProblemCDS,MedicationCDS,AllergyCDS,DemographicCDS,LabTestCDS,VitalCDS) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(cDSPermission.CDSPermissionNum) + ","; } command += POut.Long(cDSPermission.UserNum) + "," + POut.Bool(cDSPermission.SetupCDS) + "," + POut.Bool(cDSPermission.ShowCDS) + "," + POut.Bool(cDSPermission.ShowInfobutton) + "," + POut.Bool(cDSPermission.EditBibliography) + "," + POut.Bool(cDSPermission.ProblemCDS) + "," + POut.Bool(cDSPermission.MedicationCDS) + "," + POut.Bool(cDSPermission.AllergyCDS) + "," + POut.Bool(cDSPermission.DemographicCDS) + "," + POut.Bool(cDSPermission.LabTestCDS) + "," + POut.Bool(cDSPermission.VitalCDS) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { cDSPermission.CDSPermissionNum = Db.NonQ(command, true, "CDSPermissionNum", "cDSPermission"); } return(cDSPermission.CDSPermissionNum); }
///<summary>Inserts one WikiPageHist into the database. Provides option to use the existing priKey.</summary> public static long Insert(WikiPageHist wikiPageHist, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { wikiPageHist.WikiPageNum = ReplicationServers.GetKey("wikipagehist", "WikiPageNum"); } string command = "INSERT INTO wikipagehist ("; if (useExistingPK || PrefC.RandomKeys) { command += "WikiPageNum,"; } command += "UserNum,PageTitle,PageContent,DateTimeSaved,IsDeleted) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(wikiPageHist.WikiPageNum) + ","; } command += POut.Long(wikiPageHist.UserNum) + "," + "'" + POut.String(wikiPageHist.PageTitle) + "'," + DbHelper.ParamChar + "paramPageContent," + POut.DateT(wikiPageHist.DateTimeSaved) + "," + POut.Bool(wikiPageHist.IsDeleted) + ")"; if (wikiPageHist.PageContent == null) { wikiPageHist.PageContent = ""; } OdSqlParameter paramPageContent = new OdSqlParameter("paramPageContent", OdDbType.Text, POut.StringParam(wikiPageHist.PageContent)); if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command, paramPageContent); } else { wikiPageHist.WikiPageNum = Db.NonQ(command, true, "WikiPageNum", "wikiPageHist", paramPageContent); } return(wikiPageHist.WikiPageNum); }
///<summary>Inserts one Vitalsign into the database. Provides option to use the existing priKey.</summary> internal static long Insert(Vitalsign vitalsign, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { vitalsign.VitalsignNum = ReplicationServers.GetKey("vitalsign", "VitalsignNum"); } string command = "INSERT INTO vitalsign ("; if (useExistingPK || PrefC.RandomKeys) { command += "VitalsignNum,"; } command += "PatNum,Height,Weight,BpSystolic,BpDiastolic,DateTaken,HasFollowupPlan,IsIneligible,Documentation,ChildGotNutrition,ChildGotPhysCouns) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(vitalsign.VitalsignNum) + ","; } command += POut.Long(vitalsign.PatNum) + "," + POut.Float(vitalsign.Height) + "," + POut.Float(vitalsign.Weight) + "," + POut.Int(vitalsign.BpSystolic) + "," + POut.Int(vitalsign.BpDiastolic) + "," + POut.Date(vitalsign.DateTaken) + "," + POut.Bool(vitalsign.HasFollowupPlan) + "," + POut.Bool(vitalsign.IsIneligible) + "," + "'" + POut.String(vitalsign.Documentation) + "'," + POut.Bool(vitalsign.ChildGotNutrition) + "," + POut.Bool(vitalsign.ChildGotPhysCouns) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { vitalsign.VitalsignNum = Db.NonQ(command, true); } return(vitalsign.VitalsignNum); }
///<summary>Inserts one ProcButton into the database. Provides option to use the existing priKey.</summary> public static long Insert(ProcButton procButton, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { procButton.ProcButtonNum = ReplicationServers.GetKey("procbutton", "ProcButtonNum"); } string command = "INSERT INTO procbutton ("; if (useExistingPK || PrefC.RandomKeys) { command += "ProcButtonNum,"; } command += "Description,ItemOrder,Category,ButtonImage,IsMultiVisit) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(procButton.ProcButtonNum) + ","; } command += "'" + POut.String(procButton.Description) + "'," + POut.Int(procButton.ItemOrder) + "," + POut.Long(procButton.Category) + "," + DbHelper.ParamChar + "paramButtonImage," + POut.Bool(procButton.IsMultiVisit) + ")"; if (procButton.ButtonImage == null) { procButton.ButtonImage = ""; } OdSqlParameter paramButtonImage = new OdSqlParameter("paramButtonImage", OdDbType.Text, POut.StringParam(procButton.ButtonImage)); if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command, paramButtonImage); } else { procButton.ProcButtonNum = Db.NonQ(command, true, "ProcButtonNum", "procButton", paramButtonImage); } return(procButton.ProcButtonNum); }
///<summary>Inserts one EhrLabSpecimen into the database. Provides option to use the existing priKey.</summary> public static long Insert(EhrLabSpecimen ehrLabSpecimen, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { ehrLabSpecimen.EhrLabSpecimenNum = ReplicationServers.GetKey("ehrlabspecimen", "EhrLabSpecimenNum"); } string command = "INSERT INTO ehrlabspecimen ("; if (useExistingPK || PrefC.RandomKeys) { command += "EhrLabSpecimenNum,"; } command += "EhrLabNum,SetIdSPM,SpecimenTypeID,SpecimenTypeText,SpecimenTypeCodeSystemName,SpecimenTypeIDAlt,SpecimenTypeTextAlt,SpecimenTypeCodeSystemNameAlt,SpecimenTypeTextOriginal,CollectionDateTimeStart,CollectionDateTimeEnd) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(ehrLabSpecimen.EhrLabSpecimenNum) + ","; } command += POut.Long(ehrLabSpecimen.EhrLabNum) + "," + POut.Long(ehrLabSpecimen.SetIdSPM) + "," + "'" + POut.String(ehrLabSpecimen.SpecimenTypeID) + "'," + "'" + POut.String(ehrLabSpecimen.SpecimenTypeText) + "'," + "'" + POut.String(ehrLabSpecimen.SpecimenTypeCodeSystemName) + "'," + "'" + POut.String(ehrLabSpecimen.SpecimenTypeIDAlt) + "'," + "'" + POut.String(ehrLabSpecimen.SpecimenTypeTextAlt) + "'," + "'" + POut.String(ehrLabSpecimen.SpecimenTypeCodeSystemNameAlt) + "'," + "'" + POut.String(ehrLabSpecimen.SpecimenTypeTextOriginal) + "'," + "'" + POut.String(ehrLabSpecimen.CollectionDateTimeStart) + "'," + "'" + POut.String(ehrLabSpecimen.CollectionDateTimeEnd) + "')"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { ehrLabSpecimen.EhrLabSpecimenNum = Db.NonQ(command, true); } return(ehrLabSpecimen.EhrLabSpecimenNum); }
///<summary>Inserts one RegistrationKey into the database. Provides option to use the existing priKey.</summary> internal static long Insert(RegistrationKey registrationKey, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { registrationKey.RegistrationKeyNum = ReplicationServers.GetKey("registrationkey", "RegistrationKeyNum"); } string command = "INSERT INTO registrationkey ("; if (useExistingPK || PrefC.RandomKeys) { command += "RegistrationKeyNum,"; } command += "PatNum,RegKey,Note,DateStarted,DateDisabled,DateEnded,IsForeign,UsesServerVersion,IsFreeVersion,IsOnlyForTesting,VotesAllotted) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(registrationKey.RegistrationKeyNum) + ","; } command += POut.Long(registrationKey.PatNum) + "," + "'" + POut.String(registrationKey.RegKey) + "'," + "'" + POut.String(registrationKey.Note) + "'," + POut.Date(registrationKey.DateStarted) + "," + POut.Date(registrationKey.DateDisabled) + "," + POut.Date(registrationKey.DateEnded) + "," + POut.Bool(registrationKey.IsForeign) + "," + POut.Bool(registrationKey.UsesServerVersion) + "," + POut.Bool(registrationKey.IsFreeVersion) + "," + POut.Bool(registrationKey.IsOnlyForTesting) + "," + POut.Int(registrationKey.VotesAllotted) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { registrationKey.RegistrationKeyNum = Db.NonQ(command, true); } return(registrationKey.RegistrationKeyNum); }
///<summary>Inserts one ProviderErx into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(ProviderErx providerErx, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO providererx ("; if (!useExistingPK && isRandomKeys) { providerErx.ProviderErxNum = ReplicationServers.GetKeyNoCache("providererx", "ProviderErxNum"); } if (isRandomKeys || useExistingPK) { command += "ProviderErxNum,"; } command += "PatNum,NationalProviderID,IsEnabled,IsIdentifyProofed,IsSentToHq,IsEpcs,ErxType,UserId,AccountId,RegistrationKeyNum) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(providerErx.ProviderErxNum) + ","; } command += POut.Long(providerErx.PatNum) + "," + "'" + POut.String(providerErx.NationalProviderID) + "'," + POut.Int((int)providerErx.IsEnabled) + "," + POut.Bool(providerErx.IsIdentifyProofed) + "," + POut.Bool(providerErx.IsSentToHq) + "," + POut.Bool(providerErx.IsEpcs) + "," + POut.Int((int)providerErx.ErxType) + "," + "'" + POut.String(providerErx.UserId) + "'," + "'" + POut.String(providerErx.AccountId) + "'," + POut.Long(providerErx.RegistrationKeyNum) + ")"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { providerErx.ProviderErxNum = Db.NonQ(command, true, "ProviderErxNum", "providerErx"); } return(providerErx.ProviderErxNum); }
///<summary>Inserts one Adjustment into the database. Provides option to use the existing priKey.</summary> public static long Insert(Adjustment adjustment, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { adjustment.AdjNum = ReplicationServers.GetKey("adjustment", "AdjNum"); } string command = "INSERT INTO adjustment ("; if (useExistingPK || PrefC.RandomKeys) { command += "AdjNum,"; } command += "AdjDate,AdjAmt,PatNum,AdjType,ProvNum,AdjNote,ProcDate,ProcNum,DateEntry,ClinicNum,StatementNum) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(adjustment.AdjNum) + ","; } command += POut.Date(adjustment.AdjDate) + "," + "'" + POut.Double(adjustment.AdjAmt) + "'," + POut.Long(adjustment.PatNum) + "," + POut.Long(adjustment.AdjType) + "," + POut.Long(adjustment.ProvNum) + "," + "'" + POut.String(adjustment.AdjNote) + "'," + POut.Date(adjustment.ProcDate) + "," + POut.Long(adjustment.ProcNum) + "," + DbHelper.Now() + "," + POut.Long(adjustment.ClinicNum) + "," + POut.Long(adjustment.StatementNum) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { adjustment.AdjNum = Db.NonQ(command, true); } return(adjustment.AdjNum); }
///<summary>Inserts one EhrMeasureEvent into the database. Provides option to use the existing priKey.</summary> public static long Insert(EhrMeasureEvent ehrMeasureEvent, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { ehrMeasureEvent.EhrMeasureEventNum = ReplicationServers.GetKey("ehrmeasureevent", "EhrMeasureEventNum"); } string command = "INSERT INTO ehrmeasureevent ("; if (useExistingPK || PrefC.RandomKeys) { command += "EhrMeasureEventNum,"; } command += "DateTEvent,EventType,PatNum,MoreInfo,CodeValueEvent,CodeSystemEvent,CodeValueResult,CodeSystemResult,FKey,DateStartTobacco,TobaccoCessationDesire) VALUES("; if (useExistingPK || PrefC.RandomKeys) { 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 || PrefC.RandomKeys) { Db.NonQ(command); } else { ehrMeasureEvent.EhrMeasureEventNum = Db.NonQ(command, true, "EhrMeasureEventNum", "ehrMeasureEvent"); } return(ehrMeasureEvent.EhrMeasureEventNum); }
///<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, "BenefitNum", "benefit"); } return(benefit.BenefitNum); }
///<summary>Inserts one DispSupply into the database. Provides option to use the existing priKey.</summary> public static long Insert(DispSupply dispSupply, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { dispSupply.DispSupplyNum = ReplicationServers.GetKey("dispsupply", "DispSupplyNum"); } string command = "INSERT INTO dispsupply ("; if (useExistingPK || PrefC.RandomKeys) { command += "DispSupplyNum,"; } command += "SupplyNum,ProvNum,DateDispensed,DispQuantity,Note) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(dispSupply.DispSupplyNum) + ","; } command += POut.Long(dispSupply.SupplyNum) + "," + POut.Long(dispSupply.ProvNum) + "," + POut.Date(dispSupply.DateDispensed) + "," + POut.Float(dispSupply.DispQuantity) + "," + DbHelper.ParamChar + "paramNote)"; if (dispSupply.Note == null) { dispSupply.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringNote(dispSupply.Note)); if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command, paramNote); } else { dispSupply.DispSupplyNum = Db.NonQ(command, true, "DispSupplyNum", "dispSupply", paramNote); } return(dispSupply.DispSupplyNum); }
///<summary>Inserts one Commlog into the database. Provides option to use the existing priKey.</summary> public static long Insert(Commlog commlog, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { commlog.CommlogNum = ReplicationServers.GetKey("commlog", "CommlogNum"); } string command = "INSERT INTO commlog ("; if (useExistingPK || PrefC.RandomKeys) { command += "CommlogNum,"; } command += "PatNum,CommDateTime,CommType,Note,Mode_,SentOrReceived,UserNum,Signature,SigIsTopaz,DateTimeEnd) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(commlog.CommlogNum) + ","; } command += POut.Long(commlog.PatNum) + "," + POut.DateT(commlog.CommDateTime) + "," + POut.Long(commlog.CommType) + "," + "'" + POut.String(commlog.Note) + "'," + POut.Int((int)commlog.Mode_) + "," + POut.Int((int)commlog.SentOrReceived) + "," + POut.Long(commlog.UserNum) + "," + "'" + POut.String(commlog.Signature) + "'," + POut.Bool(commlog.SigIsTopaz) + "," //DateTStamp can only be set by MySQL + POut.DateT(commlog.DateTimeEnd) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { commlog.CommlogNum = Db.NonQ(command, true); } return(commlog.CommlogNum); }
///<summary>Inserts one SigMessage into the database. Provides option to use the existing priKey.</summary> public static long Insert(SigMessage sigMessage, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { sigMessage.SigMessageNum = ReplicationServers.GetKey("sigmessage", "SigMessageNum"); } string command = "INSERT INTO sigmessage ("; if (useExistingPK || PrefC.RandomKeys) { command += "SigMessageNum,"; } command += "ButtonText,ButtonIndex,SynchIcon,FromUser,ToUser,MessageDateTime,AckDateTime,SigText,SigElementDefNumUser,SigElementDefNumExtra,SigElementDefNumMsg) VALUES("; if (useExistingPK || PrefC.RandomKeys) { 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 || PrefC.RandomKeys) { Db.NonQ(command); } else { sigMessage.SigMessageNum = Db.NonQ(command, true, "SigMessageNum", "sigMessage"); } return(sigMessage.SigMessageNum); }
///<summary>Inserts one EhrSummaryCcd into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(EhrSummaryCcd ehrSummaryCcd, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO ehrsummaryccd ("; if (!useExistingPK && isRandomKeys) { ehrSummaryCcd.EhrSummaryCcdNum = ReplicationServers.GetKeyNoCache("ehrsummaryccd", "EhrSummaryCcdNum"); } if (isRandomKeys || useExistingPK) { command += "EhrSummaryCcdNum,"; } command += "PatNum,DateSummary,ContentSummary,EmailAttachNum) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(ehrSummaryCcd.EhrSummaryCcdNum) + ","; } command += POut.Long(ehrSummaryCcd.PatNum) + "," + POut.Date(ehrSummaryCcd.DateSummary) + "," + DbHelper.ParamChar + "paramContentSummary," + POut.Long(ehrSummaryCcd.EmailAttachNum) + ")"; if (ehrSummaryCcd.ContentSummary == null) { ehrSummaryCcd.ContentSummary = ""; } OdSqlParameter paramContentSummary = new OdSqlParameter("paramContentSummary", OdDbType.Text, POut.StringParam(ehrSummaryCcd.ContentSummary)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramContentSummary); } else { ehrSummaryCcd.EhrSummaryCcdNum = Db.NonQ(command, true, "EhrSummaryCcdNum", "ehrSummaryCcd", paramContentSummary); } return(ehrSummaryCcd.EhrSummaryCcdNum); }
///<summary>Inserts one ProcCodeNote into the database. Provides option to use the existing priKey.</summary> public static long Insert(ProcCodeNote procCodeNote, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { procCodeNote.ProcCodeNoteNum = ReplicationServers.GetKey("proccodenote", "ProcCodeNoteNum"); } string command = "INSERT INTO proccodenote ("; if (useExistingPK || PrefC.RandomKeys) { command += "ProcCodeNoteNum,"; } command += "CodeNum,ProvNum,Note,ProcTime,ProcStatus) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(procCodeNote.ProcCodeNoteNum) + ","; } command += POut.Long(procCodeNote.CodeNum) + "," + POut.Long(procCodeNote.ProvNum) + "," + DbHelper.ParamChar + "paramNote," + "'" + POut.String(procCodeNote.ProcTime) + "'," + POut.Int((int)procCodeNote.ProcStatus) + ")"; if (procCodeNote.Note == null) { procCodeNote.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(procCodeNote.Note)); if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command, paramNote); } else { procCodeNote.ProcCodeNoteNum = Db.NonQ(command, true, "ProcCodeNoteNum", "procCodeNote", paramNote); } return(procCodeNote.ProcCodeNoteNum); }
///<summary>Inserts one PerioMeasure into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(PerioMeasure perioMeasure, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO periomeasure ("; if (!useExistingPK && isRandomKeys) { perioMeasure.PerioMeasureNum = ReplicationServers.GetKeyNoCache("periomeasure", "PerioMeasureNum"); } if (isRandomKeys || useExistingPK) { command += "PerioMeasureNum,"; } command += "PerioExamNum,SequenceType,IntTooth,ToothValue,MBvalue,Bvalue,DBvalue,MLvalue,Lvalue,DLvalue) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(perioMeasure.PerioMeasureNum) + ","; } command += POut.Long(perioMeasure.PerioExamNum) + "," + POut.Int((int)perioMeasure.SequenceType) + "," + POut.Int(perioMeasure.IntTooth) + "," + POut.Int(perioMeasure.ToothValue) + "," + POut.Int(perioMeasure.MBvalue) + "," + POut.Int(perioMeasure.Bvalue) + "," + POut.Int(perioMeasure.DBvalue) + "," + POut.Int(perioMeasure.MLvalue) + "," + POut.Int(perioMeasure.Lvalue) + "," + POut.Int(perioMeasure.DLvalue) + ")"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { perioMeasure.PerioMeasureNum = Db.NonQ(command, true, "PerioMeasureNum", "perioMeasure"); } return(perioMeasure.PerioMeasureNum); }
///<summary>Inserts one Pharmacy into the database. Provides option to use the existing priKey.</summary> internal static long Insert(Pharmacy pharmacy, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { pharmacy.PharmacyNum = ReplicationServers.GetKey("pharmacy", "PharmacyNum"); } string command = "INSERT INTO pharmacy ("; if (useExistingPK || PrefC.RandomKeys) { command += "PharmacyNum,"; } command += "PharmID,StoreName,Phone,Fax,Address,Address2,City,State,Zip,Note) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(pharmacy.PharmacyNum) + ","; } command += "'" + POut.String(pharmacy.PharmID) + "'," + "'" + POut.String(pharmacy.StoreName) + "'," + "'" + POut.String(pharmacy.Phone) + "'," + "'" + POut.String(pharmacy.Fax) + "'," + "'" + POut.String(pharmacy.Address) + "'," + "'" + POut.String(pharmacy.Address2) + "'," + "'" + POut.String(pharmacy.City) + "'," + "'" + POut.String(pharmacy.State) + "'," + "'" + POut.String(pharmacy.Zip) + "'," + "'" + POut.String(pharmacy.Note) + "')"; //DateTStamp can only be set by MySQL if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { pharmacy.PharmacyNum = Db.NonQ(command, true); } return(pharmacy.PharmacyNum); }
///<summary>Inserts one AutoNoteControl into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(AutoNoteControl autoNoteControl, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO autonotecontrol ("; if (!useExistingPK && isRandomKeys) { autoNoteControl.AutoNoteControlNum = ReplicationServers.GetKeyNoCache("autonotecontrol", "AutoNoteControlNum"); } if (isRandomKeys || useExistingPK) { command += "AutoNoteControlNum,"; } command += "Descript,ControlType,ControlLabel,ControlOptions) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(autoNoteControl.AutoNoteControlNum) + ","; } command += "'" + POut.String(autoNoteControl.Descript) + "'," + "'" + POut.String(autoNoteControl.ControlType) + "'," + "'" + POut.String(autoNoteControl.ControlLabel) + "'," + DbHelper.ParamChar + "paramControlOptions)"; if (autoNoteControl.ControlOptions == null) { autoNoteControl.ControlOptions = ""; } OdSqlParameter paramControlOptions = new OdSqlParameter("paramControlOptions", OdDbType.Text, POut.StringParam(autoNoteControl.ControlOptions)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramControlOptions); } else { autoNoteControl.AutoNoteControlNum = Db.NonQ(command, true, "AutoNoteControlNum", "autoNoteControl", paramControlOptions); } return(autoNoteControl.AutoNoteControlNum); }
///<summary>Inserts one WikiListHeaderWidth into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(WikiListHeaderWidth wikiListHeaderWidth, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO wikilistheaderwidth ("; if (!useExistingPK && isRandomKeys) { wikiListHeaderWidth.WikiListHeaderWidthNum = ReplicationServers.GetKeyNoCache("wikilistheaderwidth", "WikiListHeaderWidthNum"); } if (isRandomKeys || useExistingPK) { command += "WikiListHeaderWidthNum,"; } command += "ListName,ColName,ColWidth,PickList) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(wikiListHeaderWidth.WikiListHeaderWidthNum) + ","; } command += "'" + POut.String(wikiListHeaderWidth.ListName) + "'," + "'" + POut.String(wikiListHeaderWidth.ColName) + "'," + POut.Int(wikiListHeaderWidth.ColWidth) + "," + DbHelper.ParamChar + "paramPickList)"; if (wikiListHeaderWidth.PickList == null) { wikiListHeaderWidth.PickList = ""; } OdSqlParameter paramPickList = new OdSqlParameter("paramPickList", OdDbType.Text, POut.StringParam(wikiListHeaderWidth.PickList)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramPickList); } else { wikiListHeaderWidth.WikiListHeaderWidthNum = Db.NonQ(command, true, "WikiListHeaderWidthNum", "wikiListHeaderWidth", paramPickList); } return(wikiListHeaderWidth.WikiListHeaderWidthNum); }
///<summary>Inserts one RefAttach into the database. Provides option to use the existing priKey.</summary> public static long Insert(RefAttach refAttach, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { refAttach.RefAttachNum = ReplicationServers.GetKey("refattach", "RefAttachNum"); } string command = "INSERT INTO refattach ("; if (useExistingPK || PrefC.RandomKeys) { command += "RefAttachNum,"; } command += "ReferralNum,PatNum,ItemOrder,RefDate,IsFrom,RefToStatus,Note,IsTransitionOfCare,ProcNum,DateProcComplete,ProvNum) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(refAttach.RefAttachNum) + ","; } command += POut.Long(refAttach.ReferralNum) + "," + POut.Long(refAttach.PatNum) + "," + POut.Int(refAttach.ItemOrder) + "," + POut.Date(refAttach.RefDate) + "," + POut.Bool(refAttach.IsFrom) + "," + POut.Int((int)refAttach.RefToStatus) + "," + "'" + POut.String(refAttach.Note) + "'," + POut.Bool(refAttach.IsTransitionOfCare) + "," + POut.Long(refAttach.ProcNum) + "," + POut.Date(refAttach.DateProcComplete) + "," + POut.Long(refAttach.ProvNum) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { refAttach.RefAttachNum = Db.NonQ(command, true); } return(refAttach.RefAttachNum); }
///<summary>Inserts one UserOdPref into the database. Provides option to use the existing priKey.</summary> public static long Insert(UserOdPref userOdPref, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { userOdPref.UserOdPrefNum = ReplicationServers.GetKey("userodpref", "UserOdPrefNum"); } string command = "INSERT INTO userodpref ("; if (useExistingPK || PrefC.RandomKeys) { command += "UserOdPrefNum,"; } command += "UserNum,Fkey,FkeyType,ValueString,ClinicNum) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(userOdPref.UserOdPrefNum) + ","; } command += POut.Long(userOdPref.UserNum) + "," + POut.Long(userOdPref.Fkey) + "," + POut.Int((int)userOdPref.FkeyType) + "," + DbHelper.ParamChar + "paramValueString," + POut.Long(userOdPref.ClinicNum) + ")"; if (userOdPref.ValueString == null) { userOdPref.ValueString = ""; } OdSqlParameter paramValueString = new OdSqlParameter("paramValueString", OdDbType.Text, POut.StringParam(userOdPref.ValueString)); if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command, paramValueString); } else { userOdPref.UserOdPrefNum = Db.NonQ(command, true, "UserOdPrefNum", "userOdPref", paramValueString); } return(userOdPref.UserOdPrefNum); }
///<summary>Inserts one DocumentMisc into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(DocumentMisc documentMisc, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO documentmisc ("; if (!useExistingPK && isRandomKeys) { documentMisc.DocMiscNum = ReplicationServers.GetKeyNoCache("documentmisc", "DocMiscNum"); } if (isRandomKeys || useExistingPK) { command += "DocMiscNum,"; } command += "DateCreated,FileName,DocMiscType,RawBase64) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(documentMisc.DocMiscNum) + ","; } command += POut.Date(documentMisc.DateCreated) + "," + "'" + POut.String(documentMisc.FileName) + "'," + POut.Int((int)documentMisc.DocMiscType) + "," + DbHelper.ParamChar + "paramRawBase64)"; if (documentMisc.RawBase64 == null) { documentMisc.RawBase64 = ""; } OdSqlParameter paramRawBase64 = new OdSqlParameter("paramRawBase64", OdDbType.Text, POut.StringParam(documentMisc.RawBase64)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramRawBase64); } else { documentMisc.DocMiscNum = Db.NonQ(command, true, "DocMiscNum", "documentMisc", paramRawBase64); } return(documentMisc.DocMiscNum); }
///<summary>Inserts one QuickPasteNote into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(QuickPasteNote quickPasteNote, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO quickpastenote ("; if (!useExistingPK && isRandomKeys) { quickPasteNote.QuickPasteNoteNum = ReplicationServers.GetKeyNoCache("quickpastenote", "QuickPasteNoteNum"); } if (isRandomKeys || useExistingPK) { command += "QuickPasteNoteNum,"; } command += "QuickPasteCatNum,ItemOrder,Note,Abbreviation) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(quickPasteNote.QuickPasteNoteNum) + ","; } command += POut.Long(quickPasteNote.QuickPasteCatNum) + "," + POut.Int(quickPasteNote.ItemOrder) + "," + DbHelper.ParamChar + "paramNote," + "'" + POut.String(quickPasteNote.Abbreviation) + "')"; if (quickPasteNote.Note == null) { quickPasteNote.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(quickPasteNote.Note)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramNote); } else { quickPasteNote.QuickPasteNoteNum = Db.NonQ(command, true, "QuickPasteNoteNum", "quickPasteNote", paramNote); } return(quickPasteNote.QuickPasteNoteNum); }
///<summary>Inserts one MedicationPat into the database. Provides option to use the existing priKey.</summary> public static long Insert(MedicationPat medicationPat, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { medicationPat.MedicationPatNum = ReplicationServers.GetKey("medicationpat", "MedicationPatNum"); } string command = "INSERT INTO medicationpat ("; if (useExistingPK || PrefC.RandomKeys) { command += "MedicationPatNum,"; } command += "PatNum,MedicationNum,PatNote,DateStart,DateStop,ProvNum,MedDescript,RxCui,NewCropGuid,IsCpoe) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(medicationPat.MedicationPatNum) + ","; } command += POut.Long(medicationPat.PatNum) + "," + POut.Long(medicationPat.MedicationNum) + "," + "'" + POut.String(medicationPat.PatNote) + "'," //DateTStamp can only be set by MySQL + POut.Date(medicationPat.DateStart) + "," + POut.Date(medicationPat.DateStop) + "," + POut.Long(medicationPat.ProvNum) + "," + "'" + POut.String(medicationPat.MedDescript) + "'," + POut.Long(medicationPat.RxCui) + "," + "'" + POut.String(medicationPat.NewCropGuid) + "'," + POut.Bool(medicationPat.IsCpoe) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { medicationPat.MedicationPatNum = Db.NonQ(command, true); } return(medicationPat.MedicationPatNum); }