コード例 #1
0
        private void SearchCriteriaChanged(object sender, object e)
        {
            //the comboboxes fire their change event before the form is initialized
            if (lblSearchError == null)
            {
                return;
            }

            //implement mutually exclusive text boxes... since their TextChanged event handlers all fire on eachother, this nixes the feedback loop
            //kill any pending search whenever the text is changed
            SearchTypeAhead.Cancel();

            //blank out any previously posted search errors
            lblSearchError.Text = "";

            //don't even bother searching if minimum input criteria hasn't been met
            if (
                //search input at least 3 chars
                (txtSearch.Text.Length < 3)
                )
            {
                grdResults.ItemsSource = null;
                return;
            }

            //(re)initiate search with new criteria
            SearchTypeAhead.Initiate(new SearchArgs(
                                         "SearchType", cbxSearchType.SelectedValue.ToString(),
                                         "SearchName", txtSearch.Text
                                         ), true);
        }
コード例 #2
0
        private void VendorSearchCriteriaChanged(object sender, object e)
        {
            //the comboboxes fire their change event before the form is initialized
            if (lblVendorSearchError == null)
            {
                return;
            }

            //implement mutually exclusive text boxes... since their TextChanged event handlers all fire on eachother, this nixes the feedback loop
            //kill any pending search whenever the text is changed
            VendorSearchTypeAhead.Cancel();

            //blank out any previously posted search errors
            lblVendorSearchError.Text = "";

            //don't even bother searching if minimum input criteria hasn't been met
            if (
                //VendorName at least 3 chars
                (txtVendorName.Text.Length < 3)
                )
            {
                grdVendorList.ItemsSource = null;
                return;
            }

            //(re)initiate search with new criteria
            VendorSearchTypeAhead.Initiate(new VendorSearchArgs(
                                               "VendorName", txtVendorName.Text,
                                               "VendorName_SearchType", (cbxVendorNameSearchType.SelectedItem as ComboBoxItem).Content.ToString(),
                                               "VendorCity", txtVendorCity.Text,
                                               "VendorCity_SearchType", (cbxVendorCitySearchType.SelectedItem as ComboBoxItem).Content.ToString()
                                               ), true);
        }
コード例 #3
0
        private void CustomerSearchCriteriaChanged(object sender, object e)
        {
            if (lblCustomerSearchError == null)
            {
                return;                           //comboboxes fire SelectionChanged before form has fully initialized itself
            }
            //implement mutually exclusive text boxes... since their TextChanged event handlers all fire on eachother, this nixes the feedback loop
            if (_customerSearchCriteriaChangeInProgress)
            {
                return;
            }
            _customerSearchCriteriaChangeInProgress = true;

            try
            {
                //kill any pending search whenever the text is changed
                _customerSearchTypeAhead.Cancel();

                //blank out any previously posted search errors
                lblCustomerSearchError.Text = "";

                //implement mutually exclusive text boxes... blank out whichever ones aren't currently receiving input
                if (sender != txtLastName && sender != txtFirstName)
                {
                    txtLastName.Text  = "";
                    txtFirstName.Text = "";
                }
                if (sender != txtCCode)
                {
                    txtCCode.Text = "";
                }

                if (
                    (sender != txtSSN1) && (sender != txtSSN2) && (sender != txtSSN3)
                    )
                {
                    txtSSN1.Text = "";
                    txtSSN2.Text = "";
                    txtSSN3.Text = "";
                }

                if (sender != txtDoDId)
                {
                    txtDoDId.Clear();
                }

                if (sender != txtOrderNumber)
                {
                    txtOrderNumber.Clear();
                }

                if (sender != cbxTransactionType)
                {
                    cbxTransactionType.SelectedIndex = -1;
                }

                //don't even bother searching if minimum input criteria hasn't been met
                if (
                    //Last Name - at least 3 chars
                    (txtLastName.Text.Length < 3) &&
                    //CCode - all 5 chars, since you can search by lastname or last 4 SSN via other fields
                    (txtCCode.Text.Length < 5) &&
                    //SSN - at least 3 out of last 4 digits
                    (txtSSN3.Text.Length < 3) &&
                    //DoD Id - all 10 chars
                    (txtDoDId.Text.Length < 10) &&
                    //Form# - at least 1 chars in addition to the rest - e.g. NF1-HD-09-____1
                    (txtOrderNumber.Text.Length < 1) &&
                    //if no transaction type selected
                    (cbxTransactionType.SelectedIndex == -1)
                    )
                {
                    gridCustomerSearch.ItemsSource = null;
                    return;
                }

                //(re)initiate search with new criteria
                _customerSearchTypeAhead.Initiate(new CustomerSearchArgs(
                                                      "LastName", txtLastName.Text,
                                                      "FirstName", txtFirstName.Text,
                                                      "CCode", txtCCode.Text,
                                                      "SSN", SmartFormat("%", "-", txtSSN1.Text, txtSSN2.Text, txtSSN3.Text),
                                                      "DoDId", txtDoDId.Text,
                                                      "OrderNumber", txtOrderNumber.Text,
                                                      "TransactionTypeID", cbxTransactionType.SelectedValue
                                                      ));
            }
            finally
            {
                _customerSearchCriteriaChangeInProgress = false;
            }
        }