private void FormClinics_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (IsSelectionMode) { return; } bool hasClinicChanges = false; if (Clinics.Sync(ListClinics, ListClinicsOld)) { hasClinicChanges = true; } if (Prefs.UpdateBool(PrefName.ClinicListIsAlphabetical, checkOrderAlphabetical.Checked)) { DataValid.SetInvalid(InvalidType.Prefs); } _listClinicDefLinksAll.Clear(); foreach (DefLinkClinic defLinkClinic in _listDefLinkClinicSpecialties) { if (defLinkClinic.ListDefLink.Exists(x => x.DefLinkNum == 0)) { defLinkClinic.ListDefLink.ForEach(x => x.FKey = defLinkClinic.Clinic.ClinicNum); } _listClinicDefLinksAll.AddRange(defLinkClinic.ListDefLink); } if (DefLinks.Sync(_listClinicDefLinksAll, _listClinicDefLinksAllOld)) { hasClinicChanges = true; } //Joe - Now that we have called sync on ListClinics we want to make sure that each clinic has program properties for PayConnect and XCharge //We are doing this because of a previous bug that caused some customers to have over 3.4 million duplicate rows in their programproperty table long payConnectProgNum = Programs.GetProgramNum(ProgramName.PayConnect); long xChargeProgNum = Programs.GetProgramNum(ProgramName.Xcharge); //Don't need to do this for PaySimple, because these will get generated as needed in FormPaySimpleSetup bool hasChanges = ProgramProperties.InsertForClinic(payConnectProgNum, ListClinics.Select(x => x.ClinicNum) .Where(x => ProgramProperties.GetListForProgramAndClinic(payConnectProgNum, x).Count == 0).ToList()); hasChanges = ProgramProperties.InsertForClinic(xChargeProgNum, ListClinics.Select(x => x.ClinicNum) .Where(x => ProgramProperties.GetListForProgramAndClinic(xChargeProgNum, x).Count == 0).ToList()) || hasChanges;//prevent short curcuit if (hasChanges) { DataValid.SetInvalid(InvalidType.Programs); } if (hasClinicChanges) { DataValid.SetInvalid(InvalidType.Providers); } }
private void FormClinics_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (IsSelectionMode) { return; } if (Prefs.UpdateBool(PrefName.ClinicListIsAlphabetical, checkOrderAlphabetical.Checked)) { DataValid.SetInvalid(InvalidType.Prefs); } bool hasClinicChanges = Clinics.Sync(ListClinics, _listClinicsOld); //returns true if clinics were updated/inserted/deleted //Update the ClinicNum on all specialties associated to each clinic. ListClinics.ForEach(x => x.ListClinicSpecialtyDefLinks.ForEach(y => y.FKey = x.ClinicNum)); List <DefLink> listAllClinicSpecialtyDefLinks = ListClinics.SelectMany(x => x.ListClinicSpecialtyDefLinks).ToList(); hasClinicChanges |= DefLinks.Sync(listAllClinicSpecialtyDefLinks, _listClinicDefLinksAllOld); hasClinicChanges |= CorrectItemOrders(); //Joe - Now that we have called sync on ListClinics we want to make sure that each clinic has program properties for PayConnect and XCharge //We are doing this because of a previous bug that caused some customers to have over 3.4 million duplicate rows in their programproperty table long payConnectProgNum = Programs.GetProgramNum(ProgramName.PayConnect); long xChargeProgNum = Programs.GetProgramNum(ProgramName.Xcharge); //Don't need to do this for PaySimple, because these will get generated as needed in FormPaySimpleSetup bool hasChanges = ProgramProperties.InsertForClinic(payConnectProgNum, ListClinics.Select(x => x.ClinicNum).Where(x => ProgramProperties.GetListForProgramAndClinic(payConnectProgNum, x).Count == 0).ToList()); hasChanges |= ProgramProperties.InsertForClinic(xChargeProgNum, ListClinics.Select(x => x.ClinicNum).Where(x => ProgramProperties.GetListForProgramAndClinic(xChargeProgNum, x).Count == 0).ToList()); if (hasChanges) { DataValid.SetInvalid(InvalidType.Programs); } if (hasClinicChanges) { DataValid.SetInvalid(InvalidType.Providers); } }