示例#1
0
        //NAME        : searchByPhoneNumber_Click
        //DESCRIPTION : checks input validity, searches for customer by phone number, displays results
        //PARAMETERS  : object sender, RoutedEventArgs e
        //RETURNS     : void
        private void searchByPhoneNumber_Click(object sender, RoutedEventArgs e)
        {
            string pn = pnSearchText.Text;

            if (!Regex.IsMatch(pn, @"^[0-9]+$"))
            {
                MessageBox.Show("Phone number should contain only 11 numbers", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            CustomerSearch window = new CustomerSearch();

            window.display(new DataManager().getCustomersByPhone(pn));
            window.Show();
        }
示例#2
0
        //NAME        : searchByLastName_Click
        //DESCRIPTION : checks input validity, searches for customer by last name, displays results
        //PARAMETERS  : object sender, RoutedEventArgs e
        //RETURNS     : void
        private void searchByLastName_Click(object sender, RoutedEventArgs e)
        {
            string ln = lnSearchText.Text;

            if (!Regex.IsMatch(ln, @"^[a-zA-Z]+$"))
            {
                MessageBox.Show("Last name should contain letters only", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            DataManager manager = new DataManager();

            CustomerSearch window = new CustomerSearch();

            window.display(new DataManager().getCustomersByLastname(ln));
            window.Show();
        }