コード例 #1
0
        public static bool HideDef(ODGrid gridDefs, DefCatOptions selectedDefCatOpt)
        {
            if (gridDefs.GetSelectedIndex() == -1)
            {
                MsgBox.Show(_lanThis, "Please select item first,");
                return(false);
            }
            Def selectedDef = (Def)gridDefs.Rows[gridDefs.GetSelectedIndex()].Tag;

            //Warn the user if they are about to hide a billing type currently in use.
            if (selectedDefCatOpt.DefCat == DefCat.BillingTypes && Patients.IsBillingTypeInUse(selectedDef.DefNum))
            {
                if (!MsgBox.Show(_lanThis, MsgBoxButtons.OKCancel, "Warning: Billing type is currently in use by patients, insurance plans, or preferences."))
                {
                    return(false);
                }
            }
            if (selectedDef.Category == DefCat.ProviderSpecialties &&
                (Providers.IsSpecialtyInUse(selectedDef.DefNum) ||
                 Referrals.IsSpecialtyInUse(selectedDef.DefNum)))
            {
                MsgBox.Show(_lanThis, "You cannot hide a specialty if it is in use by a provider or a referral source.");
                return(false);
            }
            if (Defs.IsDefinitionInUse(selectedDef))
            {
                if (selectedDef.DefNum == PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.AppointmentTimeArrivedTrigger) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.AppointmentTimeSeatedTrigger) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.AppointmentTimeDismissedTrigger) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.TreatPlanDiscountAdjustmentType) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.BillingChargeAdjustmentType) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.PracticeDefaultBillType) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.FinanceChargeAdjustmentType))
                {
                    MsgBox.Show(_lanThis, "You cannot hide a definition if it is in use within Module Preferences.");
                    return(false);
                }
                else
                {
                    if (!MsgBox.Show(_lanThis, MsgBoxButtons.OKCancel, "Warning: This definition is currently in use within the program."))
                    {
                        return(false);
                    }
                }
            }
            //Stop users from hiding the last definition in categories that must have at least one def in them.
            if (Defs.IsHidable(selectedDef.Category))
            {
                List <Def> listDefsCurNotHidden = Defs.GetDefsForCategory(selectedDefCatOpt.DefCat, true);
                if (listDefsCurNotHidden.Count == 1)
                {
                    MsgBox.Show(_lanThis, "You cannot hide the last definition in this category.");
                    return(false);
                }
            }
            Defs.HideDef(selectedDef);
            return(true);
        }
コード例 #2
0
ファイル: FormDefinitions.cs プロジェクト: nampn/ODental
 private void butHide_Click(object sender, System.EventArgs e)
 {
     if (!DefsIsSelected)
     {
         MessageBox.Show(Lan.g(this, "Please select item first,"));
         return;
     }
     Defs.HideDef(DefsList[DefsSelected]);
     changed = true;
     FillDefs();
 }
コード例 #3
0
 private void butHide_Click(object sender, System.EventArgs e)
 {
     if (!DefsIsSelected)
     {
         MessageBox.Show(Lan.g(this, "Please select item first,"));
         return;
     }
     //Warn the user if they are about to hide a billing type currently in use.
     if (DefsList[DefsSelected].Category == DefCat.BillingTypes && Patients.IsBillingTypeInUse(DefsList[DefsSelected].DefNum))
     {
         if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Warning: Billing type is currently in use by patients."))
         {
             return;
         }
     }
     Defs.HideDef(DefsList[DefsSelected]);
     changed = true;
     FillDefs();
 }