Пример #1
0
        public void GetBankAccounts()
        {
            if (!string.IsNullOrEmpty(this.FilterBankAccount))
            {
                MainModuleServiceClient client = new MainModuleServiceClient();

                if (this.FilterSelector == 0)
                {
                    client.GetBankAccountsAsync(new BankAccountInformation()
                    {
                        BankAccountNumber = this.FilterBankAccount
                    });
                }
                else
                {
                    client.GetBankAccountsAsync(new BankAccountInformation()
                    {
                        CustomerName = this.FilterBankAccount
                    });
                }

                client.GetBankAccountsCompleted += delegate(object s, GetBankAccountsCompletedEventArgs e)
                {
                    if (!e.Cancelled && e.Error == null)
                    {
                        List <BankAccount> bankAccounts = new List <BankAccount>();
                        e.Result.ToList().ForEach(ba => bankAccounts.Add(ba));

                        if (bankAccounts != null)
                        {
                            this.BankAccounts = bankAccounts;
                        }
                    }
                    else
                    {
                        MessageBox.Show(e.Error.Message, "Perform Transfer", MessageBoxButton.OK);
                    }
                };
            }
            else
            {
                MainModuleServiceClient client = new MainModuleServiceClient();
                client.GetBankAccountsAsync(new BankAccountInformation());

                client.GetBankAccountsCompleted += delegate(object s, GetBankAccountsCompletedEventArgs e)
                {
                    if (!e.Cancelled && e.Error == null)
                    {
                        List <BankAccount> bankAccounts = new List <BankAccount>();
                        e.Result.ToList().ForEach(ba => bankAccounts.Add(ba));

                        if (bankAccounts != null)
                        {
                            this.BankAccounts = bankAccounts;
                        }
                    }
                    else
                    {
                        MessageBox.Show(e.Error.Message, "Perform Transfer", MessageBoxButton.OK);
                    }
                };
            }
        }
        public void GetBankAccounts()
        {
            if (!string.IsNullOrEmpty(this.FilterBankAccount))
            {
                MainModuleServiceClient client = new MainModuleServiceClient();

                if (this.FilterSelector == 0)
                    client.GetBankAccountsAsync(new BankAccountInformation() { BankAccountNumber = this.FilterBankAccount });
                else
                    client.GetBankAccountsAsync(new BankAccountInformation() { CustomerName = this.FilterBankAccount });

                client.GetBankAccountsCompleted += delegate(object s, GetBankAccountsCompletedEventArgs e)
                {
                    if (!e.Cancelled && e.Error == null)
                    {
                        List<BankAccount> bankAccounts = new List<BankAccount>();
                        e.Result.ToList().ForEach(ba => bankAccounts.Add(ba));

                        if (bankAccounts != null)
                            this.BankAccounts = bankAccounts;
                        
                    }
                    else
                    {
                        MessageBox.Show(e.Error.Message, "Perform Transfer", MessageBoxButton.OK);
                    }
                };

            }
            else
            {
                MainModuleServiceClient client = new MainModuleServiceClient();
                client.GetBankAccountsAsync(new BankAccountInformation());

                client.GetBankAccountsCompleted += delegate(object s, GetBankAccountsCompletedEventArgs e)
                {
                    if (!e.Cancelled && e.Error == null)
                    {
                        List<BankAccount> bankAccounts = new List<BankAccount>();
                        e.Result.ToList().ForEach(ba => bankAccounts.Add(ba));

                        if (bankAccounts != null)
                            this.BankAccounts = bankAccounts;
                    }
                    else
                    {
                        MessageBox.Show(e.Error.Message, "Perform Transfer", MessageBoxButton.OK);
                    }
                };
            }
        }