Esempio n. 1
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDescription.Text == "")
            {
                MessageBox.Show(Lan.g(this, "Description cannot be blank."));
                return;
            }
            string phone = textPhone.Text;

            if (Application.CurrentCulture.Name == "en-US")
            {
                phone = phone.Replace("(", "");
                phone = phone.Replace(")", "");
                phone = phone.Replace(" ", "");
                phone = phone.Replace("-", "");
                if (phone.Length != 0 && phone.Length != 10)
                {
                    MessageBox.Show("Invalid phone");
                    return;
                }
            }
            ClinicCur.Description         = textDescription.Text;
            ClinicCur.Phone               = phone;
            ClinicCur.Address             = textAddress.Text;
            ClinicCur.Address2            = textAddress2.Text;
            ClinicCur.City                = textCity.Text;
            ClinicCur.State               = textState.Text;
            ClinicCur.Zip                 = textZip.Text;
            ClinicCur.BankNumber          = textBankNumber.Text;
            ClinicCur.DefaultPlaceService = (PlaceOfService)comboPlaceService.SelectedIndex;
            try{
                Clinics.InsertOrUpdate(ClinicCur, IsNew);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            DialogResult = DialogResult.OK;
        }