async Task LoadCheckingWithdrawalsAsync(bool getReconciled = false) { using (UnitOfWork uow = new UnitOfWork(this.dbFilePath)) { var _results = await uow.GetCheckingWithdrawalsAsync(model.id, getReconciled); if (_results.Successful) { foreach (var withdrawal in _results.Results) { withdrawal.checkingAccount = model as CheckingAccount; CheckingWithdrawalViewModel vm = new CheckingWithdrawalViewModel(this.dbFilePath); vm.IsNew = false; vm.CanEdit = true; vm.CanDelete = true; await vm.PopulateVMAsync(withdrawal); vm.ItemUpdated += OnRegisterUpdated; this.AccountRegister.Add(vm); } } else { if (_results.WorkException != null) { WriteErrorCondition(_results.WorkException); } else if (!string.IsNullOrEmpty(_results.Message)) { WriteErrorCondition(_results.Message); } else { WriteErrorCondition("An unknown error has occurred loading withdrawal records"); } } } }
async Task <CheckingWithdrawalViewModel> AddCheckingWithdrawalAsync() { CheckingWithdrawalViewModel vm = new CheckingWithdrawalViewModel(this.dbFilePath); vm.IsNew = true; vm.CanEdit = true; vm.CanDelete = false; vm.ItemType = AccountRegisterItemViewModel.AccountItemType.Withdrawals; CheckingWithdrawal withdrawal = new CheckingWithdrawal(); withdrawal.checkingAccount = model as CheckingAccount; withdrawal.checkingAccountId = model.id; withdrawal.transactionDate = DateTime.Now; await vm.PopulateVMAsync(withdrawal); //this.AccountRegister.Add(vm); //await GroupAccountItemsAsync(); //this.SelectedRegisterItem = vm; return(vm); }