/// <summary> /// Refreshes the bank accounts status. /// </summary> private void RefreshBankAccountsStatus() { try { var client = new BankingModuleServiceClient(); client.FindBankAccountActivitiesCompleted += delegate(object sender, FindBankAccountActivitiesCompletedEventArgs e) { if (e.Error == null) { BankActivities = 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("RefreshBankAccountsStatus: Error at Service:" + e.Error.ToString()); } }; client.FindBankAccountActivitiesAsync(BankAccountSource.Id); } catch (FaultException <ServiceError> excep) { Debug.WriteLine("RefreshBankAccountsStatus: 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> /// 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> /// Refreshes the bank accounts status. /// </summary> private void RefreshBankAccountsStatus() { try { var client = new BankingModuleServiceClient(); client.FindBankAccountActivitiesCompleted += delegate(object sender, FindBankAccountActivitiesCompletedEventArgs e) { if (e.Error == null) { BankActivities = 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("RefreshBankAccountsStatus: Error at Service:" + e.Error.ToString()); } }; client.FindBankAccountActivitiesAsync(BankAccountSource.Id); } catch (FaultException<ServiceError> excep) { Debug.WriteLine("RefreshBankAccountsStatus: 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()); } } } }
/// <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()); } }