Beispiel #1
0
        /// <summary>
        /// Gets the bank accounts.
        /// </summary>
        public void GetBankAccounts()
        {
            try
            {
                var client = new BankingModuleServiceClient();

                client.FindBankAccountsCompleted += delegate(object sender, FindBankAccountsCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        BankAccounts = e.Result;
                    }
                    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("GetBankAccounts: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindBankAccountsAsync();
            }
            catch (FaultException <ServiceError> excep)
            {
                Debug.WriteLine("GetBankAccounts: Error at Service:" + excep.ToString());
            }
        }
        /// <summary>
        /// Gets the transfer list.
        /// </summary>
        /// <param name="customerName">Name of the customer.</param>
        private void GetTransfers(string customerName)
        {
            try
            {
                var client = new BankingModuleServiceClient();

                client.FindBankAccountsCompleted += delegate(object sender, FindBankAccountsCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        if (String.IsNullOrWhiteSpace(customerName))
                        {
                            Accounts = e.Result;
                        }
                        else
                        {
                            var search = from a in e.Result
                                         where
                                         a.CustomerFirstName.ToLowerInvariant().Contains(customerName.ToLowerInvariant()) ||
                                         a.CustomerLastName.ToLowerInvariant().Contains(customerName.ToLowerInvariant())
                                         select a;
                            Accounts = new ObservableCollection <BankAccountDTO>(search.ToList());
                        }
                    }
                    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("GetTransfers: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindBankAccountsAsync();
            }
            catch (FaultException <ServiceError> excep)
            {
                Debug.WriteLine("GetTransfers: Error at Service:" + excep.ToString());
            }
        }
        /// <summary>
        /// Gets the bank accounts.
        /// </summary>
        public void GetBankAccounts()
        {
            try
            {
                var client = new BankingModuleServiceClient();

                client.FindBankAccountsCompleted += delegate(object sender, FindBankAccountsCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        BankAccounts = e.Result;
                    }
                    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("GetBankAccounts: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindBankAccountsAsync();
            }
            catch (FaultException<ServiceError> excep)
            {
                Debug.WriteLine("GetBankAccounts: Error at Service:" + excep.ToString());
            }
        }
      /// <summary>
      ///    Gets the transfer list.
      /// </summary>
      /// <param name="customerName">Name of the customer.</param>
      private void GetTransfers(string customerName)
      {
         try
         {
            var client = new BankingModuleServiceClient();

            client.FindBankAccountsCompleted += delegate(object sender, FindBankAccountsCompletedEventArgs e)
            {
               if (e.Error == null)
               {
                  if (String.IsNullOrWhiteSpace(customerName)) {
                     Accounts = e.Result;
                  }
                  else
                  {
                     var search = from a in e.Result
                        where
                           a.CustomerFirstName.ToLowerInvariant().Contains(customerName.ToLowerInvariant())
                           || a.CustomerLastName.ToLowerInvariant().Contains(customerName.ToLowerInvariant())
                        select a;
                     Accounts = new ObservableCollection<BankAccountDTO>(search.ToList());
                  }
               }
               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("GetTransfers: Error at Service:" + e.Error.ToString());
               }
            };

            client.FindBankAccountsAsync();
         }
         catch (FaultException<ServiceError> excep) {
            Debug.WriteLine("GetTransfers: Error at Service:" + excep.ToString());
         }
      }