internal void CancelEdit()
 {
     if (Expense.Id == -1)
     {
         AllExpenses.Remove(Expense);
     }
     else
     {
         Expense.Category     = ExpenseBackup.Category;
         Expense.Description  = ExpenseBackup.Description;
         Expense.TotalCost    = ExpenseBackup.TotalCost;
         Expense.TaxComponent = ExpenseBackup.TaxComponent;
         Expense.Date         = ExpenseBackup.Date;
         Expense.DocumentName = ExpenseBackup.DocumentName;
         Expense.Invoice      = ExpenseBackup.Invoice;
     }
 }
Beispiel #2
0
        private async void deleteE_E(object obj)
        {
            try
            {
                if (allExpenceSelectedId == null || allExpenceSelectedId < 0)
                {
                    MessageBox.Show("Please Select an Expense to delete");
                    return;
                }

                if (MessageBox.Show("Are you sure you want to delete the selected Expense", "Confirm Delete", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    db.Expenses.Remove(db.Expenses.Find(allExpenceSelectedId));
                    await db.SaveChangesAsync();

                    AllExpenses.Remove(db.Expenses.Find(allExpenceSelectedId));
                    AllExpensesShadow.Remove(db.Expenses.Find(allExpenceSelectedId));
                    RefreshExpenses();
                }
            }
            catch
            {
            }
        }