private void СобытийТаблицаDataGrid_Loaded(object sender, RoutedEventArgs e) { _sqlLogStuctures = SqlLogStucture.LogStuctures(); var sqlLogStuctures = _sqlLogStuctures as IList <SqlLogStucture> ?? _sqlLogStuctures.ToList(); SqlLogStuctures = sqlLogStuctures; ТаблицаДанных.ItemsSource = SqlLogStucture.LogStuctures(); SqlLog.Header = "SQL " + SqlLogStucture.LogStuctures().Count() + " записи(ей)"; Имя.ItemsSource = sqlLogStuctures.GroupBy(i => i.UserName).Where(i => i.Count() > 1).ToList(); Имя.SelectedValuePath = "UserName"; Имя.DisplayMemberPath = "UserName"; Имя.SelectedIndex = -1; Дата.ItemsSource = sqlLogStuctures.GroupBy(i => i.ErrorTime.ToShortDateString()).Where(i => i.Count() > 1).ToList(); Дата.SelectedValuePath = "ErrorTime"; Дата.DisplayMemberPath = "ErrorTime"; Дата.ItemStringFormat = "dd-MM-yyyy"; Дата.SelectedIndex = -1; ИмяКласса.ItemsSource = sqlLogStuctures.GroupBy(i => i.ErrorModule).Where(i => i.Count() > 1).ToList(); ИмяКласса.SelectedValuePath = "ErrorModule"; ИмяКласса.DisplayMemberPath = "ErrorModule"; ИмяКласса.SelectedIndex = -1; УровеньCombo.ItemsSource = sqlLogStuctures.GroupBy(i => i.ErrorState).Where(i => i.Count() > 1).ToList(); УровеньCombo.SelectedValuePath = "ErrorState"; УровеньCombo.DisplayMemberPath = "ErrorState"; УровеньCombo.SelectedIndex = -1; }
/// <summary> /// Initializes a new instance of the <see cref="LoggerUc"/> class. /// </summary> public LoggerUc() { InitializeComponent(); UpdateContext(SqlLogStucture.LogStuctures().ToList()); УровеньКомбо.ItemsSource = new[] { "ALL", "INFO", "DEBUG", "ERROR", "TRACE", "WARN" }; УровеньКомбо.SelectedIndex = 0; App.ElementVisibility.ForUiElementsList( new List <UIElement> { Информация, УровеньGrid, Классы, ДатаВыборка, NLogGrid, SqlLog }, Visibility.Collapsed); }
private void button_Click_2(object sender, RoutedEventArgs e) { try { var list = SqlLogStucture.LogStuctures(). Where(x => x.UserName.ToLower().Contains("kb81")). ToList(); if (list.Count == 0) { return; } UpdateContext(list); } catch (Exception exception) { MessageBox.Show(exception.Message); } }