private void BtnAdd_Click(object sender, RoutedEventArgs e) { switch (currentTable) { case "Worker": WorkerWindow workerWindow = new WorkerWindow(); workerWindow.ShowDialog(); MenuItem_Click(sender, e); //update table break; case "Division": DivisionWindow divisionWindow = new DivisionWindow(); divisionWindow.ShowDialog(); MenuItem_Click_1(sender, e); break; case "ExpenseByWorker": ExpenseWindow expenseWindow = new ExpenseWindow(); expenseWindow.ShowDialog(); MenuItem_Click_3(sender, e); break; case "TypeExpense": TypeExpenseWindow typeExpenseWindow = new TypeExpenseWindow(); typeExpenseWindow.ShowDialog(); MenuItem_Click_4(sender, e); break; } }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { switch (currentTable) { case "Worker": WorkerDto workerDto = (WorkerDto)dgMain.SelectedItem; if (workerDto != null) { WorkerWindow workerWindow = new WorkerWindow(); workerWindow.Load(workerDto); workerWindow.ShowDialog(); MenuItem_Click(sender, e); //update table } break; case "Division": DivisionDto divisionDto = (DivisionDto)dgMain.SelectedItem; if (divisionDto != null) { DivisionWindow divisionWindow = new DivisionWindow(); divisionWindow.Load(divisionDto); divisionWindow.ShowDialog(); MenuItem_Click_1(sender, e); } break; case "ExpenseByWorker": ExpenseDto expenseDto = (ExpenseDto)dgMain.SelectedItem; if (expenseDto != null) { ExpenseWindow expenseWindow = new ExpenseWindow(); expenseWindow.Load(expenseDto); expenseWindow.ShowDialog(); MenuItem_Click_3(sender, e); } break; case "TypeExpense": TypeExpenseDto typeExpenseDto = (TypeExpenseDto)dgMain.SelectedItem; if (typeExpenseDto != null) { TypeExpenseWindow typeExpenseWindow = new TypeExpenseWindow(); typeExpenseWindow.Load(typeExpenseDto); typeExpenseWindow.ShowDialog(); MenuItem_Click_4(sender, e); } break; } }