Exemplo n.º 1
0
        /// <summary>
        /// Performs the transfer from the source account to de destination account.
        /// </summary>
        private void PerformTransfer()
        {
            if (BankAccountDestination != null && BankAccountSource != null)
            {
                if (!BankAccountDestination.Locked && !BankAccountSource.Locked)
                {
                    try
                    {
                        var client = new BankingModuleServiceClient();

                        client.PerformTransferCompleted += delegate(object sender, AsyncCompletedEventArgs e)
                        {
                            if (e.Error == null)
                            {
                                BankAccountDestination = null;
                                BankTransferAmount     = 0;
                                RefreshBankAccountsStatus();
                            }
                            else if (e.Error is FaultException <ServiceError> )
                            {
                                var fault = e.Error as FaultException <ServiceError>;
                                MessageBox.Show(fault.Detail.ErrorMessage, "Error", MessageBoxButton.OK);
                            }
                            else
                            {
                                Debug.WriteLine("PerformTransfer: Error at Service:" + e.Error.ToString());
                            }
                        };

                        client.PerformTransferAsync(BankAccountSource, BankAccountDestination, BankTransferAmount);
                    }
                    catch (FaultException <ServiceError> excep)
                    {
                        Debug.WriteLine("PerformTransfer: Error at Service:" + excep.ToString());
                    }
                }
            }
        }
        /// <summary>
        /// Performs the transfer from the source account to de destination account.
        /// </summary>
        private void PerformTransfer()
        {
            if (BankAccountDestination != null && BankAccountSource != null)
            {
                if (!BankAccountDestination.Locked && !BankAccountSource.Locked)
                {
                    try
                    {
                        var client = new BankingModuleServiceClient();

                        client.PerformTransferCompleted += delegate(object sender, AsyncCompletedEventArgs e)
                                                               {
                                                                   if (e.Error == null)
                                                                   {
                                                                       BankAccountDestination = null;
                                                                       BankTransferAmount = 0;
                                                                       RefreshBankAccountsStatus();
                                                                   }
                                                                   else if (e.Error is FaultException<ServiceError>)
                                                                   {
                                                                       var fault = e.Error as FaultException<ServiceError>;
                                                                       MessageBox.Show(fault.Detail.ErrorMessage, "Error", MessageBoxButton.OK);
                                                                   }
                                                                   else
                                                                   {
                                                                       Debug.WriteLine("PerformTransfer: Error at Service:" + e.Error.ToString());
                                                                   }
                                                               };

                        client.PerformTransferAsync(BankAccountSource, BankAccountDestination, BankTransferAmount);
                    }
                    catch (FaultException<ServiceError> excep)
                    {
                        Debug.WriteLine("PerformTransfer: Error at Service:" + excep.ToString());
                    }
                }
            }
        }