Exemplo n.º 1
0
 private void Дата_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (Дата.SelectedValue == null)
     {
         return;
     }
     Время     = Convert.ToDateTime(Дата.SelectedValue);
     _tempList = SqlLogStuctures.Where(x => x.ErrorTime == Время).ToList();
     ФильтрацияТаблициДанных();
 }
Exemplo n.º 2
0
 private void ВсеПользователи_Click(object sender, RoutedEventArgs e)
 {
     if (ВсеПользователи.IsChecked == true)
     {
         Имя.IsEnabled = true;
         ФильтрацияТаблициДанных();
     }
     else
     {
         ТаблицаДанных.ItemsSource = SqlLogStuctures;
         SqlLog.Header             = "SQL " + SqlLogStuctures.Count() + " записи(ей)";
         Имя.IsEnabled             = false;
     }
 }
Exemplo n.º 3
0
        void ФильтрацияТаблициДанных()
        {
            //http://answerstop.org/question/77212/wpf-datagrid-is-filled-except-when-i-use-linq-to-filter-its-items
            if (SqlLogStuctures == null)
            {
                return;
            }

            //var _tempList = SqlLogStuctures;
            _tempList = SqlLogStuctures;


            if (Пользователь != null)
            {
                _tempList = SqlLogStuctures.Where(x => x.UserName == Пользователь).ToList();
            }

            //if (Класс != null)
            //{
            //    _tempList = _tempList.Where(x => x.errorModule == Класс).ToList();
            //}

            //if (Уровень != null)
            //{
            //    _tempList = _tempList.Where(x => x.errorState == Уровень).ToList();
            //}

            //_tempList = Информация.IsChecked == true ? _tempList.Where(x => x.errorState == "Info").ToList() : _tempList.ToList();

            if (Ошибки.IsChecked == true)
            {
                _tempList = _tempList.Where(x => x.ErrorState == "Error").ToList();
            }

            //MessageBox.Show("Уровень " + Уровень + SqlLogStuctures.Count + "  " + _tempList.Count);

            //if (Время.ToShortDateString() != "")
            //{
            //    _tempList = _tempList.Where(x => x.errorTime.ToShortDateString() == Время.ToShortDateString()).ToList();
            //}

            //ТаблицаДанных.ItemsSource = SqlLogStuctures;
            //MessageBox.Show("_tempList");

            ТаблицаДанных.ItemsSource = _tempList;

            if (ТаблицаДанных.Items.Count <= 0)
            {
                return;
            }
            var border = VisualTreeHelper.GetChild(ТаблицаДанных, 0) as Decorator;

            if (border == null)
            {
                return;
            }
            var scroll = border.Child as ScrollViewer;

            scroll?.ScrollToEnd();


            SqlLog.Header = "SQL " + _tempList.Count + " записи(ей)";

            //ТаблицаДанных.ItemsSource = SqlLogStucture.LogStuctures().
            //    Where(x => x.userName == Пользователь).
            //    Where(x => x.errorModule == Класс).
            //    Where(x => x.errorFunction == Уровень).
            //    Where(x => x.errorTime.ToShortDateString() == Время.ToShortDateString());
        }