Exemplo n.º 1
0
        ///<summary>only if ClientWeb</summary>
        public static void FillCache(DataSet ds, params InvalidType[] arrayITypes)
        {
            List <InvalidType> listITypes = arrayITypes.ToList();
            bool isAll = false;

            if (listITypes.Contains(InvalidType.AllLocal))
            {
                isAll = true;
            }
            //All Internal OD Tables that are cached go here
            if (PrefC.IsODHQ)
            {
                if (listITypes.Contains(InvalidType.JobPermission) || isAll)
                {
                    ds.Tables.Add(JobPermissions.RefreshCache());
                }
                if (listITypes.Contains(InvalidType.PhoneComps) || isAll)
                {
                    PhoneComps.FillCacheFromTable(ds.Tables["PhoneComp"]);
                }
            }
            if (listITypes.Contains(InvalidType.AccountingAutoPays) || isAll)
            {
                AccountingAutoPays.FillCacheFromTable(ds.Tables["AccountingAutoPay"]);
            }
            //if(listITypes.Contains(InvalidType.AlertItems) || isAll) {//THIS IS NOT CACHED. But is used to make server run the alert logic in OpenDentalService.
            //	AlertSubs.FillCache(ds.Tables["AlertItem"]);
            //}
            if (listITypes.Contains(InvalidType.AlertCategories) || isAll)
            {
                AlertCategories.FillCacheFromTable(ds.Tables["AlertCategory"]);
            }
            if (listITypes.Contains(InvalidType.AlertCategoryLinks) || isAll)
            {
                AlertCategoryLinks.FillCacheFromTable(ds.Tables["AlertCategoryLink"]);
            }
            if (listITypes.Contains(InvalidType.AppointmentTypes) || isAll)
            {
                AppointmentTypes.FillCacheFromTable(ds.Tables["AppointmentType"]);
            }
            if (listITypes.Contains(InvalidType.AutoCodes) || isAll)
            {
                AutoCodes.FillCacheFromTable(ds.Tables["AutoCode"]);
                AutoCodeItems.FillCacheFromTable(ds.Tables["AutoCodeItem"]);
                AutoCodeConds.FillCacheFromTable(ds.Tables["AutoCodeCond"]);
            }
            if (listITypes.Contains(InvalidType.Automation) || isAll)
            {
                Automations.FillCacheFromTable(ds.Tables["Automation"]);
            }
            if (listITypes.Contains(InvalidType.AutoNotes) || isAll)
            {
                AutoNotes.FillCacheFromTable(ds.Tables["AutoNote"]);
                AutoNoteControls.FillCacheFromTable(ds.Tables["AutoNoteControl"]);
            }
            if (listITypes.Contains(InvalidType.Carriers) || isAll)
            {
                Carriers.FillCacheFromTable(ds.Tables["Carrier"]);                //run on startup, after telephone reformat, after list edit.
            }
            if (listITypes.Contains(InvalidType.ClaimForms) || isAll)
            {
                ClaimFormItems.FillCacheFromTable(ds.Tables["ClaimFormItem"]);
                ClaimForms.FillCacheFromTable(ds.Tables["ClaimForm"]);
            }
            if (listITypes.Contains(InvalidType.ClearHouses) || isAll)
            {
                Clearinghouses.FillCacheFromTable(ds.Tables["Clearinghouse"]);
            }
            if (listITypes.Contains(InvalidType.ClinicErxs) || isAll)
            {
                ClinicErxs.FillCacheFromTable(ds.Tables["ClinicErx"]);
            }
            if (listITypes.Contains(InvalidType.ClinicPrefs) || isAll)
            {
                ClinicPrefs.FillCacheFromTable(ds.Tables["ClinicPref"]);
            }
            if (listITypes.Contains(InvalidType.Computers) || isAll)
            {
                Computers.FillCacheFromTable(ds.Tables["Computer"]);
                Printers.FillCacheFromTable(ds.Tables["Printer"]);
            }
            if (listITypes.Contains(InvalidType.Defs) || isAll)
            {
                Defs.FillCacheFromTable(ds.Tables["Def"]);
            }
            if (listITypes.Contains(InvalidType.DentalSchools) || isAll)
            {
                SchoolClasses.FillCacheFromTable(ds.Tables["SchoolClass"]);
                SchoolCourses.FillCacheFromTable(ds.Tables["SchoolCourse"]);
            }
            if (listITypes.Contains(InvalidType.DictCustoms) || isAll)
            {
                DictCustoms.FillCacheFromTable(ds.Tables["DictCustom"]);
            }
            if (listITypes.Contains(InvalidType.Diseases) || isAll)
            {
                DiseaseDefs.FillCacheFromTable(ds.Tables["DiseaseDef"]);
                ICD9s.FillCacheFromTable(ds.Tables["ICD9"]);
            }
            if (listITypes.Contains(InvalidType.DisplayFields) || isAll)
            {
                DisplayFields.FillCacheFromTable(ds.Tables["DisplayField"]);
            }
            if (listITypes.Contains(InvalidType.DisplayReports) || isAll)
            {
                DisplayReports.FillCacheFromTable(ds.Tables["DisplayReport"]);
            }
            if (listITypes.Contains(InvalidType.Ebills) || isAll)
            {
                Ebills.FillCacheFromTable(ds.Tables["Ebill"]);
            }
            if (listITypes.Contains(InvalidType.ElectIDs) || isAll)
            {
                ElectIDs.FillCacheFromTable(ds.Tables["ElectID"]);
            }
            if (listITypes.Contains(InvalidType.Email) || isAll)
            {
                EmailAddresses.FillCacheFromTable(ds.Tables["EmailAddress"]);
                EmailTemplates.FillCacheFromTable(ds.Tables["EmailTemplate"]);
            }
            if (listITypes.Contains(InvalidType.Employees) || isAll)
            {
                Employees.FillCacheFromTable(ds.Tables["Employee"]);
                PayPeriods.FillCacheFromTable(ds.Tables["PayPeriod"]);
            }
            if (listITypes.Contains(InvalidType.Employers) || isAll)
            {
                Employers.FillCacheFromTable(ds.Tables["Employer"]);
            }
            if (listITypes.Contains(InvalidType.Fees) || isAll)
            {
                Fees.FillCacheFromTable(ds.Tables["Fee"]);
            }
            if (listITypes.Contains(InvalidType.FeeScheds) || isAll)
            {
                FeeScheds.FillCacheFromTable(ds.Tables["FeeSched"]);
            }
            if (listITypes.Contains(InvalidType.HL7Defs) || isAll)
            {
                HL7Defs.FillCacheFromTable(ds.Tables["HL7Def"]);
                HL7DefMessages.FillCacheFromTable(ds.Tables["HL7DefMessage"]);
                HL7DefSegments.FillCacheFromTable(ds.Tables["HL7DefSegment"]);
                HL7DefFields.FillCacheFromTable(ds.Tables["HL7DefField"]);
            }
            if (listITypes.Contains(InvalidType.InsCats) || isAll)
            {
                CovCats.FillCacheFromTable(ds.Tables["CovCat"]);
                CovSpans.FillCacheFromTable(ds.Tables["CovSpan"]);
            }
            if (listITypes.Contains(InvalidType.InsFilingCodes) || isAll)
            {
                InsFilingCodes.FillCacheFromTable(ds.Tables["InsFilingCode"]);
                InsFilingCodeSubtypes.FillCacheFromTable(ds.Tables["InsFilingCodeSubtype"]);
            }
            if (listITypes.Contains(InvalidType.Languages) || isAll)
            {
                Lans.FillCacheFromTable(ds.Tables["Language"]);
            }
            if (listITypes.Contains(InvalidType.Letters) || isAll)
            {
                Letters.FillCacheFromTable(ds.Tables["Letter"]);
            }
            if (listITypes.Contains(InvalidType.LetterMerge) || isAll)
            {
                LetterMergeFields.FillCacheFromTable(ds.Tables["LetterMergeField"]);
                LetterMerges.FillCacheFromTable(ds.Tables["LetterMerge"]);
            }
            if (listITypes.Contains(InvalidType.Medications) || isAll)
            {
                Medications.FillCacheFromTable(ds.Tables["Medication"]);
            }
            if (listITypes.Contains(InvalidType.Operatories) || isAll)
            {
                Operatories.FillCacheFromTable(ds.Tables["Operatory"]);
            }
            if (listITypes.Contains(InvalidType.OrthoChartTabs) || isAll)
            {
                OrthoChartTabs.FillCacheFromTable(ds.Tables["OrthoChartTab"]);
                OrthoChartTabLinks.FillCacheFromTable(ds.Tables["OrthoChartTabLink"]);
            }
            if (listITypes.Contains(InvalidType.PatFields) || isAll)
            {
                PatFieldDefs.FillCacheFromTable(ds.Tables["PatFieldDef"]);
                ApptFieldDefs.FillCacheFromTable(ds.Tables["ApptFieldDef"]);
            }
            if (listITypes.Contains(InvalidType.Pharmacies) || isAll)
            {
                Pharmacies.FillCacheFromTable(ds.Tables["Pharmacy"]);
            }
            if (listITypes.Contains(InvalidType.Prefs) || isAll)
            {
                Prefs.FillCacheFromTable(ds.Tables["Pref"]);
            }
            if (listITypes.Contains(InvalidType.ProcButtons) || isAll)
            {
                ProcButtons.FillCacheFromTable(ds.Tables["ProcButton"]);
                ProcButtonItems.FillCacheFromTable(ds.Tables["ProcButtonItem"]);
            }
            if (listITypes.Contains(InvalidType.ProcCodes) || isAll)
            {
                ProcedureCodes.FillCacheFromTable(ds.Tables["ProcedureCode"]);
                ProcCodeNotes.FillCacheFromTable(ds.Tables["ProcCodeNote"]);
            }
            if (listITypes.Contains(InvalidType.Programs) || isAll)
            {
                Programs.FillCacheFromTable(ds.Tables["Program"]);
                ProgramProperties.FillCacheFromTable(ds.Tables["ProgramProperty"]);
            }
            if (listITypes.Contains(InvalidType.ProviderErxs) || isAll)
            {
                ProviderErxs.FillCacheFromTable(ds.Tables["ProviderErx"]);
            }
            if (listITypes.Contains(InvalidType.ProviderIdents) || isAll)
            {
                ProviderIdents.FillCacheFromTable(ds.Tables["ProviderIdent"]);
            }
            if (listITypes.Contains(InvalidType.Providers) || isAll)
            {
                Providers.FillCacheFromTable(ds.Tables["Provider"]);
                //Refresh the clinics as well because InvalidType.Providers has a comment that says "also includes clinics".  Also, there currently isn't an itype for Clinics.
                Clinics.FillCacheFromTable(ds.Tables["clinic"]);                //Case must match the table name in Clinics.RefrechCache().
            }
            if (listITypes.Contains(InvalidType.QuickPaste) || isAll)
            {
                QuickPasteNotes.FillCacheFromTable(ds.Tables["QuickPasteNote"]);
                QuickPasteCats.FillCacheFromTable(ds.Tables["QuickPasteCat"]);
            }
            if (listITypes.Contains(InvalidType.RecallTypes) || isAll)
            {
                RecallTypes.FillCacheFromTable(ds.Tables["RecallType"]);
                RecallTriggers.FillCacheFromTable(ds.Tables["RecallTrigger"]);
            }
            if (listITypes.Contains(InvalidType.ReplicationServers) || isAll)
            {
                ReplicationServers.FillCacheFromTable(ds.Tables["ReplicationServer"]);
            }
            //if(itypes.Contains(InvalidType.RequiredFields) || isAll) {
            //	RequiredFields.FillCache(ds.Tables["RequiredField"]);
            //}
            if (listITypes.Contains(InvalidType.Security) || isAll)
            {
                Userods.FillCacheFromTable(ds.Tables["Userod"]);
                UserGroups.FillCacheFromTable(ds.Tables["UserGroup"]);
                UserGroupAttaches.FillCacheFromTable(ds.Tables["UserGroupAttach"]);
            }
            if (listITypes.Contains(InvalidType.Sheets) || isAll)
            {
                SheetDefs.FillCacheFromTable(ds.Tables["SheetDef"]);
                SheetFieldDefs.FillCacheFromTable(ds.Tables["SheetFieldDef"]);
            }
            if (listITypes.Contains(InvalidType.SigMessages) || isAll)
            {
                SigElementDefs.FillCacheFromTable(ds.Tables["SigElementDef"]);
                SigButDefs.FillCacheFromTable(ds.Tables["SigButDef"]);
            }
            if (listITypes.Contains(InvalidType.Sites) || isAll)
            {
                Sites.FillCacheFromTable(ds.Tables["Site"]);
                if (PrefC.IsODHQ)
                {
                    SiteLinks.FillCacheFromTable(ds.Tables["SiteLink"]);
                }
            }
            if (listITypes.Contains(InvalidType.SmsBlockPhones) || isAll)
            {
                SmsBlockPhones.FillCacheFromTable(ds.Tables["SmsBlockPhone"]);
            }
            if (listITypes.Contains(InvalidType.SmsPhones) || isAll)
            {
                SmsPhones.FillCacheFromTable(ds.Tables["SmsPhone"]);
            }
            if (listITypes.Contains(InvalidType.Sops) || isAll)
            {
                Sops.FillCacheFromTable(ds.Tables["Sop"]);
            }
            if (listITypes.Contains(InvalidType.StateAbbrs) || isAll)
            {
                StateAbbrs.FillCacheFromTable(ds.Tables["StateAbbr"]);
            }
            if (listITypes.Contains(InvalidType.TimeCardRules) || isAll)
            {
                TimeCardRules.FillCacheFromTable(ds.Tables["TimeCardRule"]);
            }
            //InvalidTypes.Tasks not handled here.
            if (listITypes.Contains(InvalidType.ToolBut) || isAll)
            {
                ToolButItems.FillCacheFromTable(ds.Tables["ToolButItem"]);
            }
            if (listITypes.Contains(InvalidType.UserClinics) || isAll)
            {
                UserClinics.FillCacheFromTable(ds.Tables["UserClinic"]);
            }
            if (listITypes.Contains(InvalidType.UserQueries) || isAll)
            {
                UserQueries.FillCacheFromTable(ds.Tables["UserQuery"]);
            }
            if (listITypes.Contains(InvalidType.Vaccines) || isAll)
            {
                VaccineDefs.FillCacheFromTable(ds.Tables["VaccineDef"]);
                DrugManufacturers.FillCacheFromTable(ds.Tables["DrugManufacturer"]);
                DrugUnits.FillCacheFromTable(ds.Tables["DrugUnit"]);
            }
            if (listITypes.Contains(InvalidType.Views) || isAll)
            {
                ApptViews.FillCacheFromTable(ds.Tables["ApptView"]);
                ApptViewItems.FillCacheFromTable(ds.Tables["ApptViewItem"]);
                AppointmentRules.FillCacheFromTable(ds.Tables["AppointmentRule"]);
                ProcApptColors.FillCacheFromTable(ds.Tables["ProcApptColor"]);
            }
            if (listITypes.Contains(InvalidType.Wiki) || isAll)
            {
                WikiListHeaderWidths.FillCacheFromTable(ds.Tables["WikiListHeaderWidth"]);
                WikiPages.FillCache(ds.Tables["WikiPage"]);
            }
            if (listITypes.Contains(InvalidType.ZipCodes) || isAll)
            {
                ZipCodes.FillCacheFromTable(ds.Tables["ZipCode"]);
            }
        }
Exemplo n.º 2
0
        ///<summary>If ClientWeb, then this method is instead run on the server, and the result passed back to the client.  And since it's ClientWeb, FillCache will be run on the client.</summary>
        public static DataSet GetCacheDs(bool doRefreshServerCache, params InvalidType[] arrayITypes)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetDS(MethodBase.GetCurrentMethod(), doRefreshServerCache, arrayITypes));
            }
            Logger.LogToPath("", LogPath.Signals, LogPhase.Start, "InvalidType(s): " + string.Join(" - ", arrayITypes.OrderBy(x => x.ToString())));
            List <InvalidType> listITypes = arrayITypes.ToList();
            //so this part below only happens if direct or server------------------------------------------------
            bool isAll = false;

            if (listITypes.Contains(InvalidType.AllLocal))
            {
                isAll = true;
            }
            DataSet ds = new DataSet();

            //All Internal OD Tables that are cached go here
            if (PrefC.IsODHQ)
            {
                if (listITypes.Contains(InvalidType.JobPermission) || isAll)
                {
                    ds.Tables.Add(JobPermissions.RefreshCache());
                }
                if (listITypes.Contains(InvalidType.PhoneComps) || isAll)
                {
                    ds.Tables.Add(PhoneComps.GetTableFromCache(doRefreshServerCache));
                }
            }
            //All cached public tables go here
            if (listITypes.Contains(InvalidType.AccountingAutoPays) || isAll)
            {
                ds.Tables.Add(AccountingAutoPays.GetTableFromCache(doRefreshServerCache));
            }
            //if(listITypes.Contains(InvalidType.AlertItems) || isAll) {//THIS IS NOT CACHED. But is used to make server run the alert logic in OpenDentalService.
            //	ds.Tables.Add(AlertItems.RefreshCache());
            //}
            if (listITypes.Contains(InvalidType.AlertCategories) || isAll)
            {
                ds.Tables.Add(AlertCategories.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.AlertCategoryLinks) || isAll)
            {
                ds.Tables.Add(AlertCategoryLinks.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.AppointmentTypes) || isAll)
            {
                ds.Tables.Add(AppointmentTypes.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.AutoCodes) || isAll)
            {
                ds.Tables.Add(AutoCodes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(AutoCodeItems.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(AutoCodeConds.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Automation) || isAll)
            {
                ds.Tables.Add(Automations.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.AutoNotes) || isAll)
            {
                ds.Tables.Add(AutoNotes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(AutoNoteControls.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Carriers) || isAll)
            {
                ds.Tables.Add(Carriers.GetTableFromCache(doRefreshServerCache));                //run on startup, after telephone reformat, after list edit.
            }
            if (listITypes.Contains(InvalidType.ClaimForms) || isAll)
            {
                ds.Tables.Add(ClaimFormItems.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ClaimForms.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ClearHouses) || isAll)
            {
                ds.Tables.Add(Clearinghouses.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ClinicErxs) || isAll)
            {
                ds.Tables.Add(ClinicErxs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ClinicPrefs) || isAll)
            {
                ds.Tables.Add(ClinicPrefs.GetTableFromCache(doRefreshServerCache));
            }
            //InvalidType.Clinics see InvalidType.Providers
            if (listITypes.Contains(InvalidType.Computers) || isAll)
            {
                ds.Tables.Add(Computers.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(Printers.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Defs) || isAll)
            {
                ds.Tables.Add(Defs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.DentalSchools) || isAll)
            {
                ds.Tables.Add(SchoolClasses.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(SchoolCourses.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.DictCustoms) || isAll)
            {
                ds.Tables.Add(DictCustoms.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Diseases) || isAll)
            {
                ds.Tables.Add(DiseaseDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ICD9s.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.DisplayFields) || isAll)
            {
                ds.Tables.Add(DisplayFields.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.DisplayReports) || isAll)
            {
                ds.Tables.Add(DisplayReports.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Ebills) || isAll)
            {
                ds.Tables.Add(Ebills.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.EhrCodes))
            {
                EhrCodes.UpdateList();                //Unusual pattern for an unusual "table".  Not really a table, but a mishmash of hard coded partial code systems that are needed for CQMs.
            }
            if (listITypes.Contains(InvalidType.ElectIDs) || isAll)
            {
                ds.Tables.Add(ElectIDs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Email) || isAll)
            {
                ds.Tables.Add(EmailAddresses.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(EmailTemplates.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(EmailAutographs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Employees) || isAll)
            {
                ds.Tables.Add(Employees.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(PayPeriods.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Employers) || isAll)
            {
                ds.Tables.Add(Employers.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Fees) || isAll)
            {
                //Fee Cache follows an unusual pattern. This fills the cache with the HQ fees, and whatever clinics happen to be currently cached.
                ds.Tables.Add(Fees.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.FeeScheds) || isAll)
            {
                ds.Tables.Add(FeeScheds.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.HL7Defs) || isAll)
            {
                ds.Tables.Add(HL7Defs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(HL7DefMessages.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(HL7DefSegments.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(HL7DefFields.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.InsCats) || isAll)
            {
                ds.Tables.Add(CovCats.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(CovSpans.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.InsFilingCodes) || isAll)
            {
                ds.Tables.Add(InsFilingCodes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(InsFilingCodeSubtypes.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Languages) || isAll)
            {
                if (CultureInfo.CurrentCulture.Name != "en-US")
                {
                    ds.Tables.Add(Lans.GetTableFromCache(doRefreshServerCache));
                }
            }
            if (listITypes.Contains(InvalidType.Letters) || isAll)
            {
                ds.Tables.Add(Letters.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.LetterMerge) || isAll)
            {
                ds.Tables.Add(LetterMergeFields.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(LetterMerges.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Medications) || isAll)
            {
                ds.Tables.Add(Medications.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Operatories) || isAll)
            {
                ds.Tables.Add(Operatories.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.OrthoChartTabs) || isAll)
            {
                ds.Tables.Add(OrthoChartTabs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(OrthoChartTabLinks.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.PatFields) || isAll)
            {
                ds.Tables.Add(PatFieldDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ApptFieldDefs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Pharmacies) || isAll)
            {
                ds.Tables.Add(Pharmacies.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Prefs) || isAll)
            {
                ds.Tables.Add(Prefs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ProcButtons) || isAll)
            {
                ds.Tables.Add(ProcButtons.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ProcButtonItems.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ProcCodes) || isAll)
            {
                ds.Tables.Add(ProcedureCodes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ProcCodeNotes.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Programs) || isAll)
            {
                ds.Tables.Add(Programs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ProgramProperties.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ProviderErxs) || isAll)
            {
                ds.Tables.Add(ProviderErxs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ProviderIdents) || isAll)
            {
                ds.Tables.Add(ProviderIdents.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Providers) || isAll)
            {
                ds.Tables.Add(Providers.GetTableFromCache(doRefreshServerCache));
                //Refresh the clinics as well because InvalidType.Providers has a comment that says "also includes clinics".  Also, there currently isn't an itype for Clinics.
                ds.Tables.Add(Clinics.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.QuickPaste) || isAll)
            {
                ds.Tables.Add(QuickPasteNotes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(QuickPasteCats.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.RecallTypes) || isAll)
            {
                ds.Tables.Add(RecallTypes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(RecallTriggers.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ReplicationServers) || isAll)
            {
                ds.Tables.Add(ReplicationServers.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.RequiredFields) || isAll)
            {
                ds.Tables.Add(RequiredFields.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(RequiredFieldConditions.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Security) || isAll)
            {
                ds.Tables.Add(Userods.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(UserGroups.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(GroupPermissions.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(UserGroupAttaches.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Sheets) || isAll)
            {
                ds.Tables.Add(SheetDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(SheetFieldDefs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.SigMessages) || isAll)
            {
                ds.Tables.Add(SigElementDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(SigButDefs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Sites) || isAll)
            {
                ds.Tables.Add(Sites.GetTableFromCache(doRefreshServerCache));
                if (PrefC.IsODHQ)
                {
                    ds.Tables.Add(SiteLinks.GetTableFromCache(doRefreshServerCache));
                }
            }
            if (listITypes.Contains(InvalidType.SmsBlockPhones) || isAll)
            {
                ds.Tables.Add(SmsBlockPhones.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.SmsPhones) || isAll)
            {
                ds.Tables.Add(SmsPhones.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Sops) || isAll)               //InvalidType.Sops is currently never used 11/14/2014
            {
                ds.Tables.Add(Sops.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.StateAbbrs) || isAll)
            {
                ds.Tables.Add(StateAbbrs.GetTableFromCache(doRefreshServerCache));
            }
            //InvalidTypes.Tasks not handled here.
            if (listITypes.Contains(InvalidType.TimeCardRules) || isAll)
            {
                ds.Tables.Add(TimeCardRules.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ToolBut) || isAll)
            {
                ds.Tables.Add(ToolButItems.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.UserClinics) || isAll)
            {
                ds.Tables.Add(UserClinics.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.UserQueries) || isAll)
            {
                ds.Tables.Add(UserQueries.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Vaccines) || isAll)
            {
                ds.Tables.Add(VaccineDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(DrugManufacturers.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(DrugUnits.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Views) || isAll)
            {
                ds.Tables.Add(ApptViews.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ApptViewItems.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(AppointmentRules.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ProcApptColors.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Wiki) || isAll)
            {
                ds.Tables.Add(WikiListHeaderWidths.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(WikiPages.RefreshCache());
            }
            if (listITypes.Contains(InvalidType.ZipCodes) || isAll)
            {
                ds.Tables.Add(ZipCodes.GetTableFromCache(doRefreshServerCache));
            }
            Logger.LogToPath("", LogPath.Signals, LogPhase.End);
            return(ds);
        }
Exemplo n.º 3
0
 protected override void FillCacheIfNeeded()
 {
     Medications.GetTableFromCache(false);
 }
Exemplo n.º 4
0
        public static List <ReminderRule> GetRemindersForPatient(Patient PatCur)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <ReminderRule> >(MethodBase.GetCurrentMethod(), PatCur));
            }
            //Problem,Medication,Allergy,Age,Gender,LabResult
            List <ReminderRule> fullListReminders = Crud.ReminderRuleCrud.SelectMany("SELECT * FROM reminderrule");
            List <ReminderRule> retVal            = new List <ReminderRule>();
            List <Disease>      listProblems      = Diseases.Refresh(PatCur.PatNum);
            List <Medication>   listMedications   = Medications.GetMedicationsByPat(PatCur.PatNum);
            List <Allergy>      listAllergies     = Allergies.Refresh(PatCur.PatNum);
            List <LabResult>    listLabResults    = LabResults.GetAllForPatient(PatCur.PatNum);

            for (int i = 0; i < fullListReminders.Count; i++)
            {
                switch (fullListReminders[i].ReminderCriterion)
                {
                case EhrCriterion.Problem:
                    for (int j = 0; j < listProblems.Count; j++)
                    {
                        if (fullListReminders[i].CriterionFK == listProblems[j].DiseaseDefNum)
                        {
                            retVal.Add(fullListReminders[i]);
                            break;
                        }
                    }
                    break;

                case EhrCriterion.Medication:
                    for (int j = 0; j < listMedications.Count; j++)
                    {
                        if (fullListReminders[i].CriterionFK == listMedications[j].MedicationNum)
                        {
                            retVal.Add(fullListReminders[i]);
                            break;
                        }
                    }
                    break;

                case EhrCriterion.Allergy:
                    for (int j = 0; j < listAllergies.Count; j++)
                    {
                        if (fullListReminders[i].CriterionFK == listAllergies[j].AllergyDefNum)
                        {
                            retVal.Add(fullListReminders[i]);
                            break;
                        }
                    }
                    break;

                case EhrCriterion.Age:
                    if (fullListReminders[i].CriterionValue[0] == '<')
                    {
                        if (PatCur.Age < int.Parse(fullListReminders[i].CriterionValue.Substring(1, fullListReminders[i].CriterionValue.Length - 1)))
                        {
                            retVal.Add(fullListReminders[i]);
                        }
                    }
                    else if (fullListReminders[i].CriterionValue[0] == '>')
                    {
                        if (PatCur.Age > int.Parse(fullListReminders[i].CriterionValue.Substring(1, fullListReminders[i].CriterionValue.Length - 1)))
                        {
                            retVal.Add(fullListReminders[i]);
                        }
                    }
                    else
                    {
                        //This section should never be reached
                    }
                    break;

                case EhrCriterion.Gender:
                    if (PatCur.Gender.ToString().ToLower() == fullListReminders[i].CriterionValue.ToLower())
                    {
                        retVal.Add(fullListReminders[i]);
                    }
                    break;

                case EhrCriterion.LabResult:
                    for (int j = 0; j < listLabResults.Count; j++)
                    {
                        if (listLabResults[j].TestName.ToLower().Contains(fullListReminders[i].CriterionValue.ToLower()))
                        {
                            retVal.Add(fullListReminders[i]);
                            break;
                        }
                    }
                    break;
                    //case EhrCriterion.ICD9:
                    //  for(int j=0;j<listProblems.Count;j++) {
                    //    if(fullListReminders[i].CriterionFK==listProblems[j].DiseaseDefNum) {
                    //      retVal.Add(fullListReminders[i]);
                    //      break;
                    //    }
                    //  }
                    //  break;
                }
            }
            return(retVal);
        }
Exemplo n.º 5
0
        ///<summary></summary>
        public static List <EduResource> GenerateForPatient(long patNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <EduResource> >(MethodBase.GetCurrentMethod(), patNum));
            }
            List <Disease>         diseaseList        = Diseases.Refresh(patNum);
            List <MedicationPat>   medicationPatList  = MedicationPats.Refresh(patNum, false);
            List <LabResult>       labResultList      = LabResults.GetAllForPatient(patNum);
            List <EhrLabResult>    listEhrLabResults  = EhrLabResults.GetAllForPatient(patNum);
            List <EduResource>     eduResourceListAll = Crud.EduResourceCrud.SelectMany("SELECT * FROM eduresource");
            List <EhrMeasureEvent> listTobaccoEvents  = EhrMeasureEvents.RefreshByType(patNum, EhrMeasureEventType.TobaccoUseAssessed)
                                                        .FindAll(x => x.CodeSystemResult == "SNOMEDCT");
            List <EduResource> retVal = new List <EduResource>();

            eduResourceListAll.FindAll(x => x.DiseaseDefNum != 0 && diseaseList.Any(y => y.DiseaseDefNum == x.DiseaseDefNum)).ForEach(x => retVal.Add(x));
            eduResourceListAll.FindAll(x => x.MedicationNum != 0 &&
                                       medicationPatList.Any(y => y.MedicationNum == x.MedicationNum ||
                                                             (y.MedicationNum == 0 && Medications.GetMedication(x.MedicationNum).RxCui == y.RxCui)))
            .ForEach(x => retVal.Add(x));
            eduResourceListAll.FindAll(x => x.SmokingSnoMed != "" && listTobaccoEvents.Any(y => y.CodeValueResult == x.SmokingSnoMed)).ForEach(x => retVal.Add(x));
            foreach (EduResource resourceCur in eduResourceListAll.Where(x => x.LabResultID != ""))
            {
                foreach (LabResult labResult in labResultList.Where(x => x.TestID == resourceCur.LabResultID))
                {
                    if (resourceCur.LabResultCompare.StartsWith("<"))
                    {
                        //PIn.Int not used because blank not allowed.
                        try{
                            if (int.Parse(labResult.ObsValue) < int.Parse(resourceCur.LabResultCompare.Substring(1)))
                            {
                                retVal.Add(resourceCur);
                            }
                        }
                        catch {
                            //This could only happen if the validation in either input didn't work.
                        }
                    }
                    else if (resourceCur.LabResultCompare.StartsWith(">"))
                    {
                        try {
                            if (int.Parse(labResult.ObsValue) > int.Parse(resourceCur.LabResultCompare.Substring(1)))
                            {
                                retVal.Add(resourceCur);
                            }
                        }
                        catch {
                            //This could only happen if the validation in either input didn't work.
                        }
                    }
                }                                                                                                                         //end LabResultList
                foreach (EhrLabResult ehrLabResult in listEhrLabResults.Where(x => x.ObservationIdentifierID == resourceCur.LabResultID)) //matches loinc only.
                {
                    if (retVal.Contains(resourceCur))
                    {
                        continue;                        //already added from loop above.
                    }
                    retVal.Add(resourceCur);
                }                //end EhrLabResults
            }
            return(retVal);
        }
Exemplo n.º 6
0
        ///<summary>For CPOE.  Used for both manual rx and eRx through NewCrop.  Creates or updates a medical order using the given prescription information.
        ///Since rxCui is not part of the prescription, it must be passed in as a separate parameter.
        ///If isProvOrder is true, then the medical order provNum will be set to the prescription provNum.  If isProvOrder is false, then the medical order provNum will be set to 0.
        ///The MedDescript and ErxGuid will always be copied from the prescription to the medical order and the medical order MedicationNum will be set to 0.
        ///This method return the medOrderNum for the new/updated medicationPat. Unlike most medical orders this does not create an entry in the medical order table.</summary>
        public static long InsertOrUpdateMedOrderForRx(RxPat rxPat, long rxCui, bool isProvOrder)
        {
            long          medOrderNum;
            MedicationPat medOrderOld = null;

            if (!string.IsNullOrWhiteSpace(rxPat.ErxGuid))             //This check prevents an extra db call when making a new prescription manually inside OD.
            {
                medOrderOld = MedicationPats.GetMedicationOrderByErxIdAndPat(rxPat.ErxGuid, rxPat.PatNum);
            }
            MedicationPat medOrder = null;          //The medication order corresponding to the prescription.

            if (medOrderOld == null)
            {
                medOrder = new MedicationPat();
            }
            else
            {
                medOrder = medOrderOld.Clone();              //Maintain primary key and medicationnum for the update below.
            }
            medOrder.DateStart = rxPat.RxDate;
            int numDays = PrefC.GetInt(PrefName.MedDefaultStopDays);

            if (numDays != 0)
            {
                medOrder.DateStop = rxPat.RxDate.AddDays(numDays);
            }
            medOrder.MedDescript = rxPat.Drug;
            medOrder.RxCui       = rxCui;
            if (rxCui != 0)
            {
                //The customer may not have a medication entered for this RxCui the first few times they get this particular medication back from eRx.
                //Once the customer adds the medication to their medication list, then we can automatically attach the order to the medication.
                //The reason we decided not to automatically create the medication if one does not already exist is because we do not want to
                //accidentally bloat the medication list, if for example, the user has the medication entered but has not set the RxCui on it yet.
                List <Medication> listMeds = Medications.GetAllMedsByRxCui(rxCui);
                if (listMeds.Count > 0)
                {
                    medOrder.MedicationNum = listMeds[0].MedicationNum;
                }
            }
            medOrder.ErxGuid = rxPat.ErxGuid;
            medOrder.PatNote = rxPat.Sig;
            medOrder.PatNum  = rxPat.PatNum;
            if (isProvOrder)
            {
                medOrder.ProvNum = rxPat.ProvNum;
                medOrder.IsCpoe  = true;
            }
            if (medOrderOld == null)
            {
                medOrder.IsNew = true;              //Might not be necessary, but does not hurt.
                medOrderNum    = MedicationPats.Insert(medOrder);
                //If the ErxGuid has not been set, and it is a new medication, set the ErxGuid so that the medication can be sent to DoseSpot
                if (Erx.IsManualRx(rxPat.ErxGuid))
                {
                    try {
                        int medPatNumAsInt = (int)medOrderNum;
                        rxPat.ErxGuid = Erx.OpenDentalErxPrefix + medPatNumAsInt;
                        RxPats.Update(rxPat);
                    }
                    catch (Exception ex) {
                        //If we cannot downgrade a long to an int for the ErxGuid we can simply ignore trying to update the rxPat.
                        //This is because this medication would never be sent to eRx because we would attempt this downgrade again in the exact same manner.
                        ex.DoNothing();
                    }
                }
            }
            else              //The medication order was already in our database. Update it.
            {
                medOrder.MedicationPatNum = medOrderOld.MedicationPatNum;
                MedicationPats.Update(medOrder, false);               //Don't ErxGuid here, it was already purposefully set above.
                medOrderNum = medOrder.MedicationPatNum;
            }
            return(medOrderNum);
        }
Exemplo n.º 7
0
        ///<summary></summary>
        public static List <EduResource> GenerateForPatient(long patNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <EduResource> >(MethodBase.GetCurrentMethod(), patNum));
            }
            List <Disease>       diseaseList        = Diseases.Refresh(patNum);
            List <MedicationPat> medicationPatList  = MedicationPats.Refresh(patNum, false);
            List <LabResult>     labResultList      = LabResults.GetAllForPatient(patNum);
            List <EhrLabResult>  listEhrLabResults  = EhrLabResults.GetAllForPatient(patNum);
            List <EduResource>   eduResourceListAll = Crud.EduResourceCrud.SelectMany("SELECT * FROM eduresource");
            List <EduResource>   retVal             = new List <EduResource>();

            for (int i = 0; i < eduResourceListAll.Count; i++)
            {
                if (eduResourceListAll[i].DiseaseDefNum != 0)
                {
                    for (int j = 0; j < diseaseList.Count; j++)
                    {
                        if (eduResourceListAll[i].DiseaseDefNum == diseaseList[j].DiseaseDefNum)
                        {
                            retVal.Add(eduResourceListAll[i]);
                        }
                    }
                }
                else if (eduResourceListAll[i].DiseaseDefNum != 0)               //checks against same list as Diseases/Problems
                {
                    for (int j = 0; j < diseaseList.Count; j++)
                    {
                        if (eduResourceListAll[i].DiseaseDefNum == diseaseList[j].DiseaseDefNum)
                        {
                            retVal.Add(eduResourceListAll[i]);
                        }
                    }
                }
                else if (eduResourceListAll[i].MedicationNum != 0)
                {
                    Medication med = Medications.GetMedication(eduResourceListAll[i].MedicationNum);
                    for (int j = 0; j < medicationPatList.Count; j++)
                    {
                        if (eduResourceListAll[i].MedicationNum == medicationPatList[j].MedicationNum || (medicationPatList[j].MedicationNum == 0 && medicationPatList[j].RxCui == med.RxCui))
                        {
                            retVal.Add(eduResourceListAll[i]);
                        }
                    }
                }
                else if (eduResourceListAll[i].LabResultID != "")
                {
                    for (int j = 0; j < labResultList.Count; j++)
                    {
                        if (eduResourceListAll[i].LabResultID != labResultList[j].TestID)
                        {
                            continue;
                        }
                        if (eduResourceListAll[i].LabResultCompare.StartsWith("<"))
                        {
                            //PIn.Int not used because blank not allowed.
                            try{
                                if (int.Parse(labResultList[j].ObsValue) < int.Parse(eduResourceListAll[i].LabResultCompare.Substring(1)))
                                {
                                    retVal.Add(eduResourceListAll[i]);
                                }
                            }
                            catch {
                                //This could only happen if the validation in either input didn't work.
                            }
                        }
                        else if (eduResourceListAll[i].LabResultCompare.StartsWith(">"))
                        {
                            try {
                                if (int.Parse(labResultList[j].ObsValue) > int.Parse(eduResourceListAll[i].LabResultCompare.Substring(1)))
                                {
                                    retVal.Add(eduResourceListAll[i]);
                                }
                            }
                            catch {
                                //This could only happen if the validation in either input didn't work.
                            }
                        }
                    }                                                 //end LabResultList
                    for (int j = 0; j < listEhrLabResults.Count; j++) //matches loinc only.
                    {
                        if (listEhrLabResults[j].ObservationIdentifierID != eduResourceListAll[i].LabResultID)
                        {
                            continue;
                        }
                        if (retVal.Contains(eduResourceListAll[i]))
                        {
                            continue;                            //already added from loop above.
                        }
                        retVal.Add(eduResourceListAll[i]);
                    }                    //end EhrLabResults
                }
            }
            return(retVal);
        }