private void importStringMappingButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "CSV file (*.csv)|*.csv|Text file (*.txt)|*.txt"; List <CheckinTag> import = new List <CheckinTag>(); if (dialog.ShowDialog() == true) { int count = 0; try { FileHelperEngine <CheckinTag> engine = new FileHelperEngine <CheckinTag>(); import.AddRange(engine.ReadFile(dialog.FileName)); } catch (Exception exc) { ShowFailStatus($"There is a problem with the csv. Import has been aborted."); return; } for (int i = 0; i < import.Count; i++) { try { DatabaseUtility.InsertCheckinTag(import[i]); count++; } catch (Exception exc) { ShowFailStatus($"Trouble importing row {i + 2} from {dialog.FileName}"); } } ShowSuccessStatus($"Imported {count}/{import.Count} rows"); UpdateCheckinTagDg(); } }
private void UpdateCheckinTagDg() { dgCheckinTags.DataContext = DatabaseUtility.SelectCheckinTags(); }
private void tiCheckinView_Loaded(object sender, RoutedEventArgs e) { dgCheckins.DataContext = DatabaseUtility.SelectDownloadedCheckins(); }
private void CountRowsByTagCodeButton_Click(object sender, RoutedEventArgs e) { DataTable dt = DatabaseUtility.TagCodeCountWithCheckinTags(); dgTagCodeCount.DataContext = dt; }