Beispiel #1
0
        private void OnEditInvestorCommitmentResponse(EditInvestorCommitmentResponse response)
        {
            switch (response.ActionType)
            {
            case "OK":
            {
                if (response.editedCommitment.Id == 0)
                {
                    Commitments.Add(response.editedCommitment);
                    try
                    {
                        investorAccess.UpdateInvestorCommitments(response.editedCommitment);
                    }
                    catch (Exception ex)
                    {
                        NotificationRequest.Raise(new Notification
                            {
                                Title   = "Commitment ",
                                Content = $"Fehler beim Update der Datenbank: {ex.Message}"
                            });
                        return;
                    }
                }
                else
                {
                    try
                    {
                        investorAccess.UpdateInvestorCommitments(SelectedCommitment);
                    }
                    catch (Exception ex)
                    {
                        NotificationRequest.Raise(new Notification
                            {
                                Title   = "Commitment ",
                                Content = $"Fehler beim Update der Datenbank: {ex.Message}"
                            });
                        return;
                    }
                }
                string message = $"Commitment für {SelectedCommitment.PeFund.FundShortName} wurde eingefügt bzw. geändert";
                eventAggregator.GetEvent <StatusBarEvent>().Publish(message);
                break;
            }

            case "Cancel":
            {
                NotificationRequest.Raise(new Notification
                    {
                        Title   = "Commitment ",
                        Content = $"Edit Response was Cancel"
                    });
                string message = $"Änderungen wurden nicht gespeichert.";
                eventAggregator.GetEvent <StatusBarEvent>().Publish(message);
                break;
            }
            }
            EditCommitmentWindowState = WindowState.Closed;
        }
        private void OnCancelButton()
        {
            InvestorCommitment = new InvestorCommitment(copyOfInvestorCommitment);
            EditInvestorCommitmentResponse response = new EditInvestorCommitmentResponse()
            {
                ActionType       = "Cancel",
                editedCommitment = null
            };

            eventAggregator.GetEvent <EditInvestorCommitmentResponseEvent>().Publish(response);
        }
        private void OnOKButton()
        {
            InvestorCommitment.InvestorCommitmentDetails = new System.Collections.Generic.List <InvestorCommitmentDetail>();
            foreach (InvestorCommitmentDetail detail in InvestorCommitmentDetails)
            {
                InvestorCommitment.InvestorCommitmentDetails.Add(detail);
            }

            EditInvestorCommitmentResponse response = new EditInvestorCommitmentResponse()
            {
                ActionType       = "OK",
                editedCommitment = InvestorCommitment
            };

            eventAggregator.GetEvent <EditInvestorCommitmentResponseEvent>().Publish(response);
        }