private async Task ProcessMessageAsync(CheckBalance message)
        {
            using (var logger = Context.GetLogger(message))
            {
                try
                {
                    var balance = await _balanceObserverRole.UpdateBalanceAsync(message.Address, message.BlockNumber);

                    if (balance > 0)
                    {
                        logger.Info($"{message.Address} balance amount is {balance}");
                    }
                    else
                    {
                        logger.Suppress();
                    }
                }
                catch (Exception e)
                {
                    logger.Error(e);
                }
                finally
                {
                    Sender.Tell(new BalanceChecked());
                }
            }
        }
Esempio n. 2
0
        private void btnSixth_Click(object sender, EventArgs e)
        {
            //Creating Object of class CheckBalance and adding data
            CheckBalance[] array = new CheckBalance[]
            {
                new CheckBalance()
                {
                    Balance = 20000, Id = 4
                },
                new CheckBalance()
                {
                    Balance = 40000, Id = 1
                },
                new CheckBalance()
                {
                    Balance = 90000, Id = 7
                },
                new CheckBalance()
                {
                    Balance = 60000, Id = 10
                }
            };
            // LINQ Query :A statement that defines the query expression
            var myResult = from em in array
                           orderby em.Balance descending, em.Id ascending
            select em;

            //Code that executes the query and display ID based on balance(high to low)
            foreach (var em in myResult)
            {
                MessageBox.Show(em.Id.ToString());
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var Check  = new CheckBalance();
            var Upload = new UploadMoney();

            Console.WriteLine("\t\tPlease, choose the operation\n1.Check the balance; \t\t2.Upload credit card\nPlease, press 1 or 2");

            int n = int.Parse(Console.ReadLine());

            if (n == 1)
            {
                var CheckB = new CheckBalance();

                Client.CustomerCode(CheckB);
            }
            else if (n == 2)
            {
                var Upload = new UploadMoney();

                Client.CustomerCode(Upload);
                Upload.SetNext(Upload).SetNext(UploadMoney);
            }
            else
            {
                Console.WriteLine("Choose numbers from 1 to 2");
            }
        }
Esempio n. 4
0
 static void Main()
 {
     CheckBalance.Run();
     CheckRate.Run();
     ConvertFunds.Run();
     PayBeneficiary.Run();
     SimplePayment.Run();
 }
        public static void Run()
        {
            // Create entities and pre-initialize data
            dynamic sourceAccount = new Entity("account/1");
            sourceAccount.Balance = 1000m;
            dynamic destinationAccount = new Entity("account/2");
            destinationAccount.Balance = 1000m;

            // Create CheckBalance contexts
            // TODO: Potential usage scenario for a DI container
            var sourceBalance = new CheckBalance
            {
                TheAccount = new CheckBalance.Account(sourceAccount)
            };
            var destinationBalance = new CheckBalance
            {
                TheAccount = new CheckBalance.Account(destinationAccount)
            };

            Console.WriteLine("Balances before transfer:");
            sourceBalance.Execute();
            destinationBalance.Execute();

            // Make transfer via the TransferMoney context
            new TransferMoney
            {
                Source = new TransferMoney.SourceAccount(sourceAccount),
                Destination = new TransferMoney.DestinationAccount(destinationAccount),
                Amount = 350
            }
                .Execute();

            Console.WriteLine("Balances after transfer:");
            sourceBalance.Execute();
            destinationBalance.Execute();
        }
Esempio n. 6
0
        private void btnBalances_Click(object sender, EventArgs e)
        {
            CheckBalance checkBalance = new CheckBalance();

            checkBalance.ShowDialog();
        }