private void butOK_Click(object sender, System.EventArgs e) { string phone = textPhone1.Text + textPhone2.Text + textPhone3.Text; if (phone.Length > 0 && phone.Length < 10) { MessageBox.Show(Lan.g(this, "Invalid phone")); return; } RefCur.IsHidden = checkHidden.Checked; RefCur.NotPerson = checkNotPerson.Checked; RefCur.LName = textLName.Text; RefCur.FName = textFName.Text; RefCur.MName = textMName.Text; RefCur.Title = textTitle.Text; RefCur.Address = textAddress.Text; RefCur.Address2 = textAddress2.Text; RefCur.City = textCity.Text; RefCur.ST = textST.Text; RefCur.Zip = textZip.Text; RefCur.Telephone = phone; RefCur.Phone2 = textOtherPhone.Text; RefCur.SSN = textSSN.Text; RefCur.NationalProvID = textNationalProvID.Text; RefCur.EMail = textEmail.Text; RefCur.Note = textNotes.Text; //RefCur.UsingTIN already taken care of if (!IsPatient) { RefCur.Specialty = (DentalSpecialty)listSpecialty.SelectedIndex; } if (IsNew) { for (int i = 0; i < Referrals.List.Length; i++) { if ((RefCur.LName + RefCur.FName) == (Referrals.List[i].LName + Referrals.List[i].FName)) { if (MessageBox.Show(Lan.g(this, "Referral of same name exists. Add anyway?"), "" , MessageBoxButtons.YesNo) != DialogResult.Yes) { DialogResult = DialogResult.Cancel; return; } break; } } Referrals.Insert(RefCur); } else { Referrals.Update(RefCur); } // Referrals.Refresh(); //MessageBox.Show(RefCur.ReferralNum.ToString()); DialogResult = DialogResult.OK; }