Ejemplo n.º 1
0
        private void tb_search_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (tb_search.Text == "")
            {
                datagrid_search.ItemsSource = null;
                return;
            }

            try
            {
                datagrid_search.ItemsSource = null;

                var temp = _shipmentController.GetShipmentsWhoNoLeft();
                var data = temp.Where(t => t.Fio.ToUpper().StartsWith(tb_search.Text.ToUpper())).ToList();
                var sDOP = temp.Where(t => t.Fio.ToUpper().Contains(tb_search.Text.ToUpper())).ToList();
                data.AddRange(sDOP);
                var noDupes = data.Distinct().ToList();
                datagrid_search.ItemsSource = noDupes;

                if (noDupes.Count == 0)
                {
                    //Ничекго не нашел
                }
                else
                {
                    // Нашел
                }
            }
            catch (Exception)
            {
            }
        }