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;
            }
            if (radioInsBillingProvSpecific.Checked && comboInsBillingProv.SelectedIndex == -1)
            {
                MsgBox.Show(this, "You must select a provider.");
                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;
            if (radioInsBillingProvDefault.Checked)            //default=0
            {
                ClinicCur.InsBillingProv = 0;
            }
            else if (radioInsBillingProvTreat.Checked)            //treat=-1
            {
                ClinicCur.InsBillingProv = -1;
            }
            else
            {
                ClinicCur.InsBillingProv = ProviderC.ListShort[comboInsBillingProv.SelectedIndex].ProvNum;
            }
            if (IsNew)
            {
                Clinics.Insert(ClinicCur);
            }
            else
            {
                Clinics.Update(ClinicCur);
            }
            DialogResult = DialogResult.OK;
        }
Esempio n. 2
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            Clinic clinicCur = new Clinic();

            clinicCur.IsNew = true;
            if (PrefC.GetBool(PrefName.PracticeIsMedicalOnly))
            {
                clinicCur.IsMedicalOnly = true;
            }
            clinicCur.ItemOrder = gridMain.ListGridRows.Count - (IncludeHQInList?1:0);        //Set it last in the last position (minus 1 for HQ)
            FormClinicEdit FormCE = new FormClinicEdit(clinicCur);

            if (FormCE.ShowDialog() == DialogResult.OK)
            {
                clinicCur.ClinicNum = Clinics.Insert(clinicCur);              //inserting this here so we have a ClinicNum; the user cannot cancel and undo this anyway
                //ClinicCur.ListClinicSpecialtyDefLinks FKeys are set in FormClosing to ClinicCur.ClinicNum
                ListClinics.Add(clinicCur);
                _listClinicsOld.Add(clinicCur.Copy());                //add to both lists so the sync doesn't try to insert it again or delete it.
                _dictClinicalCounts[clinicCur.ClinicNum] = 0;
                ListClinics.Sort(ClinicSort);
            }
            FillGrid();
        }