Beispiel #1
0
        public static async void Search(CustomSearchControl SearchControl)
        {
            var client = Helper.getServiceClient();
            var query  = new BankAccountQuery(); //by default we have an empty query

            if (SearchControl.OptionOne.IsChecked == true)
            {
                query = new BankAccountQuery()
                {
                    BankCode = SearchControl.SearchTextBox.Text
                };
            }
            else if (SearchControl.OptionTwo.IsChecked == true)
            {
                query = new BankAccountQuery()
                {
                    BankBranchCode = SearchControl.SearchTextBox.Text
                };
            }
            else if (SearchControl.OptionThree.IsChecked == true)
            {
                int _AccountSEQNo;
                if (int.TryParse(SearchControl.SearchTextBox.Text, out _AccountSEQNo))
                {
                    query = new BankAccountQuery()
                    {
                        AccountSEQNo = _AccountSEQNo
                    };
                }
                else
                {
                    SearchControl.ResultCount             = 0;
                    SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <FIN_TxnReference>();
                    MessageBox.Show("AccountSEQNo has to be a number ");
                    return;
                }
            }


            int pagesize     = SearchControl.PageSize;
            int pagePosition = SearchControl.PagePosition;
            var response     = await client.QueryBankAccountAsync(query, pagesize, pagePosition);

            //No response; exit
            if (response == null)
            {
                MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            SearchControl.ResultCount = response.TotalResultCount;
            //Fill the datagrid with the results
            SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <FIN_BankAccount>(response.Result.ToList <FIN_BankAccount>());;
        }
Beispiel #2
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = "account/{id}")] HttpRequest req,
            string id,
            ILogger log)
        {
            var bankAccountQuery = new BankAccountQuery(id);
            var bankAccount      = await mediator.Send(bankAccountQuery);

            var response = new AccountResponse(
                bankAccount.Id,
                bankAccount.AccountHolderName,
                bankAccount.Balance
                );

            return(new OkObjectResult(response));
        }