private void Remove_Item(object sender, RoutedEventArgs e) { var button = sender as DependencyObject; while ((button != null) && !(button is DataGridRow)) { button = VisualTreeHelper.GetParent(button); } if (button is DataGridRow) { Console.WriteLine("YESH"); DataGridRow cell = button as DataGridRow; TextBlock potatoe = LogTable.Columns[0].GetCellContent(cell) as TextBlock; LogsDAO logsdb = new LogsDAO(); Boolean checker = logsdb.deleteLogFromTable(potatoe.Text); if (checker) { SY_TagDAO tagdb = new SY_TagDAO(); tagdb.deleteTagFile(potatoe.Text); Console.WriteLine("It works!"); FillDataGrid(); } else { Console.WriteLine("It does not work"); } } }
private void Remove_Row(object sender, RoutedEventArgs e) { var button = sender as DependencyObject; while ((button != null) && !(button is DataGridRow)) { button = VisualTreeHelper.GetParent(button); } if (button is DataGridRow) { Console.WriteLine("YOSH"); DataGridRow cell = button as DataGridRow; TextBlock potatoe = CaseTable.Columns[0].GetCellContent(cell) as TextBlock; CaseDAO Case = new CaseDAO(); int caseId = Case.getCaseId(potatoe.Text); LogsDAO logs = new LogsDAO(); SY_TagDAO tagdb = new SY_TagDAO(); String logName = logs.getLogName(caseId); Boolean checker3 = tagdb.deleteTagFile(logName); Boolean checker = logs.deleteThroughIdFromTable(caseId); Boolean checker2 = Case.deleteCaseFromTable(potatoe.Text); if (checker && checker2 && checker3) { Console.WriteLine("WORKS"); FillDataGrid(); } } else { Console.WriteLine("No Works"); } }