private void button1_Click(object sender, RoutedEventArgs e) { string Para1 = Parameter1.GetLineText(0); string Para2 = Parameter2.GetLineText(0); string Para3 = Parameter3.GetLineText(0); if (type.CompareTo("Person") == 0) { if (PersonID) { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchPersonID(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } if (PersonName) { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchPersonName(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } } else if (type.CompareTo("Vehicle") == 0) { ResponseBlock.Visibility = Visibility.Visible; ResponseBlock2.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchVehicle(Para3).DefaultView; ResponseBlock2.ItemsSource = SF.SearchVHR(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } else if (type.CompareTo("Part") == 0) { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchPart(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } else { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchSale(Para1, Para2, Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } }
private void button1_Click(object sender, RoutedEventArgs e) { string Para1 = Parameter1.GetLineText(0); string Para2 = Parameter2.GetLineText(0); string Para3 = Parameter3.GetLineText(0); if (type.CompareTo("Person") == 0) { if (PersonID) { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchPersonID(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } if (PersonName) { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchPersonName(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } } else if (type.CompareTo("Vehicle") == 0) { ResponseBlock.Visibility = Visibility.Visible; ResponseBlock2.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchVehicle(Para3).DefaultView; ResponseBlock2.ItemsSource = SF.SearchVHR(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } else if (type.CompareTo("Part") == 0) { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchPart(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } else { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchSale(Para1, Para2, Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } }