예제 #1
0
        private void textZip_Validating(object sender, CancelEventArgs e)
        {
            //fired as soon as control loses focus.
            //it's here to validate if zip is typed in to text box instead of picked from list.
            if (textZip.Text.Length < 5)
            {
                return;
            }
            if (comboZip.SelectedIndex != -1)
            {
                return;
            }
            //the autofill only works if both city and state are left blank
            if (textCity.Text != "" || textState.Text != "")
            {
                return;
            }
            List <ZipCode> listZipCodes = ZipCodes.GetALMatches(textZip.Text);

            if (listZipCodes.Count == 0)
            {
                //No match found. Must enter info for new zipcode
                ZipCode ZipCodeCur = new ZipCode();
                ZipCodeCur.ZipCodeDigits = textZip.Text;
                FormZipCodeEdit FormZE = new FormZipCodeEdit();
                FormZE.ZipCodeCur = ZipCodeCur;
                FormZE.IsNew      = true;
                FormZE.ShowDialog();
                if (FormZE.DialogResult != DialogResult.OK)
                {
                    return;
                }
                DataValid.SetInvalid(InvalidType.ZipCodes);                //FormZipCodeEdit does not contain internal refresh
                FillComboZip();
                textCity.Text  = ZipCodeCur.City;
                textState.Text = ZipCodeCur.State;
                textZip.Text   = ZipCodeCur.ZipCodeDigits;
            }
            else if (listZipCodes.Count == 1)
            {
                //only one match found.  Use it.
                textCity.Text  = ((ZipCode)listZipCodes[0]).City;
                textState.Text = ((ZipCode)listZipCodes[0]).State;
            }
            else
            {
                //multiple matches found.  Pick one
                FormZipSelect FormZS = new FormZipSelect();
                FormZS.ShowDialog();
                FillComboZip();
                if (FormZS.DialogResult != DialogResult.OK)
                {
                    return;
                }
                DataValid.SetInvalid(InvalidType.ZipCodes);
                textCity.Text  = FormZS.ZipSelected.City;
                textState.Text = FormZS.ZipSelected.State;
                textZip.Text   = FormZS.ZipSelected.ZipCodeDigits;
            }
        }
예제 #2
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            FormZipCodeEdit FormZCE = new FormZipCodeEdit();

            FormZCE.ZipCodeCur = new ZipCode();
            FormZCE.IsNew      = true;
            FormZCE.ShowDialog();
            if (FormZCE.DialogResult != DialogResult.OK)
            {
                return;
            }
            changed = true;
            FillTable();
        }
예제 #3
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            FormZipCodeEdit FormZCE = new FormZipCodeEdit();

            FormZCE.ZipCodeCur = new ZipCode();
            FormZCE.ZipCodeCur.ZipCodeDigits = (_listZipCodes[0]).ZipCodeDigits;
            FormZCE.IsNew = true;
            FormZCE.ShowDialog();
            if (FormZCE.DialogResult != DialogResult.OK)
            {
                return;
            }
            changed = true;
            ZipCodes.RefreshCache();
            ZipCodes.GetALMatches(FormZCE.ZipCodeCur.ZipCodeDigits);
            FillList();
        }
예제 #4
0
        private void tbZips_CellDoubleClicked(object sender, CellEventArgs e)
        {
            if (tbZips.SelectedRow == -1)
            {
                return;
            }
            FormZipCodeEdit FormZCE = new FormZipCodeEdit();

            FormZCE.ZipCodeCur = ZipCodes.List[tbZips.SelectedRow];
            FormZCE.ShowDialog();
            if (FormZCE.DialogResult != DialogResult.OK)
            {
                return;
            }
            changed = true;
            FillTable();
        }
예제 #5
0
        private void gridZipCode_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            if (gridZipCode.SelectedIndices.Length == 0)
            {
                return;
            }
            FormZipCodeEdit FormZCE = new FormZipCodeEdit();

            FormZCE.ZipCodeCur = (ZipCode)gridZipCode.ListGridRows[e.Row].Tag;
            FormZCE.ShowDialog();
            if (FormZCE.DialogResult != DialogResult.OK)
            {
                return;
            }
            changed = true;
            FillGrid();
        }
예제 #6
0
        private void butEdit_Click(object sender, System.EventArgs e)
        {
            if (listMatches.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select an item first."));
                return;
            }
            FormZipCodeEdit FormZCE = new FormZipCodeEdit();

            FormZCE.ZipCodeCur = _listZipCodes[listMatches.SelectedIndex];
            FormZCE.ShowDialog();
            if (FormZCE.DialogResult != DialogResult.OK)
            {
                return;
            }
            changed = true;
            ZipCodes.RefreshCache();
            ZipCodes.GetALMatches(FormZCE.ZipCodeCur.ZipCodeDigits);
            FillList();
        }
예제 #7
0
        private void butEditZip_Click(object sender, EventArgs e)
        {
            if (textZip.Text.Length == 0)
            {
                MessageBox.Show(Lan.g(this, "Please enter a zipcode first."));
                return;
            }
            List <ZipCode> listZipCodes = ZipCodes.GetALMatches(textZip.Text);

            if (listZipCodes.Count == 0)
            {
                FormZipCodeEdit FormZE = new FormZipCodeEdit();
                FormZE.ZipCodeCur = new ZipCode();
                FormZE.ZipCodeCur.ZipCodeDigits = textZip.Text;
                FormZE.IsNew = true;
                FormZE.ShowDialog();
                FillComboZip();
                if (FormZE.DialogResult != DialogResult.OK)
                {
                    return;
                }
                DataValid.SetInvalid(InvalidType.ZipCodes);
                textCity.Text  = FormZE.ZipCodeCur.City;
                textState.Text = FormZE.ZipCodeCur.State;
                textZip.Text   = FormZE.ZipCodeCur.ZipCodeDigits;
            }
            else
            {
                FormZipSelect FormZS = new FormZipSelect();
                FormZS.ShowDialog();
                FillComboZip();
                if (FormZS.DialogResult != DialogResult.OK)
                {
                    return;
                }
                textCity.Text  = FormZS.ZipSelected.City;
                textState.Text = FormZS.ZipSelected.State;
                textZip.Text   = FormZS.ZipSelected.ZipCodeDigits;
            }
        }
예제 #8
0
		private void butEdit_Click(object sender, System.EventArgs e) {
			if(listMatches.SelectedIndex==-1){
				MessageBox.Show(Lan.g(this,"Please select an item first."));
				return;
			}
			FormZipCodeEdit FormZCE=new FormZipCodeEdit();
			FormZCE.ZipCodeCur=(ZipCode)ZipCodes.ALMatches[listMatches.SelectedIndex];
			FormZCE.ShowDialog();
			if(FormZCE.DialogResult!=DialogResult.OK){
				return;
			}
			changed=true;
			ZipCodes.RefreshCache();
			ZipCodes.GetALMatches(FormZCE.ZipCodeCur.ZipCodeDigits);
			FillList();
		}
예제 #9
0
		private void butAdd_Click(object sender, System.EventArgs e) {
			FormZipCodeEdit FormZCE=new FormZipCodeEdit();
			FormZCE.ZipCodeCur=new ZipCode();
			FormZCE.ZipCodeCur.ZipCodeDigits=((ZipCode)ZipCodes.ALMatches[0]).ZipCodeDigits;
			FormZCE.IsNew=true;
			FormZCE.ShowDialog();
			if(FormZCE.DialogResult!=DialogResult.OK){
				return;
			}
			changed=true;
			ZipCodes.RefreshCache();
			ZipCodes.GetALMatches(FormZCE.ZipCodeCur.ZipCodeDigits);
			FillList();
		}
예제 #10
0
 private void textZip_Validating(object sender, System.ComponentModel.CancelEventArgs e)
 {
     //fired as soon as control loses focus.
     //it's here to validate if zip is typed in to text box instead of picked from list.
     //if(textZip.Text=="" && (textCity.Text!="" || textState.Text!="")){
     //	if(MessageBox.Show(Lan.g(this,"Delete the City and State?"),"",MessageBoxButtons.OKCancel)
     //		==DialogResult.OK){
     //		textCity.Text="";
     //		textState.Text="";
     //	}
     //	return;
     //}
     if(textZip.Text.Length<5){
         return;
     }
     if(comboZip.SelectedIndex!=-1){
         return;
     }
     //the autofill only works if both city and state are left blank
     if(textCity.Text!="" || textState.Text!=""){
         return;
     }
     ZipCodes.GetALMatches(textZip.Text);
     if(ZipCodes.ALMatches.Count==0){
         //No match found. Must enter info for new zipcode
         ZipCode ZipCodeCur=new ZipCode();
         ZipCodeCur.ZipCodeDigits=textZip.Text;
         FormZipCodeEdit FormZE=new FormZipCodeEdit();
         FormZE.ZipCodeCur=ZipCodeCur;
         FormZE.IsNew=true;
         FormZE.ShowDialog();
         if(FormZE.DialogResult!=DialogResult.OK){
             return;
         }
         DataValid.SetInvalid(InvalidType.ZipCodes);//FormZipCodeEdit does not contain internal refresh
         FillComboZip();
         textCity.Text=ZipCodeCur.City;
         textState.Text=ZipCodeCur.State;
         textZip.Text=ZipCodeCur.ZipCodeDigits;
     }
     else if(ZipCodes.ALMatches.Count==1){
         //only one match found.  Use it.
         textCity.Text=((ZipCode)ZipCodes.ALMatches[0]).City;
         textState.Text=((ZipCode)ZipCodes.ALMatches[0]).State;
     }
     else{
         //multiple matches found.  Pick one
         FormZipSelect FormZS=new FormZipSelect();
         FormZS.ShowDialog();
         FillComboZip();
         if(FormZS.DialogResult!=DialogResult.OK){
             return;
         }
         DataValid.SetInvalid(InvalidType.ZipCodes);
         textCity.Text=FormZS.ZipSelected.City;
         textState.Text=FormZS.ZipSelected.State;
         textZip.Text=FormZS.ZipSelected.ZipCodeDigits;
     }
 }
예제 #11
0
 private void butEditZip_Click(object sender, System.EventArgs e)
 {
     if(textZip.Text.Length==0){
         MessageBox.Show(Lan.g(this,"Please enter a zipcode first."));
         return;
     }
     ZipCodes.GetALMatches(textZip.Text);
     if(ZipCodes.ALMatches.Count==0){
         FormZipCodeEdit FormZE=new FormZipCodeEdit();
         FormZE.ZipCodeCur=new ZipCode();
         FormZE.ZipCodeCur.ZipCodeDigits=textZip.Text;
         FormZE.IsNew=true;
         FormZE.ShowDialog();
         FillComboZip();
         if(FormZE.DialogResult!=DialogResult.OK){
             return;
         }
         DataValid.SetInvalid(InvalidType.ZipCodes);
         textCity.Text=FormZE.ZipCodeCur.City;
         textState.Text=FormZE.ZipCodeCur.State;
         textZip.Text=FormZE.ZipCodeCur.ZipCodeDigits;
     }
     else{
         FormZipSelect FormZS=new FormZipSelect();
         FormZS.ShowDialog();
         FillComboZip();
         if(FormZS.DialogResult!=DialogResult.OK){
             return;
         }
         //Not needed:
         //DataValid.SetInvalid(InvalidTypes.ZipCodes);
         textCity.Text=FormZS.ZipSelected.City;
         textState.Text=FormZS.ZipSelected.State;
         textZip.Text=FormZS.ZipSelected.ZipCodeDigits;
     }
 }
예제 #12
0
파일: FormZipCodes.cs 프로젝트: mnisl/OD
		private void butAdd_Click(object sender, System.EventArgs e) {
			FormZipCodeEdit FormZCE=new FormZipCodeEdit();
			FormZCE.ZipCodeCur=new ZipCode();
			FormZCE.IsNew=true;
			FormZCE.ShowDialog();
			if(FormZCE.DialogResult!=DialogResult.OK){
				return;
			}
			changed=true;
			FillTable(); 				
		}
예제 #13
0
파일: FormZipCodes.cs 프로젝트: mnisl/OD
		private void tbZips_CellDoubleClicked(object sender, CellEventArgs e){
			if(tbZips.SelectedRow==-1){
				return;
			}
      FormZipCodeEdit FormZCE=new FormZipCodeEdit();
			FormZCE.ZipCodeCur=ZipCodes.List[tbZips.SelectedRow];
			FormZCE.ShowDialog();
			if(FormZCE.DialogResult!=DialogResult.OK){
				return;
			}
			changed=true;
			FillTable(); 
		}