private void addExpenseBtn_MouseDown(object sender, MouseButtonEventArgs e) { var addExpenseDialog = new AddExpenseDialog(); if (addExpenseDialog.ShowDialog() == true) { var newExpense = addExpenseDialog.NewExpense; trip.Expenses.Add(newExpense); TripDAO.InsertExpense(idTrip, newExpense); DisplayDetail(); DisplayCostChart(); } }
private void editExpenseBtn_MouseDown(object sender, MouseButtonEventArgs e) { var idExpense = ((Image)sender).Uid; var expenseCurrent = TripDAO.GetExpenseById(idTrip, idExpense); var addExpenseDialog = new AddExpenseDialog(); addExpenseDialog.NewExpense = expenseCurrent; if (addExpenseDialog.ShowDialog() == true) { var newExpense = addExpenseDialog.NewExpense; TripDAO.RemoveExpense(idTrip, idExpense); TripDAO.InsertExpense(idTrip, newExpense); DisplayDetail(); DisplayCostChart(); MessageBox.Show("Đã cập nhật thành công!"); } }