コード例 #1
0
ファイル: FormClinics.cs プロジェクト: kjb7749/testImport
        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);
            }
        }
コード例 #2
0
        ///<summary>Does nothing and returns false if checkOrderAlphabetical is checked.  Uses ClinicSort to put the clinics in the correct order and then
        ///updates the ItemOrder for all clinics.  Includes hidden clinics and clinics the user does not have permission to access.  It must include all
        ///clinics for the ordering to be correct for all users.  This method corrects item ordering issues that were caused by past code and is just a
        ///precaution.  After this runs once, there shouldn't be any ItemOrder inconsistencies moving forward, so this should generally just return false.
        ///Returns true if the db was changed.</summary>
        private bool CorrectItemOrders()
        {
            if (checkOrderAlphabetical.Checked)
            {
                return(false);
            }
            List <Clinic> listAllClinicsDb  = Clinics.GetClinicsNoCache();        //get all clinics, even hidden ones, in order to set the ItemOrders correctly
            List <Clinic> listAllClinicsNew = listAllClinicsDb.Select(x => x.Copy()).ToList();
            bool          isHqInList        = IncludeHQInList;

            IncludeHQInList = false;
            listAllClinicsNew.Sort(ClinicSort);
            IncludeHQInList = isHqInList;
            for (int i = 0; i < listAllClinicsNew.Count; i++)
            {
                listAllClinicsNew[i].ItemOrder = i + 1;            //1 based ItemOrder because the HQ 'clinic' has ItemOrder 0
            }
            return(Clinics.Sync(listAllClinicsNew, listAllClinicsDb));
        }
コード例 #3
0
        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);
            }
        }