private void butDelete_Click(object sender, EventArgs e)
 {
     try {
         Defs.Delete(_defCur);
         //Web Sched New Pat Appt appointment type defs are associated to appointment type and operatory deflinks.  Clean them up.
         DefLinks.DeleteAllForDef(_defCur.DefNum, DefLinkType.AppointmentType);
         DefLinks.DeleteAllForDef(_defCur.DefNum, DefLinkType.Operatory);
         IsDeleted    = true;
         DialogResult = DialogResult.OK;
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     //This is VERY new.  Only allowed and visible for two categories so far: supply cats and claim custom tracking.
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     try{
         Defs.Delete(DefCur);
         DialogResult = DialogResult.OK;
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #3
0
        private void butDelete_Click(object sender, EventArgs e)
        {
            //This is VERY new.  Only allowed and visible for three categories so far: supply cats, claim payment types, and claim custom tracking.
            if (IsNew)
            {
                DialogResult = DialogResult.Cancel;
                return;
            }
            if (DefCur.Category == DefCat.ClaimCustomTracking && _defsList.Count(x => x.Category == DefCat.ClaimCustomTracking) == 1 ||
                DefCur.Category == DefCat.InsurancePaymentType && _defsList.Count(x => x.Category == DefCat.InsurancePaymentType) == 1 ||
                DefCur.Category == DefCat.SupplyCats && _defsList.Count(x => x.Category == DefCat.SupplyCats) == 1)
            {
                MsgBox.Show(this, "Cannot delete the last definition from this category.");
                return;
            }
            bool isAutoNoteRefresh = false;

            if (DefCur.Category == DefCat.AutoNoteCats && AutoNotes.GetExists(x => x.Category == DefCur.DefNum))
            {
                if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Deleting this Auto Note Category will uncategorize some auto notes.  Delete anyway?"))
                {
                    return;
                }
                isAutoNoteRefresh = true;
            }
            try{
                Defs.Delete(DefCur);
                IsDeleted = true;
                if (isAutoNoteRefresh)                 //deleting an auto note category currently in use will uncategorize those auto notes, refresh cache
                {
                    DataValid.SetInvalid(InvalidType.AutoNotes);
                }
                DialogResult = DialogResult.OK;
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
            }
        }