示例#1
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textStoreName.Text == "")
     {
         MessageBox.Show(Lan.g(this, "Store name cannot be blank."));
         return;
     }
     if (CultureInfo.CurrentCulture.Name == "en-US")
     {
         if (textPhone.Text != "" && TelephoneNumbers.FormatNumbersExactTen(textPhone.Text) == "")
         {
             MessageBox.Show(Lan.g(this, "Phone number must be in a 10-digit format."));
             return;
         }
         if (textFax.Text != "" && TelephoneNumbers.FormatNumbersExactTen(textFax.Text) == "")
         {
             MessageBox.Show(Lan.g(this, "Fax number must be in a 10-digit format."));
             return;
         }
     }
     PharmCur.StoreName = textStoreName.Text;
     PharmCur.PharmID   = "";
     PharmCur.Phone     = textPhone.Text;
     PharmCur.Fax       = textFax.Text;
     PharmCur.Address   = textAddress.Text;
     PharmCur.Address2  = textAddress2.Text;
     PharmCur.City      = textCity.Text;
     PharmCur.State     = textState.Text;
     PharmCur.Zip       = textZip.Text;
     PharmCur.Note      = textNote.Text;
     try{
         if (PharmCur.IsNew)
         {
             Pharmacies.Insert(PharmCur);
         }
         else
         {
             Pharmacies.Update(PharmCur);
         }
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
示例#2
0
        private void FormReferralEdit_Load(object sender, System.EventArgs e)
        {
            listSpecialty.Items.Clear();
            for (int i = 0; i < Enum.GetNames(typeof(DentalSpecialty)).Length; i++)
            {
                listSpecialty.Items.Add(Lan.g("enumDentalSpecialty", Enum.GetNames(typeof(DentalSpecialty))[i]));
            }
            if (IsPatient)
            {
                if (IsNew)
                {
                    Text = Lan.g(this, "Add Referral");
                    Family  FamCur = Patients.GetFamily(RefCur.PatNum);
                    Patient PatCur = FamCur.GetPatient(RefCur.PatNum);
                    RefCur.Address  = PatCur.Address;
                    RefCur.Address2 = PatCur.Address2;
                    RefCur.City     = PatCur.City;
                    RefCur.EMail    = PatCur.Email;
                    RefCur.FName    = PatCur.FName;
                    RefCur.LName    = PatCur.LName;
                    RefCur.MName    = PatCur.MiddleI;
                    //RefCur.PatNum=Patients.Cur.PatNum;//already handled
                    RefCur.SSN       = PatCur.SSN;
                    RefCur.Telephone = TelephoneNumbers.FormatNumbersExactTen(PatCur.HmPhone);
                    if (PatCur.WkPhone == "")
                    {
                        RefCur.Phone2 = PatCur.WirelessPhone;
                    }
                    else
                    {
                        RefCur.Phone2 = PatCur.WkPhone;
                    }
                    RefCur.ST  = PatCur.State;
                    RefCur.Zip = PatCur.Zip;
                }
                labelPatient.Visible        = true;
                textLName.ReadOnly          = true;
                textFName.ReadOnly          = true;
                textMName.ReadOnly          = true;
                textTitle.ReadOnly          = true;
                textAddress.ReadOnly        = true;
                textAddress2.ReadOnly       = true;
                textCity.ReadOnly           = true;
                textST.ReadOnly             = true;
                textZip.ReadOnly            = true;
                checkNotPerson.Enabled      = false;
                textPhone1.ReadOnly         = true;
                textPhone2.ReadOnly         = true;
                textPhone3.ReadOnly         = true;
                textSSN.ReadOnly            = true;
                radioTIN.Enabled            = false;
                textEmail.ReadOnly          = true;
                listSpecialty.Enabled       = false;
                listSpecialty.SelectedIndex = -1;
                checkIsDoctor.Enabled       = false;
                textNotes.Select();
            }
            else             //non patient
            {
                if (IsNew)
                {
                    this.Text        = Lan.g(this, "Add Referral");
                    RefCur           = new Referral();
                    RefCur.Specialty = DentalSpecialty.General;
                }
                listSpecialty.SelectedIndex = (int)RefCur.Specialty;
                textLName.Select();
            }
            checkIsDoctor.Checked  = RefCur.IsDoctor;
            checkNotPerson.Checked = RefCur.NotPerson;
            checkHidden.Checked    = RefCur.IsHidden;
            textLName.Text         = RefCur.LName;
            textFName.Text         = RefCur.FName;
            textMName.Text         = RefCur.MName;
            textTitle.Text         = RefCur.Title;
            textAddress.Text       = RefCur.Address;
            textAddress2.Text      = RefCur.Address2;
            textCity.Text          = RefCur.City;
            textST.Text            = RefCur.ST;
            textZip.Text           = RefCur.Zip;
            string phone = RefCur.Telephone;

            if (phone != null && phone.Length == 10)
            {
                textPhone1.Text = phone.Substring(0, 3);
                textPhone2.Text = phone.Substring(3, 3);
                textPhone3.Text = phone.Substring(6);
            }
            textSSN.Text = RefCur.SSN;
            if (RefCur.UsingTIN)
            {
                radioTIN.Checked = true;
            }
            else
            {
                radioSSN.Checked = true;
            }
            textNationalProvID.Text = RefCur.NationalProvID;
            textOtherPhone.Text     = RefCur.Phone2;
            textEmail.Text          = RefCur.EMail;
            textNotes.Text          = RefCur.Note;
            //Patients using:
            string[] patsTo   = RefAttaches.GetPats(RefCur.ReferralNum, false);
            string[] patsFrom = RefAttaches.GetPats(RefCur.ReferralNum, true);
            textPatientsNumTo.Text   = patsTo.Length.ToString();
            textPatientsNumFrom.Text = patsFrom.Length.ToString();
            comboPatientsTo.Items.Clear();
            comboPatientsFrom.Items.Clear();
            for (int i = 0; i < patsTo.Length; i++)
            {
                comboPatientsTo.Items.Add(patsTo[i]);
            }
            for (int i = 0; i < patsFrom.Length; i++)
            {
                comboPatientsFrom.Items.Add(patsFrom[i]);
            }
            if (patsTo.Length > 0)
            {
                comboPatientsTo.SelectedIndex = 0;
            }
            if (patsFrom.Length > 0)
            {
                comboPatientsFrom.SelectedIndex = 0;
            }
            comboSlip.Items.Add(Lan.g(this, "Default"));
            comboSlip.SelectedIndex = 0;
            SlipList = SheetDefs.GetCustomForType(SheetTypeEnum.ReferralSlip);
            for (int i = 0; i < SlipList.Count; i++)
            {
                comboSlip.Items.Add(SlipList[i].Description);
                if (RefCur.Slip == SlipList[i].SheetDefNum)
                {
                    comboSlip.SelectedIndex = i + 1;
                }
            }
        }
示例#3
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textStoreName.Text == "")
            {
                MessageBox.Show(Lan.g(this, "Store name cannot be blank."));
                return;
            }
            if (CultureInfo.CurrentCulture.Name == "en-US")
            {
                if (textPhone.Text != "" && TelephoneNumbers.FormatNumbersExactTen(textPhone.Text) == "")
                {
                    MessageBox.Show(Lan.g(this, "Phone number must be in a 10-digit format."));
                    return;
                }
                if (textFax.Text != "" && TelephoneNumbers.FormatNumbersExactTen(textFax.Text) == "")
                {
                    MessageBox.Show(Lan.g(this, "Fax number must be in a 10-digit format."));
                    return;
                }
            }
            PharmCur.StoreName = textStoreName.Text;
            PharmCur.PharmID   = "";
            PharmCur.Phone     = textPhone.Text;
            PharmCur.Fax       = textFax.Text;
            PharmCur.Address   = textAddress.Text;
            PharmCur.Address2  = textAddress2.Text;
            PharmCur.City      = textCity.Text;
            PharmCur.State     = textState.Text;
            PharmCur.Zip       = textZip.Text;
            PharmCur.Note      = textNote.Text;
            try{
                if (PharmCur.IsNew)
                {
                    Pharmacies.Insert(PharmCur);
                }
                else
                {
                    Pharmacies.Update(PharmCur);
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            //Update PharmClinic links
            List <PharmClinic> listPharmClinicOld = (List <PharmClinic>)comboClinic.Tag;
            List <PharmClinic> listPharmClinicNew = new List <PharmClinic>();

            //comboClinic.All might be selected, and would result in ListSelectedClinicNums containing only the clinics showing in the combobox, which very will not include clinics that user does not have permissions for.  "All" is not separately tested for.  Because the new list is synched against the old list, clinics that aren't showing are not affected one way or the other.
            foreach (long clinicNumNew in comboClinic.ListSelectedClinicNums)
            {
                if (listPharmClinicOld.Any(x => x.ClinicNum == clinicNumNew))               //if it existed before, add it to the list
                {
                    listPharmClinicNew.Add(listPharmClinicOld.First(x => x.ClinicNum == clinicNumNew));
                }
                else                  //otherwise, create a new link.
                {
                    listPharmClinicNew.Add(new PharmClinic(PharmCur.PharmacyNum, clinicNumNew));
                }
            }
            PharmClinics.Sync(listPharmClinicNew, listPharmClinicOld);
            DialogResult = DialogResult.OK;
        }