private void OnConfirmationResponse(IConfirmation obj) { if (!obj.Confirmed) { return; } // Investor wird gelöscht try { investorAccess.RemoveInvestor(Investor); } catch (Exception ex) { NotificationRequest.Raise(new Notification() { Title = ApplicationNames.NotificationTitle, Content = ex.Message }); return; } // InvestorSelection wird informiert InvestorCollectionAction parameter = new InvestorCollectionAction() { action = CollectionAction.removed, investor = Investor }; eventAggregator.GetEvent <InvestorCollectionActionEvent>().Publish(parameter); // Unsubscribe Event(s) eventAggregator.GetEvent <AccountCollectionEvent>().Unsubscribe(accountListToken); // get the current active view (myself) and remove that view from tabcontrol var view = regionManager.Regions[RegionNames.TabControlRegion].ActiveViews.ElementAt(0); regionManager.Regions[RegionNames.TabControlRegion].Remove(view); }
private void UpdateOrInsertInvestor() { try { if (Investor.Id == 0) { investorAccess.InsertInvestor(Investor); //InvestorSelection will be informed about a new Investor to add the new investor to its list InvestorCollectionAction parameter = new InvestorCollectionAction() { action = CollectionAction.added, investor = Investor }; eventAggregator.GetEvent <InvestorCollectionActionEvent>().Publish(parameter); eventAggregator.GetEvent <StatusBarEvent>().Publish($"Der Investor {Investor.InvestorReference} wurde in die Datenbank eingetragen"); } else { // update investor investorAccess.UpdateInvestor(Investor); //InvestorSelection will be informed about changes of an Investor to show the new information InvestorCollectionAction parameter = new InvestorCollectionAction() { action = CollectionAction.updated, investor = Investor }; eventAggregator.GetEvent <InvestorCollectionActionEvent>().Publish(parameter); eventAggregator.GetEvent <StatusBarEvent>().Publish($"Der Investor {Investor.IName.FullName} wurde in der Datenbank geändert"); } } catch (Exception ex) { NotificationRequest.Raise(new Notification() { Title = ApplicationNames.NotificationTitle, Content = ex.Message }); } }
private async void OnInvestorCollectionAction(InvestorCollectionAction obj) { if (obj.action == CollectionAction.removed) { Investor investor = investors.FirstOrDefault(i => i.Id == obj.investor.Id); investors.Remove(investor); } else if (obj.action == CollectionAction.added) { investors.Add(obj.investor); } else if (obj.action == CollectionAction.updated) { Investor investor = investors.FirstOrDefault(i => i.Id == obj.investor.Id); investor.InvestorHqTrustAccount = obj.investor.InvestorHqTrustAccount; investor.InvestorReference = obj.investor.InvestorReference; investor.IName.FullName = obj.investor.IName.FullName; } else if (obj.action == CollectionAction.reload) { await LoadInvestorsAsync(); } }