private void FillAvailable() { _listReqFields = RequiredFields.GetDeepCopy(); listAvailableFields.Items.Clear(); _listFieldNames = new List <RequiredFieldName>(); if (comboFieldTypes.SelectedIndex >= 0) //if a selection { switch (comboFieldTypes.SelectedIndex) { case 0: _listFieldNames = RequiredFields.GetFieldNamesForType(RequiredFieldType.PatientInfo); break; case 1: _listFieldNames = RequiredFields.GetFieldNamesForType(RequiredFieldType.InsPayEdit); break; } } RequiredFieldName[] arrayRequiredFieldNames = (RequiredFieldName[])Enum.GetValues(typeof(RequiredFieldName)); for (int i = 0; i < arrayRequiredFieldNames.Length; i++) { switch (arrayRequiredFieldNames[i]) { case RequiredFieldName.AdmitDate: if (PrefC.GetBool(PrefName.EasyHideHospitals)) { continue; //Don't include AdmitDate in the list if hospitals is not enabled } break; case RequiredFieldName.TrophyFolder: if (!Programs.IsEnabled(Programs.GetProgramNum(ProgramName.TrophyEnhanced))) { continue; //Don't include TrophyFolder in the list if TrophyEnhanced is not enabled } break; case RequiredFieldName.Ward: if (PrefC.GetBool(PrefName.EasyHideHospitals)) { continue; //Don't include Ward in the list if hospitals is not enabled } break; case RequiredFieldName.Clinic: if (!PrefC.HasClinicsEnabled) { continue; //Don't include Clinic in the list if clinics is not enabled } break; case RequiredFieldName.PatientStatus: case RequiredFieldName.Position: continue; //There is no way to not select these. case RequiredFieldName.MothersMaidenFirstName: case RequiredFieldName.MothersMaidenLastName: case RequiredFieldName.DateTimeDeceased: if (!PrefC.GetBool(PrefName.ShowFeatureEhr)) { continue; //EHR features } break; case RequiredFieldName.StudentStatus: if (CultureInfo.CurrentCulture.Name.EndsWith("CA")) //Canadian. en-CA or fr-CA { continue; //Canada uses Eligibility Excep. Code instead of Student Status radio buttons } break; case RequiredFieldName.EligibilityExceptCode: if (!CultureInfo.CurrentCulture.Name.EndsWith("CA")) // Not Canadian. en-CA or fr-CA { continue; //Don't show EligibilityExceptCode } break; case RequiredFieldName.MedicaidID: case RequiredFieldName.MedicaidState: if (PrefC.GetBool(PrefName.EasyHideMedicaid)) { continue; //Don't show Medicaid fields } break; case RequiredFieldName.Race: case RequiredFieldName.County: case RequiredFieldName.Site: case RequiredFieldName.GradeLevel: case RequiredFieldName.TreatmentUrgency: case RequiredFieldName.ResponsibleParty: if (PrefC.GetBool(PrefName.EasyHidePublicHealth)) { continue; //Don't show Public Health fields } break; case RequiredFieldName.Ethnicity: if (PrefC.GetBool(PrefName.EasyHidePublicHealth) || !PrefC.GetBool(PrefName.ShowFeatureEhr)) { continue; //Don't show Ethnicity } break; default: break; } } List <RequiredFieldName> listReqFieldNames = _listReqFields.Select(y => y.FieldName).Distinct().ToList(); _listFieldNames = _listFieldNames.FindAll(x => !listReqFieldNames.Any(y => y == x)); listAvailableFields.Items.AddRange(_listFieldNames.Select(x => x.ToString()).ToArray()); }