Exemplo n.º 1
0
 private void menuItemAdd_Click(object sender, EventArgs e)
 {
     if (FormOpenDental.CurPatNum == 0)
     {
         MsgBox.Show(this, "Please select a patient in the main window first.");
         return;
     }
     if (PhoneList[rowI].PatNum != 0)
     {
         if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "The current number is already attached to a patient. Attach it to this patient instead?"))
         {
             return;
         }
         PhoneNumber ph = PhoneNumbers.GetByVal(PhoneList[rowI].CustomerNumber);
         ph.PatNum = FormOpenDental.CurPatNum;
         PhoneNumbers.Update(ph);
     }
     else
     {
         string patName = Patients.GetLim(FormOpenDental.CurPatNum).GetNameLF();
         if (MessageBox.Show("Attach this phone number to " + patName + "?", "", MessageBoxButtons.OKCancel) != DialogResult.OK)
         {
             return;
         }
         PhoneNumber ph = new PhoneNumber();
         ph.PatNum         = FormOpenDental.CurPatNum;
         ph.PhoneNumberVal = PhoneList[rowI].CustomerNumber;
         PhoneNumbers.Insert(ph);
     }
     //tell the phone server to refresh this row with the patient name and patnum
     DataValid.SetInvalid(InvalidType.PhoneNumbers);
 }