async Task <SavingsWithdrawalViewModel> AddSavingsWithdrawalAsync() { SavingsWithdrawalViewModel vm = new SavingsWithdrawalViewModel(this.dbFilePath); vm.IsNew = true; vm.CanEdit = true; vm.CanDelete = false; vm.ItemType = AccountRegisterItemViewModel.AccountItemType.Withdrawals; SavingsWithdrawal withdrawal = new SavingsWithdrawal(); withdrawal.savingsAccount = model as SavingsAccount; withdrawal.savingsAccountId = model.id; withdrawal.transactionDate = DateTime.Now; await vm.PopulateVMAsync(withdrawal); //this.AccountRegister.Add(vm); //await GroupAccountItemsAsync(); //this.SelectedRegisterItem = vm; return(vm); }
async Task LoadSavingsWithdrawalsAsync(bool getReconciled = false) { using (UnitOfWork uow = new UnitOfWork(this.dbFilePath)) { var _results = await uow.GetSavingsWithdrawalsAsync(model.id, getReconciled); if (_results.Successful) { foreach (var withdrawal in _results.Results) { withdrawal.savingsAccount = model as SavingsAccount; SavingsWithdrawalViewModel vm = new SavingsWithdrawalViewModel(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"); } } } }