///<summary>Doesn't touch the Defaults checkbox itself. Sets the 5 checkboxes and the textbox that are involved in prefs. Importantly, it also sends those same default values to the list of clinicprefs in memory where they will later be synched.</summary> private void EClipboardSetControlsToPrefDefaults() { //EClipboardUseDefaults not included here checkEClipboardAllowCheckIn.Checked = _clinicPrefHelperEClipboard.GetDefaultBoolVal(PrefName.EClipboardAllowSelfCheckIn); checkEClipboardAllowSelfPortrait.Checked = _clinicPrefHelperEClipboard.GetDefaultBoolVal(PrefName.EClipboardAllowSelfPortraitOnCheckIn); checkEClipboardAllowSheets.Checked = _clinicPrefHelperEClipboard.GetDefaultBoolVal(PrefName.EClipboardPresentAvailableFormsOnCheckIn); checkEClipboardCreateMissingForms.Checked = _clinicPrefHelperEClipboard.GetDefaultBoolVal(PrefName.EClipboardCreateMissingFormsOnCheckIn); checkEClipboardPopupKiosk.Checked = _clinicPrefHelperEClipboard.GetDefaultBoolVal(PrefName.EClipboardPopupKioskOnCheckIn); textEClipboardMessage.Text = _clinicPrefHelperEClipboard.GetDefaultStringVal(PrefName.EClipboardMessageComplete); _clinicPrefHelperEClipboard.ValChangedByUser(PrefName.EClipboardAllowSelfCheckIn, clinicPickerEClipboard.SelectedClinicNum, POut.Bool(checkEClipboardAllowCheckIn.Checked)); _clinicPrefHelperEClipboard.ValChangedByUser(PrefName.EClipboardAllowSelfPortraitOnCheckIn, clinicPickerEClipboard.SelectedClinicNum, POut.Bool(checkEClipboardAllowSelfPortrait.Checked)); _clinicPrefHelperEClipboard.ValChangedByUser(PrefName.EClipboardPresentAvailableFormsOnCheckIn, clinicPickerEClipboard.SelectedClinicNum, POut.Bool(checkEClipboardAllowSheets.Checked)); _clinicPrefHelperEClipboard.ValChangedByUser(PrefName.EClipboardCreateMissingFormsOnCheckIn, clinicPickerEClipboard.SelectedClinicNum, POut.Bool(checkEClipboardCreateMissingForms.Checked)); _clinicPrefHelperEClipboard.ValChangedByUser(PrefName.EClipboardPopupKioskOnCheckIn, clinicPickerEClipboard.SelectedClinicNum, POut.Bool(checkEClipboardPopupKiosk.Checked)); _clinicPrefHelperEClipboard.ValChangedByUser(PrefName.EClipboardMessageComplete, clinicPickerEClipboard.SelectedClinicNum, textEClipboardMessage.Text); }
public void ClinicPrefHelper_GetClinicsWithChanges() { #region Test Setup //Set up clinics Prefs.UpdateBool(PrefName.EasyNoClinics, false); Clinic clinicA = ClinicT.CreateClinic(); //This clinic will always use defaults Clinic clinicB = ClinicT.CreateClinic(); //This clinic will start using defaults and then use its own values Clinic clinicC = ClinicT.CreateClinic(); //This clinic will always use its own values, which will not change Clinic clinicD = ClinicT.CreateClinic(); //This clinic will always use its own values, which will change Clinic clinicE = ClinicT.CreateClinic(); //This clinic will start using its own values, and then change to the defaults //Set up the baseline preferences //using EClipboard prefs because they are actually used as clinic prefs, but any pref could be used Prefs.UpdateBool(PrefName.EClipboardAllowSelfCheckIn, true); Prefs.UpdateBool(PrefName.EClipboardAllowSelfPortraitOnCheckIn, true); //Set up the clinic preferences ClinicPrefs.InsertPref(PrefName.EClipboardAllowSelfCheckIn, clinicC.ClinicNum, POut.Bool(false)); ClinicPrefs.InsertPref(PrefName.EClipboardAllowSelfPortraitOnCheckIn, clinicC.ClinicNum, POut.Bool(false)); ClinicPrefs.InsertPref(PrefName.EClipboardAllowSelfCheckIn, clinicD.ClinicNum, POut.Bool(false)); ClinicPrefs.InsertPref(PrefName.EClipboardAllowSelfPortraitOnCheckIn, clinicD.ClinicNum, POut.Bool(false)); ClinicPrefs.InsertPref(PrefName.EClipboardAllowSelfCheckIn, clinicE.ClinicNum, POut.Bool(false)); ClinicPrefs.InsertPref(PrefName.EClipboardAllowSelfPortraitOnCheckIn, clinicE.ClinicNum, POut.Bool(false)); ClinicPrefs.RefreshCache(); //Set up the ClinicPrefHelper OpenDental.ClinicPrefHelper clinicPrefHelper = new OpenDental.ClinicPrefHelper(PrefName.EClipboardAllowSelfCheckIn, PrefName.EClipboardAllowSelfPortraitOnCheckIn); #endregion Test Setup #region Test Body //Make the changes to the preferences //Update one of the default preference values clinicPrefHelper.ValChangedByUser(PrefName.EClipboardAllowSelfCheckIn, 0, POut.Bool(false)); //Update ClinicB to use one of its own values clinicPrefHelper.ValChangedByUser(PrefName.EClipboardAllowSelfPortraitOnCheckIn, clinicB.ClinicNum, POut.Bool(false)); //Update clinicD to change its own values clinicPrefHelper.ValChangedByUser(PrefName.EClipboardAllowSelfCheckIn, clinicD.ClinicNum, POut.Bool(true)); //Remove all clinicE prefs to indicate it should use the default clinicPrefHelper.ValChangedByUser(PrefName.EClipboardAllowSelfCheckIn, clinicE.ClinicNum, POut.Bool(clinicPrefHelper.GetDefaultBoolVal(PrefName.EClipboardAllowSelfCheckIn))); clinicPrefHelper.ValChangedByUser(PrefName.EClipboardAllowSelfPortraitOnCheckIn, clinicE.ClinicNum, POut.Bool(clinicPrefHelper.GetDefaultBoolVal(PrefName.EClipboardAllowSelfPortraitOnCheckIn))); #endregion Test Body #region Test Results //Test that GetClinicsWithChanges gets the right clinics for each EClipboardAllowSelfCheckIn List <long> listExpectedClinicNumsChanged_A = new List <long>() { 0, //We changed the default preference clinicD.ClinicNum, //We changed this preference clinicE.ClinicNum //We removed these preferences }; List <long> results = clinicPrefHelper.GetClinicsWithChanges(PrefName.EClipboardAllowSelfCheckIn); Assert.AreEqual(3, results.Union(listExpectedClinicNumsChanged_A).Distinct().Count()); //Test that GetClinicsWithChanges gets the right clinics for each EClipboardAllowSelfCheckIn List <long> listExpectedClinicNumsChanged_B = new List <long>() { clinicB.ClinicNum, //We changed this preference clinicE.ClinicNum //We removed these preferences }; results = clinicPrefHelper.GetClinicsWithChanges(PrefName.EClipboardAllowSelfPortraitOnCheckIn); Assert.AreEqual(2, results.Union(listExpectedClinicNumsChanged_B).Distinct().Count()); #endregion Test Results #region Test Clean Up ClinicPrefs.Sync(new List <ClinicPref>(), ClinicPrefs.GetPrefAllClinics(PrefName.EClipboardAllowSelfCheckIn)); ClinicPrefs.Sync(new List <ClinicPref>(), ClinicPrefs.GetPrefAllClinics(PrefName.EClipboardAllowSelfPortraitOnCheckIn)); Clinics.Delete(clinicA); Clinics.Delete(clinicB); Clinics.Delete(clinicC); Clinics.Delete(clinicD); Clinics.Delete(clinicE); #endregion Test Clean Up }