Esempio n. 1
0
        private void PerformTransfer()
        {
            if (this.BankAccountDestination != null && this.BankAccountSource != null)
            {
                MainModuleServiceClient client = new MainModuleServiceClient();
                client.PerformBankTransferAsync(new TransferInformation()
                {
                    Amount = this.BankTransferAmount, OriginAccountNumber = this.BankAccountSource.BankAccountNumber, DestinationAccountNumber = this.BankAccountDestination.BankAccountNumber
                });

                client.PerformBankTransferCompleted += delegate(object s, AsyncCompletedEventArgs e)
                {
                    if (!e.Cancelled && e.Error == null)
                    {
                        this.BankAccountSource      = null;
                        this.BankAccountDestination = null;
                        this.BankTransferAmount     = 0;
                        this.RefreshBankAccountsStatus();
                    }
                    else
                    {
                        var exception = e.Error as FaultException <ServiceError>;
                        if (exception != null)
                        {
                            MessageBox.Show(exception.Detail.ErrorMessage, "Perform Transfer", MessageBoxButton.OK);
                        }
                        else
                        {
                            MessageBox.Show(e.Error.Message, "Perform Transfer", MessageBoxButton.OK);
                        }
                    }
                };
            }
        }
        private void PerformTransfer()
        {
            if (this.BankAccountDestination != null && this.BankAccountSource != null)
            {
                MainModuleServiceClient client = new MainModuleServiceClient();
                client.PerformBankTransferAsync(new TransferInformation() { Amount = this.BankTransferAmount, OriginAccountNumber = this.BankAccountSource.BankAccountNumber, DestinationAccountNumber = this.BankAccountDestination.BankAccountNumber });

                client.PerformBankTransferCompleted += delegate(object s, AsyncCompletedEventArgs e)
                {
                    if (!e.Cancelled && e.Error == null)
                    {
                        this.BankAccountSource = null;
                        this.BankAccountDestination = null;
                        this.BankTransferAmount = 0;
                        this.RefreshBankAccountsStatus();
                    }
                    else
                    {
                        var exception = e.Error as FaultException<ServiceError>;
                        if (exception != null)
                            MessageBox.Show(exception.Detail.ErrorMessage, "Perform Transfer", MessageBoxButton.OK);
                        else
                            MessageBox.Show(e.Error.Message, "Perform Transfer", MessageBoxButton.OK);
                    }
                };

            }
        }