Esempio n. 1
0
 private void FormMedicationEdit_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         return;
     }
     if (IsNew)
     {
         Medications.Delete(MedicationCur);
     }
 }
Esempio n. 2
0
 private void FormMedicationEdit_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         return;
     }
     if (IsNew)
     {
         try {
             Medications.Delete(MedicationCur);
         }
         catch {
             MsgBox.Show(this, "The medication failed to delete due to existing dependencies.");
         }
     }
 }
Esempio n. 3
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (!IsNew)             //Only ask user if they want to delete if not new.
     {
         if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Delete this medication?"))
         {
             return;
         }
     }
     try {
         Medications.Delete(MedicationCur);
     }
     catch (Exception ex) {
         MessageBox.Show(this, ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
Esempio n. 4
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (PatNames.Length > 0)
     {
         MessageBox.Show(Lan.g(this, "You can not delete a medication that is in use by patients."));
         return;
     }
     if (Brands.Length > 0)
     {
         MessageBox.Show(Lan.g(this, "You can not delete a medication that has brand names attached."));
         return;
     }
     if (Brands.Length > 0)
     {
         if (MessageBox.Show(Lan.g(this, "Delete this medication?"), "", MessageBoxButtons.OKCancel)
             != DialogResult.OK)
         {
             return;
         }
     }
     Medications.Delete(MedicationCur);
     DialogResult = DialogResult.OK;
 }