Exemple #1
0
        ///<summary>Used by MoveUp and MoveDown.</summary>
        private static void SetOrder(int mySelNum, int myItemOrder)
        {
            //No need to check RemotingRole; no call to db.
            DiseaseDef temp = ListLong[mySelNum];

            temp.ItemOrder = myItemOrder;
            DiseaseDefs.Update(temp);
        }
Exemple #2
0
        ///<summary>Fixes item orders in DB if needed. Returns true if changes were made.</summary>
        public static bool FixItemOrders()
        {
            bool retVal = false;
            List <DiseaseDef> listDD = GetDeepCopy();

            listDD.Sort(DiseaseDefs.SortItemOrder);
            for (int i = 0; i < listDD.Count; i++)
            {
                if (listDD[i].ItemOrder == i)
                {
                    continue;
                }
                listDD[i].ItemOrder = i;
                DiseaseDefs.Update(listDD[i]);
                retVal = true;
            }
            if (retVal)
            {
                DiseaseDefs.RefreshCache();
            }
            return(retVal);
        }
Exemple #3
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);
        }
Exemple #4
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"]);
            }
        }
Exemple #5
0
 protected override void FillCacheIfNeeded()
 {
     DiseaseDefs.GetTableFromCache(false);
 }
Exemple #6
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(string itypesStr)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetDS(MethodBase.GetCurrentMethod(), itypesStr));
            }
            //so this part below only happens if direct or server------------------------------------------------
            List <int> itypes = new List <int>();

            string[] strArray = itypesStr.Split(',');
            for (int i = 0; i < strArray.Length; i++)
            {
                itypes.Add(PIn.Int(strArray[i]));
            }
            bool isAll = false;

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

            if (itypes.Contains((int)InvalidType.AccountingAutoPays) || isAll)
            {
                ds.Tables.Add(AccountingAutoPays.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.AutoCodes) || isAll)
            {
                ds.Tables.Add(AutoCodes.RefreshCache());
                ds.Tables.Add(AutoCodeItems.RefreshCache());
                ds.Tables.Add(AutoCodeConds.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Automation) || isAll)
            {
                ds.Tables.Add(Automations.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.AutoNotes) || isAll)
            {
                ds.Tables.Add(AutoNotes.RefreshCache());
                ds.Tables.Add(AutoNoteControls.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Carriers) || isAll)
            {
                ds.Tables.Add(Carriers.RefreshCache());                //run on startup, after telephone reformat, after list edit.
            }
            if (itypes.Contains((int)InvalidType.ClaimForms) || isAll)
            {
                ds.Tables.Add(ClaimFormItems.RefreshCache());
                ds.Tables.Add(ClaimForms.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ClearHouses) || isAll)
            {
                ds.Tables.Add(Clearinghouses.RefreshCache());                //kh wants to add an EasyHideClearHouses to disable this
            }
            if (itypes.Contains((int)InvalidType.Computers) || isAll)
            {
                ds.Tables.Add(Computers.RefreshCache());
                ds.Tables.Add(Printers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Defs) || isAll)
            {
                ds.Tables.Add(Defs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.DentalSchools) || isAll)
            {
                ds.Tables.Add(SchoolClasses.RefreshCache());
                ds.Tables.Add(SchoolCourses.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.DictCustoms) || isAll)
            {
                ds.Tables.Add(DictCustoms.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Diseases) || isAll)
            {
                ds.Tables.Add(DiseaseDefs.RefreshCache());
                ds.Tables.Add(ICD9s.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.DisplayFields) || isAll)
            {
                ds.Tables.Add(DisplayFields.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ElectIDs) || isAll)
            {
                ds.Tables.Add(ElectIDs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Email) || isAll)
            {
                ds.Tables.Add(EmailAddresses.RefreshCache());
                ds.Tables.Add(EmailTemplates.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Employees) || isAll)
            {
                ds.Tables.Add(Employees.RefreshCache());
                ds.Tables.Add(PayPeriods.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Employers) || isAll)
            {
                ds.Tables.Add(Employers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Fees) || isAll)
            {
                ds.Tables.Add(Fees.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.FeeScheds) || isAll)
            {
                ds.Tables.Add(FeeScheds.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.HL7Defs) || isAll)
            {
                ds.Tables.Add(HL7Defs.RefreshCache());
                ds.Tables.Add(HL7DefMessages.RefreshCache());
                ds.Tables.Add(HL7DefSegments.RefreshCache());
                ds.Tables.Add(HL7DefFields.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.InsCats) || isAll)
            {
                ds.Tables.Add(CovCats.RefreshCache());
                ds.Tables.Add(CovSpans.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.InsFilingCodes) || isAll)
            {
                ds.Tables.Add(InsFilingCodes.RefreshCache());
                ds.Tables.Add(InsFilingCodeSubtypes.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Languages) || isAll)
            {
                if (CultureInfo.CurrentCulture.Name != "en-US")
                {
                    ds.Tables.Add(Lans.RefreshCache());
                }
            }
            if (itypes.Contains((int)InvalidType.Letters) || isAll)
            {
                ds.Tables.Add(Letters.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.LetterMerge) || isAll)
            {
                ds.Tables.Add(LetterMergeFields.RefreshCache());
                ds.Tables.Add(LetterMerges.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Operatories) || isAll)
            {
                ds.Tables.Add(Operatories.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.PatFields) || isAll)
            {
                ds.Tables.Add(PatFieldDefs.RefreshCache());
                ds.Tables.Add(ApptFieldDefs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Pharmacies) || isAll)
            {
                ds.Tables.Add(Pharmacies.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Prefs) || isAll)
            {
                ds.Tables.Add(Prefs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ProcButtons) || isAll)
            {
                ds.Tables.Add(ProcButtons.RefreshCache());
                ds.Tables.Add(ProcButtonItems.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ProcCodes) || isAll)
            {
                ds.Tables.Add(ProcedureCodes.RefreshCache());
                ds.Tables.Add(ProcCodeNotes.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Programs) || isAll)
            {
                ds.Tables.Add(Programs.RefreshCache());
                ds.Tables.Add(ProgramProperties.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ProviderIdents) || isAll)
            {
                ds.Tables.Add(ProviderIdents.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Providers) || isAll)
            {
                ds.Tables.Add(Providers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.QuickPaste) || isAll)
            {
                ds.Tables.Add(QuickPasteNotes.RefreshCache());
                ds.Tables.Add(QuickPasteCats.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.RecallTypes) || isAll)
            {
                ds.Tables.Add(RecallTypes.RefreshCache());
                ds.Tables.Add(RecallTriggers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ReplicationServers) || isAll)
            {
                ds.Tables.Add(ReplicationServers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Security) || isAll)
            {
                ds.Tables.Add(Userods.RefreshCache());
                ds.Tables.Add(UserGroups.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Sheets) || isAll)
            {
                ds.Tables.Add(SheetDefs.RefreshCache());
                ds.Tables.Add(SheetFieldDefs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Signals) || isAll)
            {
                ds.Tables.Add(SigElementDefs.RefreshCache());
                ds.Tables.Add(SigButDefs.RefreshCache());                //includes SigButDefElements.Refresh()
            }
            if (itypes.Contains((int)InvalidType.Sites) || isAll)
            {
                ds.Tables.Add(Sites.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Sops) || isAll)
            {
                ds.Tables.Add(Sops.RefreshCache());
            }
            //InvalidTypes.Tasks not handled here.
            if (itypes.Contains((int)InvalidType.TimeCardRules) || isAll)
            {
                ds.Tables.Add(TimeCardRules.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ToolBut) || isAll)
            {
                ds.Tables.Add(ToolButItems.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Vaccines) || isAll)
            {
                ds.Tables.Add(VaccineDefs.RefreshCache());
                ds.Tables.Add(DrugManufacturers.RefreshCache());
                ds.Tables.Add(DrugUnits.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Views) || isAll)
            {
                ds.Tables.Add(ApptViews.RefreshCache());
                ds.Tables.Add(ApptViewItems.RefreshCache());
                ds.Tables.Add(AppointmentRules.RefreshCache());
                ds.Tables.Add(ProcApptColors.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Wiki) || isAll)
            {
                ds.Tables.Add(WikiListHeaderWidths.RefreshCache());
                ds.Tables.Add(WikiPages.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ZipCodes) || isAll)
            {
                ds.Tables.Add(ZipCodes.RefreshCache());
            }
            return(ds);
        }
Exemple #7
0
        ///<summary>only if ClientWeb</summary>
        public static void FillCache(DataSet ds, string itypesStr)
        {
            List <int> itypes = new List <int>();

            string[] strArray = itypesStr.Split(',');
            for (int i = 0; i < strArray.Length; i++)
            {
                itypes.Add(PIn.Int(strArray[i]));
            }
            bool isAll = false;

            if (itypes.Contains((int)InvalidType.AllLocal))
            {
                isAll = true;
            }
            if (itypes.Contains((int)InvalidType.AccountingAutoPays) || isAll)
            {
                AccountingAutoPays.FillCache(ds.Tables["AccountingAutoPay"]);
            }
            if (itypes.Contains((int)InvalidType.AutoCodes) || isAll)
            {
                AutoCodes.FillCache(ds.Tables["AutoCode"]);
                AutoCodeItems.FillCache(ds.Tables["AutoCodeItem"]);
                AutoCodeConds.FillCache(ds.Tables["AutoCodeCond"]);
            }
            if (itypes.Contains((int)InvalidType.Automation) || isAll)
            {
                Automations.FillCache(ds.Tables["Automation"]);
            }
            if (itypes.Contains((int)InvalidType.AutoNotes) || isAll)
            {
                AutoNotes.FillCache(ds.Tables["AutoNote"]);
                AutoNoteControls.FillCache(ds.Tables["AutoNoteControl"]);
            }
            if (itypes.Contains((int)InvalidType.Carriers) || isAll)
            {
                Carriers.FillCache(ds.Tables["Carrier"]);                //run on startup, after telephone reformat, after list edit.
            }
            if (itypes.Contains((int)InvalidType.ClaimForms) || isAll)
            {
                ClaimFormItems.FillCache(ds.Tables["ClaimFormItem"]);
                ClaimForms.FillCache(ds.Tables["ClaimForm"]);
            }
            if (itypes.Contains((int)InvalidType.ClearHouses) || isAll)
            {
                Clearinghouses.FillCache(ds.Tables["Clearinghouse"]);                //kh wants to add an EasyHideClearHouses to disable this
            }
            if (itypes.Contains((int)InvalidType.Computers) || isAll)
            {
                Computers.FillCache(ds.Tables["Computer"]);
                Printers.FillCache(ds.Tables["Printer"]);
            }
            if (itypes.Contains((int)InvalidType.Defs) || isAll)
            {
                Defs.FillCache(ds.Tables["Def"]);
            }
            if (itypes.Contains((int)InvalidType.DentalSchools) || isAll)
            {
                SchoolClasses.FillCache(ds.Tables["SchoolClass"]);
                SchoolCourses.FillCache(ds.Tables["SchoolCourse"]);
            }
            if (itypes.Contains((int)InvalidType.DictCustoms) || isAll)
            {
                DictCustoms.FillCache(ds.Tables["DictCustom"]);
            }
            if (itypes.Contains((int)InvalidType.Diseases) || isAll)
            {
                DiseaseDefs.FillCache(ds.Tables["DiseaseDef"]);
                ICD9s.FillCache(ds.Tables["ICD9"]);
            }
            if (itypes.Contains((int)InvalidType.DisplayFields) || isAll)
            {
                DisplayFields.FillCache(ds.Tables["DisplayField"]);
            }
            if (itypes.Contains((int)InvalidType.ElectIDs) || isAll)
            {
                ElectIDs.FillCache(ds.Tables["ElectID"]);
            }
            if (itypes.Contains((int)InvalidType.Email) || isAll)
            {
                EmailAddresses.FillCache(ds.Tables["EmailAddress"]);
                EmailTemplates.FillCache(ds.Tables["EmailTemplate"]);
            }
            if (itypes.Contains((int)InvalidType.Employees) || isAll)
            {
                Employees.FillCache(ds.Tables["Employee"]);
                PayPeriods.FillCache(ds.Tables["PayPeriod"]);
            }
            if (itypes.Contains((int)InvalidType.Employers) || isAll)
            {
                Employers.FillCache(ds.Tables["Employer"]);
            }
            if (itypes.Contains((int)InvalidType.Fees) || isAll)
            {
                Fees.FillCache(ds.Tables["Fee"]);
            }
            if (itypes.Contains((int)InvalidType.FeeScheds) || isAll)
            {
                FeeScheds.FillCache(ds.Tables["FeeSched"]);
            }
            if (itypes.Contains((int)InvalidType.HL7Defs) || isAll)
            {
                HL7Defs.FillCache(ds.Tables["HL7Def"]);
                HL7DefMessages.FillCache(ds.Tables["HL7DefMessage"]);
                HL7DefSegments.FillCache(ds.Tables["HL7DefSegment"]);
                HL7DefFields.FillCache(ds.Tables["HL7DefField"]);
            }
            if (itypes.Contains((int)InvalidType.InsCats) || isAll)
            {
                CovCats.FillCache(ds.Tables["CovCat"]);
                CovSpans.FillCache(ds.Tables["CovSpan"]);
            }
            if (itypes.Contains((int)InvalidType.InsFilingCodes) || isAll)
            {
                InsFilingCodes.FillCache(ds.Tables["InsFilingCode"]);
                InsFilingCodeSubtypes.FillCache(ds.Tables["InsFilingCodeSubtype"]);
            }
            if (itypes.Contains((int)InvalidType.Languages) || isAll)
            {
                Lans.FillCache(ds.Tables["Language"]);
            }
            if (itypes.Contains((int)InvalidType.Letters) || isAll)
            {
                Letters.FillCache(ds.Tables["Letter"]);
            }
            if (itypes.Contains((int)InvalidType.LetterMerge) || isAll)
            {
                LetterMergeFields.FillCache(ds.Tables["LetterMergeField"]);
                LetterMerges.FillCache(ds.Tables["LetterMerge"]);
            }
            if (itypes.Contains((int)InvalidType.Operatories) || isAll)
            {
                Operatories.FillCache(ds.Tables["Operatory"]);
            }
            if (itypes.Contains((int)InvalidType.PatFields) || isAll)
            {
                PatFieldDefs.FillCache(ds.Tables["PatFieldDef"]);
                ApptFieldDefs.FillCache(ds.Tables["ApptFieldDef"]);
            }
            if (itypes.Contains((int)InvalidType.Pharmacies) || isAll)
            {
                Pharmacies.FillCache(ds.Tables["Pharmacy"]);
            }
            if (itypes.Contains((int)InvalidType.Prefs) || isAll)
            {
                Prefs.FillCache(ds.Tables["Pref"]);
            }
            if (itypes.Contains((int)InvalidType.ProcButtons) || isAll)
            {
                ProcButtons.FillCache(ds.Tables["ProcButton"]);
                ProcButtonItems.FillCache(ds.Tables["ProcButtonItem"]);
            }
            if (itypes.Contains((int)InvalidType.ProcCodes) || isAll)
            {
                ProcedureCodes.FillCache(ds.Tables["ProcedureCode"]);
                ProcCodeNotes.FillCache(ds.Tables["ProcCodeNote"]);
            }
            if (itypes.Contains((int)InvalidType.Programs) || isAll)
            {
                Programs.FillCache(ds.Tables["Program"]);
                ProgramProperties.FillCache(ds.Tables["ProgramProperty"]);
            }
            if (itypes.Contains((int)InvalidType.ProviderIdents) || isAll)
            {
                ProviderIdents.FillCache(ds.Tables["ProviderIdent"]);
            }
            if (itypes.Contains((int)InvalidType.Providers) || isAll)
            {
                Providers.FillCache(ds.Tables["Provider"]);
            }
            if (itypes.Contains((int)InvalidType.QuickPaste) || isAll)
            {
                QuickPasteNotes.FillCache(ds.Tables["QuickPasteNote"]);
                QuickPasteCats.FillCache(ds.Tables["QuickPasteCat"]);
            }
            if (itypes.Contains((int)InvalidType.RecallTypes) || isAll)
            {
                RecallTypes.FillCache(ds.Tables["RecallType"]);
                RecallTriggers.FillCache(ds.Tables["RecallTrigger"]);
            }
            if (itypes.Contains((int)InvalidType.ReplicationServers) || isAll)
            {
                ReplicationServers.FillCache(ds.Tables["ReplicationServer"]);
            }
            if (itypes.Contains((int)InvalidType.Security) || isAll)
            {
                Userods.FillCache(ds.Tables["Userod"]);
                UserGroups.FillCache(ds.Tables["UserGroup"]);
            }
            if (itypes.Contains((int)InvalidType.Sheets) || isAll)
            {
                SheetDefs.FillCache(ds.Tables["SheetDef"]);
                SheetFieldDefs.FillCache(ds.Tables["SheetFieldDef"]);
            }
            if (itypes.Contains((int)InvalidType.Signals) || isAll)
            {
                SigElementDefs.FillCache(ds.Tables["SigElementDef"]);
                SigButDefs.FillCache(ds.Tables["SigButDef"]);                //includes SigButDefElements.Refresh()
            }
            if (itypes.Contains((int)InvalidType.Sites) || isAll)
            {
                Sites.FillCache(ds.Tables["Site"]);
            }
            if (itypes.Contains((int)InvalidType.Sops) || isAll)
            {
                Sops.FillCache(ds.Tables["Sop"]);
            }
            if (itypes.Contains((int)InvalidType.TimeCardRules) || isAll)
            {
                TimeCardRules.FillCache(ds.Tables["TimeCardRule"]);
            }
            //InvalidTypes.Tasks not handled here.
            if (itypes.Contains((int)InvalidType.ToolBut) || isAll)
            {
                ToolButItems.FillCache(ds.Tables["ToolButItem"]);
            }
            if (itypes.Contains((int)InvalidType.Vaccines) || isAll)
            {
                VaccineDefs.FillCache(ds.Tables["VaccineDef"]);
                DrugManufacturers.FillCache(ds.Tables["DrugManufacturer"]);
                DrugUnits.FillCache(ds.Tables["DrugUnit"]);
            }
            if (itypes.Contains((int)InvalidType.Views) || isAll)
            {
                ApptViews.FillCache(ds.Tables["ApptView"]);
                ApptViewItems.FillCache(ds.Tables["ApptViewItem"]);
                AppointmentRules.FillCache(ds.Tables["AppointmentRule"]);
                ProcApptColors.FillCache(ds.Tables["ProcApptColor"]);
            }
            if (itypes.Contains((int)InvalidType.Wiki) || isAll)
            {
                WikiListHeaderWidths.FillCache(ds.Tables["WikiListHeaderWidth"]);
                WikiPages.FillCache(ds.Tables["WikiPage"]);
            }
            if (itypes.Contains((int)InvalidType.ZipCodes) || isAll)
            {
                ZipCodes.FillCache(ds.Tables["ZipCode"]);
            }
        }
Exemple #8
0
        ///<summary>This is the first step of automation, this checks to see if the new object matches one of the trigger conditions. </summary>
        /// <param name="triggerObject">Can be DiseaseDef, ICD9, Icd10, Snomed, Medication, RxNorm, Cvx, AllerfyDef, EHRLabResult, Patient, or VitalSign.</param>
        /// <param name="PatCur">Triggers and intervention are currently always dependant on current patient. </param>
        /// <returns>Returns a dictionary keyed on triggers and a list of all the objects that the trigger matched on. Should be used to generate CDS intervention message and later be passed to FormInfobutton for knowledge request.</returns>
        public static List <CDSIntervention> TriggerMatch(object triggerObject, Patient PatCur)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <CDSIntervention> >(MethodBase.GetCurrentMethod(), triggerObject, PatCur));
            }
            //Dictionary<string,List<object>> retVal=new Dictionary<string,List<object>>();
            List <CDSIntervention> retVal = new List <CDSIntervention>();
            //Define objects to be used in matching triggers.
            DiseaseDef   diseaseDef;
            ICD9         icd9;
            Icd10        icd10;
            Snomed       snomed;
            Medication   medication;
            RxNorm       rxNorm;
            Cvx          cvx;
            AllergyDef   allergyDef;
            EhrLabResult ehrLabResult;
            Patient      pat;
            Vitalsign    vitalsign;
            string       triggerObjectMessage = "";
            string       command = "";

            switch (triggerObject.GetType().Name)
            {
            case "DiseaseDef":
                diseaseDef = (DiseaseDef)triggerObject;
                command    = "SELECT * FROM ehrtrigger"
                             + " WHERE ProblemDefNumList LIKE '% " + POut.String(diseaseDef.DiseaseDefNum.ToString()) + " %'";      // '% <code> %' so that we can get exact matches.
                if (diseaseDef.ICD9Code != "")
                {
                    command += " OR ProblemIcd9List LIKE '% " + POut.String(diseaseDef.ICD9Code) + " %'";
                    triggerObjectMessage += "  -" + diseaseDef.ICD9Code + "(Icd9)  " + ICD9s.GetByCode(diseaseDef.ICD9Code).Description + "\r\n";
                }
                if (diseaseDef.Icd10Code != "")
                {
                    command += " OR ProblemIcd10List LIKE '% " + POut.String(diseaseDef.Icd10Code) + " %'";
                    triggerObjectMessage += "  -" + diseaseDef.Icd10Code + "(Icd10)  " + Icd10s.GetByCode(diseaseDef.Icd10Code).Description + "\r\n";
                }
                if (diseaseDef.SnomedCode != "")
                {
                    command += " OR ProblemSnomedList LIKE '% " + POut.String(diseaseDef.SnomedCode) + " %'";
                    triggerObjectMessage += "  -" + diseaseDef.SnomedCode + "(Snomed)  " + Snomeds.GetByCode(diseaseDef.SnomedCode).Description + "\r\n";
                }
                break;

            case "ICD9":
                icd9 = (ICD9)triggerObject;
                //TODO: TriggerObjectMessage
                command = "SELECT * FROM ehrtrigger"
                          + " WHERE Icd9List LIKE '% " + POut.String(icd9.ICD9Code) + " %'";         // '% <code> %' so that we can get exact matches.
                break;

            case "Icd10":
                icd10 = (Icd10)triggerObject;
                //TODO: TriggerObjectMessage
                command = "SELECT * FROM ehrtrigger"
                          + " WHERE Icd10List LIKE '% " + POut.String(icd10.Icd10Code) + " %'";         // '% <code> %' so that we can get exact matches.
                break;

            case "Snomed":
                snomed = (Snomed)triggerObject;
                //TODO: TriggerObjectMessage
                command = "SELECT * FROM ehrtrigger"
                          + " WHERE SnomedList LIKE '% " + POut.String(snomed.SnomedCode) + " %'";         // '% <code> %' so that we can get exact matches.
                break;

            case "Medication":
                medication           = (Medication)triggerObject;
                triggerObjectMessage = "  - " + medication.MedName + (medication.RxCui == 0?"":" (RxCui:" + RxNorms.GetByRxCUI(medication.RxCui.ToString()).RxCui + ")") + "\r\n";
                command = "SELECT * FROM ehrtrigger"
                          + " WHERE MedicationNumList LIKE '% " + POut.String(medication.MedicationNum.ToString()) + " %'";         // '% <code> %' so that we can get exact matches.
                if (medication.RxCui != 0)
                {
                    command += " OR RxCuiList LIKE '% " + POut.String(medication.RxCui.ToString()) + " %'";                      // '% <code> %' so that we can get exact matches.
                }
                break;

            case "RxNorm":
                rxNorm = (RxNorm)triggerObject;
                triggerObjectMessage = "  - " + rxNorm.Description + "(RxCui:" + rxNorm.RxCui + ")\r\n";
                command = "SELECT * FROM ehrtrigger"
                          + " WHERE RxCuiList LIKE '% " + POut.String(rxNorm.RxCui) + " %'";         // '% <code> %' so that we can get exact matches.
                break;

            case "Cvx":
                cvx = (Cvx)triggerObject;
                //TODO: TriggerObjectMessage
                command = "SELECT * FROM ehrtrigger"
                          + " WHERE CvxList LIKE '% " + POut.String(cvx.CvxCode) + " %'";         // '% <code> %' so that we can get exact matches.
                break;

            case "AllergyDef":
                allergyDef = (AllergyDef)triggerObject;
                //TODO: TriggerObjectMessage
                command = "SELECT * FROM ehrtrigger"
                          + " WHERE AllergyDefNumList LIKE '% " + POut.String(allergyDef.AllergyDefNum.ToString()) + " %'";         // '% <code> %' so that we can get exact matches.
                break;

            case "EhrLabResult":                    //match loinc only, no longer
                ehrLabResult = (EhrLabResult)triggerObject;
                //TODO: TriggerObjectMessage
                command = "SELECT * FROM ehrtrigger WHERE "
                          + "(LabLoincList LIKE '% " + ehrLabResult.ObservationIdentifierID + " %'"                  //LOINC may be in one of two fields
                          + "OR LabLoincList LIKE '% " + ehrLabResult.ObservationIdentifierIDAlt + " %')";           //LOINC may be in one of two fields
                break;

            case "Patient":
                pat = (Patient)triggerObject;
                List <string> triggerNums = new List <string>();
                //TODO: TriggerObjectMessage
                command = "SELECT * FROM ehrtrigger WHERE DemographicsList !=''";
                List <EhrTrigger> triggers = Crud.EhrTriggerCrud.SelectMany(command);
                for (int i = 0; i < triggers.Count; i++)
                {
                    string[] arrayDemoItems = triggers[i].DemographicsList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    for (int j = 0; j < arrayDemoItems.Length; j++)
                    {
                        switch (arrayDemoItems[j].Split(',')[0])
                        {
                        case "age":
                            int val = PIn.Int(Regex.Match(arrayDemoItems[j], @"\d+").Value);
                            if (arrayDemoItems[j].Contains("="))                                             //=, >=, or <=
                            {
                                if (val == pat.Age)
                                {
                                    triggerNums.Add(triggers[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            if (arrayDemoItems[j].Contains("<"))
                            {
                                if (pat.Age < val)
                                {
                                    triggerNums.Add(triggers[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            if (arrayDemoItems[j].Contains(">"))
                            {
                                if (pat.Age > val)
                                {
                                    triggerNums.Add(triggers[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            //should never happen, age element didn't contain a comparator
                            break;

                        case "gender":
                            if (arrayDemoItems[j].Split(',')[0].StartsWith(pat.Gender.ToString()))
                            {
                                triggerNums.Add(triggers[i].EhrTriggerNum.ToString());
                            }
                            break;

                        default:
                            break;                                            //should never happen
                        }
                    }
                }
                triggerNums.Add("-1");                        //to ensure the querry is valid.
                command = "SELECT * FROM ehrTrigger WHERE EhrTriggerNum IN (" + String.Join(",", triggerNums) + ")";
                break;

            case "Vitalsign":
                List <string> trigNums = new List <string>();
                vitalsign = (Vitalsign)triggerObject;
                command   = "SELECT * FROM ehrtrigger WHERE VitalLoincList !=''";
                List <EhrTrigger> triggersVit = Crud.EhrTriggerCrud.SelectMany(command);
                for (int i = 0; i < triggersVit.Count; i++)
                {
                    string[] arrayVitalItems = triggersVit[i].VitalLoincList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    for (int j = 0; j < arrayVitalItems.Length; j++)
                    {
                        double val = PIn.Double(Regex.Match(arrayVitalItems[j], @"\d+(.(\d+))*").Value);                             //decimal value w or w/o decimal.
                        switch (arrayVitalItems[j].Split(',')[0])
                        {
                        case "height":
                            if (arrayVitalItems[j].Contains("="))                                             //=, >=, or <=
                            {
                                if (vitalsign.Height == val)
                                {
                                    trigNums.Add(triggersVit[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            if (arrayVitalItems[j].Contains("<"))
                            {
                                if (vitalsign.Height < val)
                                {
                                    trigNums.Add(triggersVit[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            if (arrayVitalItems[j].Contains(">"))
                            {
                                if (vitalsign.Height > val)
                                {
                                    trigNums.Add(triggersVit[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            //should never happen, Height element didn't contain a comparator
                            break;

                        case "weight":
                            if (arrayVitalItems[j].Contains("="))                                             //=, >=, or <=
                            {
                                if (vitalsign.Weight == val)
                                {
                                    trigNums.Add(triggersVit[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            if (arrayVitalItems[j].Contains("<"))
                            {
                                if (vitalsign.Weight < val)
                                {
                                    trigNums.Add(triggersVit[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            if (arrayVitalItems[j].Contains(">"))
                            {
                                if (vitalsign.Weight > val)
                                {
                                    trigNums.Add(triggersVit[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            break;

                        case "BMI":
                            float BMI = Vitalsigns.CalcBMI(vitalsign.Weight, vitalsign.Height);
                            if (arrayVitalItems[j].Contains("="))                                             //=, >=, or <=
                            {
                                if (BMI == val)
                                {
                                    trigNums.Add(triggersVit[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            if (arrayVitalItems[j].Contains("<"))
                            {
                                if (BMI < val)
                                {
                                    trigNums.Add(triggersVit[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            if (arrayVitalItems[j].Contains(">"))
                            {
                                if (BMI > val)
                                {
                                    trigNums.Add(triggersVit[i].EhrTriggerNum.ToString());
                                    break;
                                }
                            }
                            break;

                        case "BP":
                            //TODO
                            break;
                        }                //end switch
                    }
                }                        //End Triggers Vit
                trigNums.Add("-1");      //to ensure the querry is valid.
                command = "SELECT * FROM ehrTrigger WHERE EhrTriggerNum IN (" + String.Join(",", trigNums) + ")";
                break;

            default:
                //command="SELECT * FROM ehrtrigger WHERE false";//should not return any results.
                return(null);

                                        #if DEBUG
                throw new Exception(triggerObject.GetType().ToString() + " object not implemented as intervention trigger yet. Add to the list above to handle.");
                                        #endif
                //break;
            }
            List <EhrTrigger> listEhrTriggers = Crud.EhrTriggerCrud.SelectMany(command);
            if (listEhrTriggers.Count == 0)
            {
                return(null);               //no triggers matched.
            }
            //Check for MatchCardinality.One type triggers.----------------------------------------------------------------------------
            for (int i = 0; i < listEhrTriggers.Count; i++)
            {
                if (listEhrTriggers[i].Cardinality != MatchCardinality.One)
                {
                    continue;
                }
                string triggerMessage = listEhrTriggers[i].Description + ":\r\n"; //Example:"Patient over 55:\r\n"
                triggerMessage += triggerObjectMessage;                           //Example:"  -Patient Age 67\r\n"
                List <object> ListObjectMatches = new List <object>();
                ListObjectMatches.Add(triggerObject);
                CDSIntervention cdsi = new CDSIntervention();
                cdsi.EhrTrigger          = listEhrTriggers[i];
                cdsi.InterventionMessage = triggerMessage;
                cdsi.TriggerObjects      = ListObjectMatches;
                retVal.Add(cdsi);
            }
            //Fill object lists to be checked-------------------------------------------------------------------------------------------------
            List <Allergy>    ListAllergy    = Allergies.GetAll(PatCur.PatNum, false);
            List <Disease>    ListDisease    = Diseases.Refresh(PatCur.PatNum, true);
            List <DiseaseDef> ListDiseaseDef = new List <DiseaseDef>();
            List <EhrLab>     ListEhrLab     = EhrLabs.GetAllForPat(PatCur.PatNum);
            //List<EhrLabResult> ListEhrLabResults=null;//Lab results are stored in a list in the EhrLab object.
            List <MedicationPat> ListMedicationPat = MedicationPats.Refresh(PatCur.PatNum, false);
            List <AllergyDef>    ListAllergyDef    = new List <AllergyDef>();
            for (int i = 0; i < ListAllergy.Count; i++)
            {
                ListAllergyDef.Add(AllergyDefs.GetOne(ListAllergy[i].AllergyDefNum));
            }
            for (int i = 0; i < ListDisease.Count; i++)
            {
                ListDiseaseDef.Add(DiseaseDefs.GetItem(ListDisease[i].DiseaseDefNum));
            }
            for (int i = 0; i < listEhrTriggers.Count; i++)
            {
                if (listEhrTriggers[i].Cardinality == MatchCardinality.One)
                {
                    continue;                    //we handled these above.
                }
                string triggerMessage = listEhrTriggers[i].Description + ":\r\n";
                triggerMessage += triggerObjectMessage;
                List <object> ListObjectMatches = new List <object>();            //Allergy, Disease, LabPanels, MedicationPat, Patient, VaccinePat
                ListObjectMatches.Add(triggerObject);
                //Allergy-----------------------------------------------------------------------------------------------------------------------
                //allergy.snomedreaction
                //allergy.AllergyDefNum>>AllergyDef.SnomedType
                //allergy.AllergyDefNum>>AllergyDef.SnomedAllergyTo
                //allergy.AllergyDefNum>>AllergyDef.MedicationNum>>Medication.RxCui
                //Disease-----------------------------------------------------------------------------------------------------------------------
                //Disease.DiseaseDefNum>>DiseaseDef.ICD9Code
                //Disease.DiseaseDefNum>>DiseaseDef.SnomedCode
                //Disease.DiseaseDefNum>>DiseaseDef.Icd10Code
                //LabPanels---------------------------------------------------------------------------------------------------------------------
                //LabPanel.LabPanelNum<<LabResult.TestId (Loinc)
                //LabPanel.LabPanelNum<<LabResult.ObsValue (Loinc)
                //LabPanel.LabPanelNum<<LabResult.ObsRange (Loinc)
                //MedicationPat-----------------------------------------------------------------------------------------------------------------
                //MedicationPat.RxCui
                //MedicationPat.MedicationNum>>Medication.RxCui
                //Patient>>Demographics---------------------------------------------------------------------------------------------------------
                //Patient.Gender
                //Patient.Birthdate (Loinc age?)
                //Patient.SmokingSnoMed
                //RxPat-------------------------------------------------------------------------------------------------------------------------
                //Do not check RxPat. It is useless.
                //VaccinePat--------------------------------------------------------------------------------------------------------------------
                //VaccinePat.VaccineDefNum>>VaccineDef.CVXCode
                //VitalSign---------------------------------------------------------------------------------------------------------------------
                //VitalSign.Height (Loinc)
                //VitalSign.Weight (Loinc)
                //VitalSign.BpSystolic (Loinc)
                //VitalSign.BpDiastolic (Loinc)
                //VitalSign.WeightCode (Snomed)
                //VitalSign.PregDiseaseNum (Snomed)
                //Use object matches to check if required conditions are met-------------------------------------------------------------------------------
                switch (listEhrTriggers[i].Cardinality)
                {
                case MatchCardinality.One:
                    //should never get here, handled above.
                    continue;

                case MatchCardinality.OneOfEachCategory:                        //falls through to two or more, but then branches at the end of the case statement.
                case MatchCardinality.TwoOrMore:
                    //if(ListObjectMatches.Count<2) {
                    //	continue;//Must match at least two objects for this category.
                    //}
                    //Medication
                    for (int m = 0; m < ListMedicationPat.Count; m++)
                    {
                        if (listEhrTriggers[i].MedicationNumList.Contains(" " + ListMedicationPat[m].MedicationNum + " "))
                        {
                            ListObjectMatches.Add(ListMedicationPat[m]);
                            continue;
                        }
                        if (ListMedicationPat[m].RxCui != 0 &&
                            listEhrTriggers[i].RxCuiList.Contains(" " + ListMedicationPat[m].RxCui + " "))
                        {
                            ListObjectMatches.Add(ListMedicationPat[m]);
                            continue;
                        }
                    }
                    //Allergy
                    for (int a = 0; a < ListAllergy.Count; a++)
                    {
                        if (listEhrTriggers[i].AllergyDefNumList.Contains(" " + ListAllergy[a].AllergyDefNum + " "))
                        {
                            ListObjectMatches.Add(AllergyDefs.GetOne(ListAllergy[a].AllergyDefNum));
                            triggerMessage += "  -(Allergy) " + AllergyDefs.GetOne(ListAllergy[a].AllergyDefNum).Description + "\r\n";
                            continue;
                        }
                    }
                    //Problem
                    for (int d = 0; d < ListDiseaseDef.Count; d++)
                    {
                        if (ListDiseaseDef[d].ICD9Code != "" &&
                            listEhrTriggers[i].ProblemIcd9List.Contains(" " + ListDiseaseDef[d].ICD9Code + " "))
                        {
                            ListObjectMatches.Add(ListDiseaseDef[d]);
                            triggerMessage += "  -(ICD9) " + ICD9s.GetByCode(ListDiseaseDef[d].ICD9Code).Description + "\r\n";
                            continue;
                        }
                        if (ListDiseaseDef[d].Icd10Code != "" &&
                            listEhrTriggers[i].ProblemIcd10List.Contains(" " + ListDiseaseDef[d].Icd10Code + " "))
                        {
                            ListObjectMatches.Add(ListDiseaseDef[d]);
                            triggerMessage += "  -(Icd10) " + Icd10s.GetByCode(ListDiseaseDef[d].Icd10Code).Description + "\r\n";
                            continue;
                        }
                        if (ListDiseaseDef[d].SnomedCode != "" &&
                            listEhrTriggers[i].ProblemSnomedList.Contains(" " + ListDiseaseDef[d].SnomedCode + " "))
                        {
                            ListObjectMatches.Add(ListDiseaseDef[d]);
                            triggerMessage += "  -(Snomed) " + Snomeds.GetByCode(ListDiseaseDef[d].SnomedCode).Description + "\r\n";
                            continue;
                        }
                        if (listEhrTriggers[i].ProblemDefNumList.Contains(" " + ListDiseaseDef[d].DiseaseDefNum + " "))
                        {
                            ListObjectMatches.Add(ListDiseaseDef[d]);
                            triggerMessage += "  -(Problem Def) " + ListDiseaseDef[d].DiseaseName + "\r\n";
                            continue;
                        }
                    }
                    //Vital
                    //TODO
                    //Age
                    //TODO
                    //Gender
                    //TODO
                    //Lab Result
                    for (int l = 0; l < ListEhrLab.Count; l++)
                    {
                        for (int r = 0; r < ListEhrLab[l].ListEhrLabResults.Count; r++)
                        {
                            if (listEhrTriggers[i].LabLoincList.Contains(" " + ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierID + " ") ||
                                listEhrTriggers[i].LabLoincList.Contains(" " + ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierIDAlt + " "))
                            {
                                ListObjectMatches.Add(ListEhrLab[l].ListEhrLabResults[r]);
                                if (ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierID != "")                                       //should almost always be the case.
                                {
                                    triggerMessage += "  -(LOINC) " + Loincs.GetByCode(ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierID).NameShort + "\r\n";
                                }
                                else if (ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierID != "")
                                {
                                    triggerMessage += "  -(LOINC) " + Loincs.GetByCode(ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierIDAlt).NameShort + "\r\n";
                                }
                                else if (ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierText != "")
                                {
                                    triggerMessage += "  -(LOINC) " + ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierText + "\r\n";
                                }
                                else if (ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierTextAlt != "")
                                {
                                    triggerMessage += "  -(LOINC) " + ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierTextAlt + "\r\n";
                                }
                                else if (ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierID != "")
                                {
                                    triggerMessage += "  -(LOINC) " + ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierID + "\r\n";
                                }
                                else if (ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierIDAlt != "")
                                {
                                    triggerMessage += "  -(LOINC) " + ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierIDAlt + "\r\n";
                                }
                                else if (ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierTextOriginal != "")
                                {
                                    triggerMessage += "  -(LOINC) " + ListEhrLab[l].ListEhrLabResults[r].ObservationIdentifierTextOriginal + "\r\n";
                                }
                                else
                                {
                                    triggerMessage += "  -(LOINC) Unknown code.\r\n";                                          //should never happen.
                                }
                                continue;
                            }
                        }
                    }
                    ListObjectMatches = RemoveDuplicateObjectsHelper(ListObjectMatches);
                    if (listEhrTriggers[i].Cardinality == MatchCardinality.TwoOrMore && ListObjectMatches.Count < 2)
                    {
                        continue;                                //next trigger, do not add to retVal
                    }
                    if (listEhrTriggers[i].Cardinality == MatchCardinality.OneOfEachCategory && !OneOfEachCategoryHelper(listEhrTriggers[i], ListObjectMatches))
                    {
                        continue;
                    }
                    break;

                case MatchCardinality.All:
                    bool          allConditionsMet = true;
                    List <string> MatchedCodes     = getCodesFromListHelper(ListObjectMatches);                     //new List<string>();
                    //Match all Icd9Codes-------------------------------------------------------------------------------------------------------------------------------------------------
                    string[] arrayIcd9Codes = listEhrTriggers[i].ProblemIcd9List.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    for (int c = 0; c < arrayIcd9Codes.Length; c++)
                    {
                        if (MatchedCodes.Contains(arrayIcd9Codes[i]))
                        {
                            continue;                                    //found required code
                        }
                        //required code not found, set allConditionsMet to false and continue to next trigger
                        allConditionsMet = false;
                        break;
                    }
                    if (!allConditionsMet)
                    {
                        continue;                                //next trigger
                    }
                    //Match all Icd10Codes------------------------------------------------------------------------------------------------------------------------------------------------
                    string[] arrayIcd10Codes = listEhrTriggers[i].ProblemIcd10List.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    for (int c = 0; c < arrayIcd10Codes.Length; c++)
                    {
                        if (MatchedCodes.Contains(arrayIcd10Codes[i]))
                        {
                            continue;                                    //found required code
                        }
                        //required code not found, set allConditionsMet to false and continue to next trigger
                        allConditionsMet = false;
                        break;
                    }
                    if (!allConditionsMet)
                    {
                        continue;                                //next trigger
                    }
                    //Match all SnomedCodes-----------------------------------------------------------------------------------------------------------------------------------------------
                    string[] arraySnomedCodes = listEhrTriggers[i].ProblemSnomedList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    for (int c = 0; c < arraySnomedCodes.Length; c++)
                    {
                        if (MatchedCodes.Contains(arraySnomedCodes[i]))
                        {
                            continue;                                    //found required code
                        }
                        //required code not found, set allConditionsMet to false and continue to next trigger
                        allConditionsMet = false;
                        break;
                    }
                    if (!allConditionsMet)
                    {
                        continue;                                //next trigger
                    }
                    //Match all CvxCodes--------------------------------------------------------------------------------------------------------------------------------------------------
                    string[] arrayCvxCodes = listEhrTriggers[i].CvxList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    for (int c = 0; c < arrayCvxCodes.Length; c++)
                    {
                        if (MatchedCodes.Contains(arrayCvxCodes[i]))
                        {
                            continue;                                    //found required code
                        }
                        //required code not found, set allConditionsMet to false and continue to next trigger
                        allConditionsMet = false;
                        break;
                    }
                    if (!allConditionsMet)
                    {
                        continue;                                //next trigger, do not add to retval
                    }
                    //Match all LoincCodes------------------------------------------------------------------------------------------------------------------------------------------------
                    string[] arrayLoincCodes = listEhrTriggers[i].LabLoincList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    for (int c = 0; c < arrayLoincCodes.Length; c++)
                    {
                        if (MatchedCodes.Contains(arrayLoincCodes[i]))
                        {
                            continue;                                    //found required code
                        }
                        //required code not found, set allConditionsMet to false and continue to next trigger
                        allConditionsMet = false;
                        break;
                    }
                    if (!allConditionsMet)
                    {
                        continue;                                //next trigger, do not add to retval
                    }
                    //TODO:with values
                    //Match all Vitals----------------------------------------------------------------------------------------------------------------------------------------------------
                    //TODO:with values
                    //Match all Demographics---------------------------------------------------------------------------------------------------------------------------------------------
                    //if(listEhrTriggers[i].DemographicAgeGreaterThan!=0){
                    //	if(PatCur.Birthdate.Year>1880 && PatCur.Birthdate.AddYears(listEhrTriggers[i].DemographicAgeGreaterThan)>DateTime.Now){//patient too young
                    //		continue;//next trigger
                    //	}
                    //}
                    //if(listEhrTriggers[i].DemographicAgeLessThan!=0){
                    //	if(PatCur.Birthdate.Year>1880 && PatCur.Birthdate.AddYears(listEhrTriggers[i].DemographicAgeGreaterThan)<DateTime.Now){//patient too old
                    //		continue;//next trigger
                    //	}
                    //}
                    //if(listEhrTriggers[i].DemographicGender!=""){
                    //	if(!listEhrTriggers[i].DemographicGender.Contains(PatCur.Gender.ToString())){//Patient Gender not in gender list of trigger
                    //		continue;//next trigger
                    //	}
                    //}
                    //TODO: construct trigger message using all the codes in the trigger.
                    break;
                }                //end switch trigger cardinality
                //retVal.Add(triggerMessage,ListObjectMatches);
                CDSIntervention cdsi = new CDSIntervention();
                cdsi.EhrTrigger          = listEhrTriggers[i];
                cdsi.InterventionMessage = triggerMessage;
                cdsi.TriggerObjects      = ListObjectMatches;
                retVal.Add(cdsi);
            }            //end triggers
            return(retVal);
        }