示例#1
0
        /// <summary>
        /// Locks the selected account.
        /// </summary>
        private void LockAccount()
        {
            if (this.BankAccountSource != null)
            {
                try
                {
                    var client = new BankingModuleServiceClient();

                    client.LockBankAccountCompleted += delegate(object sender, LockBankAccountCompletedEventArgs e)
                    {
                        if (e.Error == null)
                        {
                            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("LockAccount: Error at Service:" + e.Error.ToString());
                        }
                    };

                    client.LockBankAccountAsync(BankAccountSource.Id);
                }
                catch (FaultException <ServiceError> excep)
                {
                    Debug.WriteLine("LockAccount: Error at Service:" + excep.ToString());
                }
            }
        }
        /// <summary>
        /// Locks the selected account.
        /// </summary>
        private void LockAccount()
        {
            if (this.BankAccountSource != null)
            {
                try
                {
                    var client = new BankingModuleServiceClient();

                    client.LockBankAccountCompleted += delegate(object sender, LockBankAccountCompletedEventArgs e)
                    {
                        if (e.Error == null)
                        {
                            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("LockAccount: Error at Service:" + e.Error.ToString());
                        }
                    };

                    client.LockBankAccountAsync(BankAccountSource.Id);
                }
                catch (FaultException<ServiceError> excep)
                {
                    Debug.WriteLine("LockAccount: Error at Service:" + excep.ToString());
                }
            }
        }